Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

How to Find the Spectral Decomposition

A real symmetric matrix can always be written A=QDQTA = QDQ^T: QQ is orthogonal with unit eigenvectors as columns, and DD is diagonal with the eigenvalues. Equivalently, A=λ1q1q1T+⋯+λnqnqnTA = \lambda_1\mathbf{q}_1\mathbf{q}_1^T + \cdots + \lambda_n\mathbf{q}_n\mathbf{q}_n^T.

Recognize the task

A symmetric matrix (A=ATA = A^T) and the words spectral decomposition, orthogonally diagonalize or principal axes, or a quadratic form to simplify. Forms: (2225)\begin{pmatrix} 2 & 2 \\ 2 & 5 \end{pmatrix}, (211121112)\begin{pmatrix} 2 & 1 & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 2 \end{pmatrix}. Test: is AA symmetric? If not, use diagonalization or the SVD.
The decomposition is in the spectral decomposition lesson; the spectral theorem guarantees it for every real symmetric matrix.

Steps

StepOn A=(2225)A = \begin{pmatrix} 2 & 2 \\ 2 & 5 \end{pmatrix}
1Check symmetry. Only for a symmetric matrix are real eigenvalues and an orthonormal set of eigenvectors guaranteed.a12=a21=2a_{12} = a_{21} = 2 ✓
2Find the eigenvalues. Solve the characteristic equation, as in the eigenvalues method.λ2−7λ+6=0\lambda^2 - 7\lambda + 6 = 0, λ1=6\lambda_1 = 6, λ2=1\lambda_2 = 1
3Find an eigenvector for each eigenvalue. Solve (A−λI)v=0(A - \lambda I)\mathbf{v} = \mathbf{0} as in the eigenvectors method. For a repeated eigenvalue, orthogonalize its eigenspace with Gram-Schmidt.λ=6\lambda = 6: (1,2)(1, 2); λ=1\lambda = 1: (2,−1)(2, -1)
4Normalize and assemble. Divide each eigenvector by its length. Column ii of QQ must match diagonal entry ii of DD.Q=15(122−1)Q = \frac{1}{\sqrt{5}}\begin{pmatrix} 1 & 2 \\ 2 & -1 \end{pmatrix}, D=(6001)D = \begin{pmatrix} 6 & 0 \\ 0 & 1 \end{pmatrix}
5Check with the outer-product form. Add the terms λiqiqiT\lambda_i\mathbf{q}_i\mathbf{q}_i^T (spectral decomposition); the sum must be AA.65(1224)+15(4−2−21)=(2225)\frac{6}{5}\begin{pmatrix} 1 & 2 \\ 2 & 4 \end{pmatrix} + \frac{1}{5}\begin{pmatrix} 4 & -2 \\ -2 & 1 \end{pmatrix} = \begin{pmatrix} 2 & 2 \\ 2 & 5 \end{pmatrix} ✓

Worked examples

Example 1 · eigenvalues of opposite sign

2 by 2
A=(1221)A = \begin{pmatrix} 1 & 2 \\ 2 & 1 \end{pmatrix}: λ=3,−1\lambda = 3, -1
trace 22, determinant −3-3
q1=12(1,1)\mathbf{q}_1 = \frac{1}{\sqrt{2}}(1, 1), q2=12(1,−1)\mathbf{q}_2 = \frac{1}{\sqrt{2}}(1, -1)
already orthogonal
A=32(1111)−12(1−1−11)A = \frac{3}{2}\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} - \frac{1}{2}\begin{pmatrix} 1 & -1 \\ -1 & 1 \end{pmatrix}
a sum of two projections

Example 2 · a repeated eigenvalue

Gram-Schmidt inside
A=(211121112)A = \begin{pmatrix} 2 & 1 & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 2 \end{pmatrix}: λ=4,1,1\lambda = 4, 1, 1
AA is II plus the all-ones matrix
λ=4\lambda = 4: 13(1,1,1)\frac{1}{\sqrt{3}}(1, 1, 1); λ=1\lambda = 1: the plane x+y+z=0x + y + z = 0
solve (A−λI)v=0(A - \lambda I)\mathbf{v} = \mathbf{0}
basis (1,−1,0),(1,0,−1)(1, -1, 0), (1, 0, -1) becomes (1,−1,0),(12,12,−1)(1, -1, 0), (\frac{1}{2}, \frac{1}{2}, -1)
Gram-Schmidt in the eigenspace
Q=(13121613−1216130−26)Q = \begin{pmatrix} \frac{1}{\sqrt{3}} & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{6}} \\ \frac{1}{\sqrt{3}} & -\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{6}} \\ \frac{1}{\sqrt{3}} & 0 & -\frac{2}{\sqrt{6}} \end{pmatrix}, D=diag⁡(4,1,1)D = \operatorname{diag}(4, 1, 1)
normalize all three

Example 3 · a matrix square root

function of A
A=(5445)A = \begin{pmatrix} 5 & 4 \\ 4 & 5 \end{pmatrix}: λ=9,1\lambda = 9, 1 with the same q1,q2\mathbf{q}_1, \mathbf{q}_2 as the first example
trace 1010, determinant 99
A=3⋅12(1111)+1⋅12(1−1−11)\sqrt{A} = 3 \cdot \frac{1}{2}\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} + 1 \cdot \frac{1}{2}\begin{pmatrix} 1 & -1 \\ -1 & 1 \end{pmatrix}
square root of each eigenvalue
A=(2112)\sqrt{A} = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}
check: its square is AA

See it happen

A symmetric matrix stretches space along perpendicular axes, its eigenvectors, by its eigenvalues. QTQ^T turns those axes onto the coordinate axes, DD stretches, and QQ turns them back. Each term λiqiqiT\lambda_i\mathbf{q}_i\mathbf{q}_i^T is the projection onto one axis, scaled by its eigenvalue. Explore it in the spectral decomposition visualizer.

Common mistakes

Leaving the eigenvectors unnormalized

✗ Q=(122−1)Q = \begin{pmatrix} 1 & 2 \\ 2 & -1 \end{pmatrix}, which gives QDQT=5AQDQ^T = 5A
✓ divide each column by 5\sqrt{5} so that QT=Q−1Q^T = Q^{-1}

Mismatched order

✗ Q=15(122−1)Q = \frac{1}{\sqrt{5}}\begin{pmatrix} 1 & 2 \\ 2 & -1 \end{pmatrix} with D=diag⁡(1,6)D = \operatorname{diag}(1, 6)
✓ column 1 belongs to λ=6\lambda = 6: D=diag⁡(6,1)D = \operatorname{diag}(6, 1)

Skipping Gram-Schmidt in a repeated eigenspace

✗ using (1,−1,0)(1, -1, 0) and (1,0,−1)(1, 0, -1), normalized, as columns of QQ
✓ they are eigenvectors but not orthogonal; orthogonalize them first

Using it on a matrix that is not symmetric

✗ (1102)=QDQT\begin{pmatrix} 1 & 1 \\ 0 & 2 \end{pmatrix} = QDQ^T
✓ its eigenvectors (1,0)(1, 0) and (1,1)(1, 1) are not orthogonal; use PDP−1PDP^{-1}