Eigenvalues and Diagonalization
Plot size against rent for a few hundred flats and the dots form a long cloud tilted up and to the right. The direction the cloud stretches along, and how far it stretches, are an eigenvector and an eigenvalue. Principal component analysis, a standard way to shrink many features into a few, is built on exactly this.
The rule
An eigenvector keeps its direction; its eigenvalue says how much it stretches.
Most vectors change direction when a matrix acts on them. A few special ones only get longer, shorter or flipped. For those, : is the eigenvector and the number is its eigenvalue.
Take :
- : . Same direction, stretched by 3, so .
- : . Same direction, stretched by 1, so .
- : . The direction changed, so this is not an eigenvector.
Diagonalization rewrites the matrix using its eigenvectors: , where the columns of are the eigenvectors and is diagonal with the eigenvalues. In eigenvector coordinates the matrix is just "stretch each axis". That makes powers easy: , and a diagonal matrix is raised to a power one entry at a time.
Covariance matrices, which describe how features vary together, are symmetric. Symmetric matrices always have real eigenvalues and perpendicular eigenvectors, which is why PCA can use them as new axes: the eigenvector with the largest eigenvalue points where the data spreads most.
The shortcut
For a 2 × 2 matrix: the eigenvalues add up to the trace and multiply to the determinant. The trace is the sum of the diagonal. Find two numbers with that sum and product.
Trace and determinant
Trace: 4 + 3 = 7. Determinant: 4 × 3 − 1 × 2 = 10.
For a diagonal or triangular matrix it is even faster: the eigenvalues are the diagonal entries.
Drills
Answer fast — trust the rule.
What are the eigenvalues of [[5, 0], [0, 2]]?
What are the eigenvalues of [[2, 2], [1, 3]]?
Is [1, 1] an eigenvector of [[2, 1], [1, 2]]?
Why does diagonalizing A make the tenth power of A easy?
In PCA on size-and-rent data, what does the eigenvector with the largest eigenvalue of the covariance matrix point along?
Remember
- An eigenvector keeps its direction; its eigenvalue says how much it stretches.
- Shortcut for 2 × 2: eigenvalues add to the trace and multiply to the determinant.
- Trap: assuming any vector is an eigenvector; check that the direction really stays put.
