Skip to content
AI360XpertBeta

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.

The symmetric 4 1 1 3 matrix stretches its two perpendicular eigenvector axes by 4.618 and 2.382, with no rotation mixed in
The symmetric 4 1 1 3 matrix stretches its two perpendicular eigenvector axes by 4.618 and 2.382, with no rotation mixed in

Why Does This Exist?

Covariance matrices, Hessians, kernels and graph Laplacians share one property: symmetry (AT=AA^T = A). Symmetry buys the strongest decomposition in linear algebra. Where a general matrix needs a fragile PDP−1PDP^{-1} with an explicit inverse, a symmetric matrix splits into A=QΛQTA = Q\Lambda Q^T with QQ 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 curvature directions are trustworthy, and why spectral clustering leans on the Laplacian. General eigenvalues and eigenvectors teach the objects; this page is the symmetric upgrade where everything becomes orthonormal.

The one idea you need first

An orthogonal matrix QQ satisfies QTQ=IQ^T Q = I: its columns are unit length and mutually perpendicular, and Q−1=QTQ^{-1} = Q^T. Rotations and reflections qualify. Multiplying by QQ 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 QΛQTQ\Lambda Q^T is the recipe: rotate to the weave, stretch, rotate back.

The analogy stops at large deformations: rubber weave directions are fixed by manufacturing, while eigenvector axes are discovered from the matrix itself.

How It Actually Works

For symmetric AA, there exist orthonormal q1,…,qnq_1, \ldots, q_n and real λi\lambda_i with:

A=QΛQT=∑i=1nλiqiqiTA = Q\Lambda Q^T = \sum_{i=1}^n \lambda_i q_i q_i^T

In plain words: QQ holds the axes as columns, Λ\Lambda holds the stretches on its diagonal. Read it right to left on a vector xx: QTQ^T re-views xx in the eigenbasis, Λ\Lambda stretches each coordinate by λi\lambda_i, QQ rotates back. The sum form says AA is a weighted stack of rank-one projections, weight λi\lambda_i on direction qiq_i. Dropping small-λi\lambda_i terms is exactly truncated PCA, and the spectral theorem states why this always works.

Worked example

Split A=[4113]A = \begin{bmatrix} 4 & 1 \\ 1 & 3 \end{bmatrix}. Hand-computed trace is 4+3=74 + 3 = 7 and determinant is 4×3−1×1=12−1=114 \times 3 - 1 \times 1 = 12 - 1 = 11, so the characteristic equation λ2−7λ+11=0\lambda^2 - 7\lambda + 11 = 0 gives:

λ=7±49−442=7±52≈7±2.2362≈4.618, 2.382\lambda = \frac{7 \pm \sqrt{49 - 44}}{2} = \frac{7 \pm \sqrt{5}}{2} \approx \frac{7 \pm 2.236}{2} \approx 4.618,\ 2.382

Both real, as symmetry guarantees. Their product 4.618×2.382≈11.04.618 \times 2.382 \approx 11.0 recovers the determinant, and their sum 4.618+2.382=7.04.618 + 2.382 = 7.0 recovers the trace.

For λ1≈4.618\lambda_1 \approx 4.618, solving (A−λ1I)v=0(A - \lambda_1 I)v = 0 gives v1∝[1,0.618]v_1 \propto [1, 0.618]; for λ2≈2.382\lambda_2 \approx 2.382, v2∝[−0.618,1]v_2 \propto [-0.618, 1]. Dot product: 1×(−0.618)+0.618×1=−0.618+0.618=01 \times (-0.618) + 0.618 \times 1 = -0.618 + 0.618 = 0. Perpendicular, exactly as promised, with no arrangement needed. The diagram draws these two axes with their stretch labels.

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)))  # -> True

eigh (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. The returned values are approximately [2.382,4.618][2.382, 4.618] in ascending order.

Watch Out For

Assuming any diagonalisation is orthogonal

A=PDP−1A = PDP^{-1} for a general matrix has no orthogonality: PP columns can be nearly parallel, and then P−1P^{-1} amplifies rounding error catastrophically. Orthogonal diagonalisation is a symmetric privilege. Check AT=AA^T = A up to rounding before treating an eigenbasis as orthonormal, especially for Hessians assembled by autodiff.

Depending on eigenvector signs

If vv is an eigenvector so is −v-v, 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 vvTvv^T) instead of raw vectors.

The Quick Version

  • Symmetric matrices split into QΛQTQ\Lambda Q^T with real eigenvalues and perpendicular eigenvectors.
  • The 4-1-1-3 example gives eigenvalues 4.6184.618 and 2.3822.382 with orthogonal axes [1,0.618][1, 0.618] and [−0.618,1][-0.618, 1].
  • Trace 77 and determinant 1111 are recovered as sum and product, a free hand-check.
  • The sum form shows AA as stacked rank-one projections, which is what PCA truncates.
  • Use eigh, not eig, on symmetric input: orthonormality comes guaranteed.
  • Eigenvector signs are arbitrary; compare subspaces, never raw vectors.