Symmetric matrices and the spectral theorem
Show that a real symmetric matrix has real eigenvalues and perpendicular eigenvectors, write it as A = QΛQᵀ with Q orthogonal, and expand it as a sum λ₁q₁q₁ᵀ + λ₂q₂q₂ᵀ of projections.
It opens on
The eigen-lines of [[4, 1], [2, 3]] meet at about 108°, but those of [[2, 1], [1, 2]] meet at exactly 90°. Is that luck, or does the symmetry of the second matrix force it?
Why it matters
Covariance matrices, Gram matrices XᵀX, Hessians and graph Laplacians are all symmetric; the spectral theorem says each of them is just stretching along perpendicular axes, which is the whole idea behind PCA.
Good to know first
- Diagonalizing a matrix: A = SΛS⁻¹ with eigenvectors in S
- Gram-Schmidt and QR: an orthogonal matrix has QᵀQ = I, so Q⁻¹ = Qᵀ
- Projection onto a line: the projection matrix onto a unit vector q is qqᵀ
- Transpose and special matrices: A is symmetric when Aᵀ = A
Step by step
Real eigenvalues and perpendicular eigenvectors
See that symmetric A = [[2, 1], [1, 2]] has perpendicular eigenvectors, prove it in general, and see why its eigenvalues are real.
A(1, 1) = (3, 3) and A(1, −1) = (1, −1), so λ₁ = 3 with v₁ = (1, 1) and λ₂ = 1 with v₂ = (1, −1); and v₁ · v₂ = 1 − 1 = 0, a right angle in the picture.
A common mix-up
Every matrix with real eigenvalues has perpendicular eigenvectors.
In fact: [[4, 1], [2, 3]] has real eigenvalues 5 and 2 but eigenvectors at 108.4°; it is symmetry that forces the right angle.
A = QΛQᵀ: rotate, stretch, rotate back
Normalize the eigenvectors into an orthogonal Q, write A = QΛQᵀ, and see it turn the square on q₁, q₂ into a rectangle.
Diagonalization A = SΛS⁻¹ with S = Q becomes A = QΛQᵀ, with Λ = [[3, 0], [0, 1]].
A common mix-up
Q⁻¹ must be computed by the inverse formula.
In fact: For orthonormal columns QᵀQ = I, so Q⁻¹ is just Qᵀ.
A as a sum of projections
Expand A = λ₁q₁q₁ᵀ + λ₂q₂q₂ᵀ, recognize each qqᵀ as a projection, and apply A to x = (2, 0) piece by piece.
q₁q₁ᵀ = (1/2)[[1, 1], [1, 1]] and q₂q₂ᵀ = (1/2)[[1, −1], [−1, 1]], so A = 3·(1/2)[[1, 1], [1, 1]] + 1·(1/2)[[1, −1], [−1, 1]] = [[2, 1], [1, 2]].
A common mix-up
The rank-one pieces λᵢqᵢqᵢᵀ are the columns of A.
In fact: They are full 2 × 2 matrices, each a scaled projection; A is their sum, entry by entry.
Try it
Find the eigenvalues and eigenvectors of [[3, 1], [1, 3]] and check they are perpendicular.Answer
λ = 4 with (1, 1) and λ = 2 with (1, −1); dot product 0
Hint: Trace 6, determinant 8
Write [[3, 1], [1, 3]] as QΛQᵀ.Answer
Q = (1/√2)[[1, 1], [1, −1]], Λ = [[4, 0], [0, 2]]
Hint: The eigenvectors are those of [[2, 1], [1, 2]]
Write [[5, 2], [2, 2]] as λ₁q₁q₁ᵀ + λ₂q₂q₂ᵀ.Answer
6·(1/5)[[4, 2], [2, 1]] + 1·(1/5)[[1, −2], [−2, 4]]
Hint: q₁ = (2, 1)/√5, q₂ = (1, −2)/√5
For [[a, b], [b, c]], the characteristic polynomial has discriminant (a + c)² − 4(ac − b²). Why can it never be negative?Answer
It equals (a − c)² + 4b², a sum of squares.
The blue square has sides q₁ and q₂. What are the sides of its image under A?Answer
3q₁ and q₂: a rectangle 3 by 1, still with right angles.
