Symmetric Eigendecomposition
A symmetric matrix is a stretch along perpendicular axes, no rotation mixed in. Its eigendecomposition names those axes and the stretch on each.
Why Does This Exist?
Covariance matrices, Hessians, kernels and graph Laplacians share one property: symmetry (). Symmetry buys the strongest decomposition in linear algebra. Where a general matrix needs a fragile with an explicit inverse, a symmetric matrix splits into with orthogonal, so the "inverse" is a free transpose. Eigenvalues come out real, eigenvectors out mutually perpendicular, and nothing can go complex or defective on you.
That is why PCA works on the covariance without fear, why the Hessian's curvature directions are trustworthy, and why spectral clustering leans on the Laplacian. General eigenvalues and eigenvectors teach the objects; diagonalisation assembles them for ordinary matrices. This page is the symmetric upgrade where everything becomes orthonormal.
The one idea you need first
An orthogonal matrix satisfies : its columns are unit length and mutually perpendicular, and . Rotations and reflections qualify. Multiplying by never stretches anything, it only re-views, which is why the symmetric decomposition is numerically bulletproof.
Think of It Like This
Stretching a printed grid along its own weave
Print a square grid on rubber and pin it at two perpendicular weave directions. Pull one direction harder than the other. The grid lines stay perpendicular throughout: each line keeps its direction and only changes length.
That is symmetric action. A general matrix would also shear the grid, tilting lines so they stop being perpendicular, and unpicking shear from stretch takes the fragile general machinery. Symmetry forbids shear from the start, so the matrix is fully described by "which perpendicular directions" plus "how much stretch each". Those are the eigenvectors and eigenvalues, and is the recipe: rotate to the weave, stretch, rotate back.
How It Actually Works
For symmetric , there exist orthonormal and real with:
Read it right to left on a vector : re-views in the eigenbasis, stretches each coordinate by , rotates back. The sum form says is a weighted stack of rank-one projections, weight on direction . Dropping small- terms is exactly truncated PCA, and the spectral theorem states why this always works.
Worked example
Split . Trace 7, determinant , so the characteristic equation gives:
Both real, as symmetry guarantees. Their product recovers the determinant. For , solving gives ; for , . Dot product: . Perpendicular, exactly as promised, with no arrangement needed.
Code
The point is the check: reconstruct from the factors and confirm orthonormality, with no explicit inverse anywhere.
import numpy as np
A = np.array([[4.0, 1.0], [1.0, 3.0]])w, Q = np.linalg.eigh(A) # symmetric solver: orthonormal Q guaranteedprint(np.allclose(Q @ np.diag(w) @ Q.T, A)) # -> Trueprint(np.allclose(Q.T @ Q, np.eye(2))) # -> Trueeigh (the symmetric solver) returns real eigenvalues and orthonormal vectors by construction. The general eig would work here too but promises less; on symmetric input, always reach for eigh.
Watch Out For
Assuming any diagonalisation is orthogonal
for a general matrix has no orthogonality: 's columns can be nearly parallel, and then amplifies rounding error catastrophically. Orthogonal diagonalisation is a symmetric privilege. Check (up to rounding) before treating an eigenbasis as orthonormal, especially for Hessians assembled by autodiff.
Depending on eigenvector signs
If is an eigenvector so is , and solvers return either sign unpredictably across versions and machines. Code that compares eigenvectors elementwise, or plots loadings assuming a fixed orientation, breaks on upgrade. Compare subspaces (absolute values, projections, outer products ) instead of raw vectors.
The Quick Version
- Symmetric matrices split into with real eigenvalues and perpendicular eigenvectors.
- The 4-1-1-3 example gives eigenvalues 4.618 and 2.382 with orthogonal axes.
- The sum form shows as stacked rank-one projections, which is what PCA truncates.
- Use
eigh, noteig, on symmetric input: orthonormality comes guaranteed. - Eigenvector signs are arbitrary; compare subspaces, never raw vectors.