Diagonalization in this visualization
A linear transformation of the plane has the matrix in the standard basis. In another basis , the columns of , the same transformation has the matrix : to transform a vector given by its coordinates in the new basis, turn them into standard coordinates , apply , and turn the result back with . The -th column of holds the coordinates of in the new basis: . Diagonalizing means finding a basis in which is diagonal. In the picture the basis is blue, the images are ink, and the picked image is split in yellow into its two parts.
What a change of basis keeps
Every entry of can change with the basis, but and describe one transformation, so whatever belongs to the transformation itself stays: the trace (), the determinant, and the eigenvalues. For the default matrix the trace stays 5 and the determinant 4 in every basis.
Why eigenvectors make B diagonal
The first column of is exactly when , that is, when is an eigenvector; the same goes for the second column. So is diagonal exactly when both basis vectors are eigenvectors, and then with the diagonal matrix of eigenvalues. This makes powers easy: , and only raises each diagonal entry to the -th power. For the default matrix, gives without multiplying ten times. A real symmetric matrix can always be given an eigenbasis of perpendicular vectors.
When it cannot be done
A real 2 × 2 matrix can be diagonalized with a real basis exactly when it has two real eigenvectors pointing in different directions. Two different real eigenvalues guarantee that, but they are not needed: has one eigenvalue twice and is already diagonal. A shear has only one eigenline; with on it the first column becomes , but the upper-right entry stays nonzero for every independent of , and an upper triangular matrix is the best a basis can do. A quarter turn moves every real direction, so no real basis works; with complex numbers it can be diagonalized.
Things to notice
- The diagonal entries come in the order of the basis vectors: swapping b₁ and b₂ swaps them.
- Stretching either eigenvector of an eigenbasis changes P but not B.
Controls
- Drag the tips of the blue basis vectors; near an eigenline a tip snaps onto it. Arrow keys move a focused tip by 0.1.