Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Spectral Decompositions






A Symmetric Matrix as a Sum of Projections

The spectral decomposition factors a real symmetric matrix as QDQᵀ — an orthogonal matrix of eigenvectors times a diagonal matrix of eigenvalues times the transpose. In outer product form, this becomes a sum of rank-one projections weighted by eigenvalues. The decomposition is the factorization form of the spectral theorem and the foundation of principal component analysis, quadratic form classification, and positive definiteness testing.



What the Spectral Decomposition Is

Every real symmetric matrix AA factors as

What the Spectral Decomposition Is
A=QDQTA = QDQ^T

Fact: The spectrum turned out to be literal
Mathematicians were calling the set of eigenvalues a spectrum by the early 1900s, a word borrowed from light. In 1926 Schrödinger found the energy levels of hydrogen as the eigenvalues of a symmetric operator, and the gaps between them give the frequencies of its spectral lines.

where QQ is orthogonal (QTQ=QQT=IQ^TQ = QQ^T = I) and D=diag(λ1,…,λn)D = \text{diag}(\lambda_1, \dots, \lambda_n) is the diagonal matrix of eigenvalues. The columns of QQ are orthonormal eigenvectors: Q=[q1  q2  ⋯  qn]Q = [\mathbf{q}_1 \; \mathbf{q}_2 \; \cdots \; \mathbf{q}_n] with Aqi=λiqiA\mathbf{q}_i = \lambda_i\mathbf{q}_i and qi⋅qj=δij\mathbf{q}_i \cdot \mathbf{q}_j = \delta_{ij}.

This is the diagonalization A=PDP−1A = PDP^{-1} specialized to symmetric matrices, where the crucial bonus is that PP can be chosen orthogonal — so P−1=PTP^{-1} = P^T. The orthogonality of QQ is not a convenience; it is a structural guarantee that holds for every real symmetric matrix, regardless of eigenvalue multiplicities.

Spectral Decomposition Notation

Notation

Spectral Decomposition Notation

A single superscript carries the whole theorem, the same decomposition is written twice in shapes that look unrelated, and the letters collapse into one another when the matrix is symmetric.
The letter λ\lambda, the spectrum and the characteristic determinant are set out at the characteristic equation; the factorisation A=PDP−1A = PDP^{-1} and the column-to-diagonal pairing at diagonalization. The reserved QQ with QTQ=IQ^{T}Q = I and the Kronecker delta belong to orthogonal sets, the transpose position that separates an outer product from an inner one to QR, and the condition xTAx>0\mathbf{x}^{T}A\mathbf{x} > 0 with its curved comparison signs to Cholesky.
A=QDQTA = QDQ^{T}
A equals Q D Q transpose
This is A=PDP−1A = PDP^{-1} with one superscript changed, and the change is the entire content. Writing QTQ^{T} where an inverse is required asserts that Q−1=QTQ^{-1} = Q^{T}, which holds only for an orthogonal matrix. The line therefore states the spectral theorem in a superscript: the eigenvector matrix can be chosen orthogonal, so no inversion is ever needed.
CasesThe guarantee is unconditional for a real symmetric AA, including when eigenvalues repeat. Where general diagonalization can fail outright, this factorisation always exists, and the letter QQ rather than PP is what announces it.
Also writtenThe complex case replaces the transpose with the conjugate transpose, A=UDU∗A = UDU^{*} for Hermitian AA, keeping the shape and widening the hypothesis.
Do not confuseReading QTQ^{T} as a factor unrelated to Q−1Q^{-1}, which makes the line look like an unusual choice rather than a saving. The two are the same matrix here, and A=QDQ−1A = QDQ^{-1} is equally correct and never written.
Same glyph elsewhereThe exponent TT marks an ordinary transpose throughout. Nothing about this equation makes it a special operation — the content is that the transpose happens to land on the inverse.
A=QDQT=λ1q1q1T+⋯+λnqnqnTA = QDQ^{T} = \lambda_1\mathbf{q}_1\mathbf{q}_1^{T} + \cdots + \lambda_n\mathbf{q}_n\mathbf{q}_n^{T}
A equals Q D Q transpose, which also equals a sum of n rank-one terms
One decomposition written in two shapes that share no visible structure. On the left, three matrices multiplied. On the right, nn matrices added. Nothing in either expression records that they are the same thing; the equality comes from expanding the product column by column, and it has to be supplied by the reader.
CasesEach term λiqiqiT\lambda_i\mathbf{q}_i\mathbf{q}_i^{T} is a rank-one matrix, and the factor qiqiT\mathbf{q}_i\mathbf{q}_i^{T} on its own is the projection onto the line through qi\mathbf{q}_i. The sum form is the one that shows what AA does; the product form is the one that computes.
Also writtenCompressed to A=∑i=1nλiPiA = \sum_{i=1}^{n}\lambda_iP_i where each PiP_i is named as a projector, which hides the vectors and makes the decoupling explicit.
Do not confuseReading the sum as an approximation, in the way a truncated series usually is. With all nn terms present the equality is exact; dropping terms is a separate decision, and it is what turns the same line into low-rank approximation.
xTAx=yTDy=∑i=1nλiyi2,x=Qy\mathbf{x}^{T}A\mathbf{x} = \mathbf{y}^{T}D\mathbf{y} = \sum_{i=1}^{n}\lambda_iy_i^2, \qquad \mathbf{x} = Q\mathbf{y}
x transpose A x equals y transpose D y, which equals the sum of lambda i times y i squared, where x is Q y
The two sandwiches describe one number, and the substitution written to the right is what licenses the equality. Replacing AA by DD is not a simplification of the matrix; it is the same form measured in different coordinates, and y\mathbf{y} names the coordinates of x\mathbf{x} along the eigenvectors.
CasesBecause DD is diagonal, the middle expression has no cross terms, which is what the final sum makes visible: nn independent squares, each weighted by an eigenvalue. The cross terms did not cancel — they were absorbed into the change of variables.
Also writtenThe substitution is sometimes folded in as y=QTx\mathbf{y} = Q^{T}\mathbf{x}, the same statement read in the other direction, which is available only because Q−1=QTQ^{-1} = Q^{T}.
Do not confuseTreating y\mathbf{y} as a new unknown to solve for. It is a relabelling of the same vector, and the sign of each λi\lambda_i then classifies the form — positive definite, indefinite and their relatives are set out at Cholesky.
Same glyph elsewhereΣ\Sigma appears on this page as a covariance matrix, as the summation sign above, and at the singular value decomposition as the matrix of singular values — three unrelated jobs for one glyph, distinguished only by position.
U=V=Q,σi=∣λi∣U = V = Q, \qquad \sigma_i = |\lambda_i|
U and V both become Q, and each singular value is the absolute value of an eigenvalue
The three-letter form A=UΣVTA = U\Sigma V^{T} and the two-letter form A=QDQTA = QDQ^{T} describe the same matrix when AA is symmetric with non-negative eigenvalues. The separate names for the outer factors exist to allow them to differ; symmetry removes the need, and the notation contracts.
CasesWhen an eigenvalue is negative the collapse is incomplete. Singular values are never negative, so σi=∣λi∣\sigma_i = |\lambda_i|, and the discarded sign is stored by negating the matching column of UU relative to VV. The bars are doing bookkeeping, not measurement.
Also writtenWritten Σ=∣D∣\Sigma = |D| as a statement about the whole diagonal, which is entrywise here only because both matrices are diagonal.
Do not confuseConcluding that eigenvalues and singular values are the same quantity. They agree for symmetric positive semi-definite matrices and for nothing else, and the sign is the information the absolute value throws away.

The Spectral Theorem

The spectral theorem for real symmetric matrices states three facts.

All eigenvalues of a real symmetric matrix are real. No complex eigenvalues can appear.

Eigenvectors corresponding to distinct eigenvalues are orthogonal. If λi≠λj\lambda_i \neq \lambda_j, then qi⋅qj=0\mathbf{q}_i \cdot \mathbf{q}_j = 0 automatically — no Gram-Schmidt is needed between different eigenspaces.

THEOREMSpectral Theorem
Every real symmetric matrix is orthogonally diagonalizable.

Pitfall: Assuming eigenvectors are always orthogonal
For A=(211121112)A = \begin{pmatrix} 2 & 1 & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 2 \end{pmatrix}, row reduction gives (1,−1,0)T(1, -1, 0)^T and (1,0,−1)T(1, 0, -1)^T for the repeated eigenvalue λ=1\lambda = 1, and their dot product is 11, not 00. Orthogonalizing within the eigenspace replaces the second by 12(1,1,−2)T\frac{1}{2}(1, 1, -2)^T.

There always exist nn orthonormal eigenvectors forming a basis for Rn\mathbb{R}^n, even when eigenvalues are repeated. For a repeated eigenvalue with geometric multiplicity kk, the eigenspace is kk-dimensional, and Gram-Schmidt within that eigenspace produces kk orthonormal eigenvectors.

Together these three facts guarantee that A=QDQTA = QDQ^T exists for every real symmetric AA.

The Outer Product Form

Expanding A=QDQTA = QDQ^T column by column produces the spectral decomposition in outer product form:

The Outer Product Form
A=λ1q1q1T+λ2q2q2T+⋯+λnqnqnTA = \lambda_1 \mathbf{q}_1\mathbf{q}_1^T + \lambda_2 \mathbf{q}_2\mathbf{q}_2^T + \cdots + \lambda_n \mathbf{q}_n\mathbf{q}_n^T

Each term λiqiqiT\lambda_i \mathbf{q}_i\mathbf{q}_i^T is a rank-one matrix. The matrix qiqiT\mathbf{q}_i\mathbf{q}_i^T is the projection matrix onto the line spanned by qi\mathbf{q}_i: it sends any vector x\mathbf{x} to (qi⋅x)qi(\mathbf{q}_i \cdot \mathbf{x})\mathbf{q}_i. Multiplying by λi\lambda_i scales the projection by the eigenvalue.

The spectral decomposition says that AA acts by projecting onto each eigenvector direction independently, scaling each projection by the corresponding eigenvalue, and summing the results. There is no interaction between different eigenvector directions — the orthogonality of the qi\mathbf{q}_i's ensures complete decoupling.
A2×22112=3·q₁q₁ᵀ2×23/23/23/23/2+1·q₂q₂ᵀ2×21/2−1/2−1/21/2
One eigenvalue times one rank-one piece

Each eigenvector has been multiplied by its own transpose to give a rank-one matrix, and each of those is weighted by its eigenvalue. The sum of these pieces reconstructs the original exactly. Dropping the pieces with the smallest weights is how the decomposition turns into an approximation. Add the pieces back one at a time on the spectral decomposition visualizer.

This is the form principal component analysis uses, where the weights are variances and the pieces are the components.
Every symmetric matrix is a sum of independent stretches along perpendicular directions, and nothing more.

Computing the Spectral Decomposition

The computation follows the standard eigenvalue workflow, with one additional step for repeated eigenvalues.

Find the eigenvalues by solving the characteristic equation det⁡(A−λI)=0\det(A - \lambda I) = 0. All roots are real.

For each eigenvalue λi\lambda_i, find the eigenspace by solving (A−λiI)v=0(A - \lambda_i I)\mathbf{v} = \mathbf{0} via row reduction.

If an eigenvalue has multiplicity greater than 11, apply Gram-Schmidt within its eigenspace to produce an orthonormal basis. Eigenvectors from different eigenspaces are already orthogonal — no cross-eigenspace orthogonalization is needed.

Assemble QQ (orthonormal eigenvectors as columns) and DD (eigenvalues on the diagonal in matching order).

Worked Example
For A=(3113)A = \begin{pmatrix} 3 & 1 \\ 1 & 3 \end{pmatrix}: eigenvalues are λ1=4\lambda_1 = 4, λ2=2\lambda_2 = 2. Eigenvectors: q1=12(1,1)T\mathbf{q}_1 = \frac{1}{\sqrt{2}}(1, 1)^T, q2=12(1,−1)T\mathbf{q}_2 = \frac{1}{\sqrt{2}}(1, -1)^T. Then A=4⋅12(1111)+2⋅12(1−1−11)=(2222)+(1−1−11)=(3113)A = 4 \cdot \frac{1}{2}\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} + 2 \cdot \frac{1}{2}\begin{pmatrix} 1 & -1 \\ -1 & 1 \end{pmatrix} = \begin{pmatrix} 2 & 2 \\ 2 & 2 \end{pmatrix} + \begin{pmatrix} 1 & -1 \\ -1 & 1 \end{pmatrix} = \begin{pmatrix} 3 & 1 \\ 1 & 3 \end{pmatrix}.

Pitfall: Leaving the eigenvectors unnormalized
Using Q=(111−1)Q = \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} unscaled gives QTQ=2IQ^TQ = 2I and QDQT=(6226)=2AQDQ^T = \begin{pmatrix} 6 & 2 \\ 2 & 6 \end{pmatrix} = 2A. With the factor 12\frac{1}{\sqrt{2}} on each column, QDQT=AQDQ^T = A.

Each eigenvector first comes out of row reduction as a direction, here (1,1)T(1, 1)^T for λ1=4\lambda_1 = 4 and (1,−1)T(1, -1)^T for λ2=2\lambda_2 = 2, and any nonzero multiple of either would be an eigenvector as well. The factor 12\frac{1}{\sqrt{2}} in front of each fixes its length at 11. The pairing is fixed too: the ii-th column of QQ goes with the ii-th diagonal entry of DD.
A2×22112=Q2×20.70710.70710.7071−0.7071·Λ2×23001·Qᵀ2×20.70710.70710.7071−0.7071
Q orthogonal, Λ diagonal, Q transposed

Because the eigenvectors of a symmetric matrix can be chosen orthonormal, the matrix of them is orthogonal — and the inverse of an orthogonal matrix is simply its transpose. That is the whole economy of the spectral form: no inverse ever has to be computed. Check the orthogonality yourself on the spectral decomposition visualizer.

Symmetry is doing all the work here; without it the eigenvector matrix need not be orthogonal and the transpose shortcut disappears.

Properties of the Factors

The orthogonality of QQ makes every operation on the spectral decomposition cheap and clean.

The inverse is immediate: A−1=QD−1QT=Q diag(1/λ1,…,1/λn) QTA^{-1} = QD^{-1}Q^T = Q\,\text{diag}(1/\lambda_1, \dots, 1/\lambda_n)\,Q^T, valid when all eigenvalues are nonzero.

Powers are diagonal: Ak=QDkQT=Q diag(λ1k,…,λnk) QTA^k = QD^kQ^T = Q\,\text{diag}(\lambda_1^k, \dots, \lambda_n^k)\,Q^T.

The matrix exponential is: eAt=QeDtQT=Q diag(eλ1t,…,eλnt) QTe^{At} = Qe^{Dt}Q^T = Q\,\text{diag}(e^{\lambda_1 t}, \dots, e^{\lambda_n t})\,Q^T.

The trace is tr(A)=λ1+⋯+λn\text{tr}(A) = \lambda_1 + \cdots + \lambda_n. The determinant is det⁡(A)=λ1⋯λn\det(A) = \lambda_1 \cdots \lambda_n. The rank is the number of nonzero eigenvalues.

Pitfall: Powering the entries of A
Squaring each entry of A=(3113)A = \begin{pmatrix} 3 & 1 \\ 1 & 3 \end{pmatrix} gives (9119)\begin{pmatrix} 9 & 1 \\ 1 & 9 \end{pmatrix}, which is not A2A^2. Only DD is powered entry by entry: A2=Q diag(16,4) QT=(106610)A^2 = Q\,\text{diag}(16, 4)\,Q^T = \begin{pmatrix} 10 & 6 \\ 6 & 10 \end{pmatrix}.

Every property of AA reduces to a property of the diagonal DD, mediated by the orthogonal matrix QQ. This is the computational power of diagonalization — and for symmetric matrices, the orthogonality of QQ ensures numerical stability as well.
Qᵀ2×20.70710.70710.7071−0.7071·Q2×20.70710.70710.7071−0.7071=I2×21001
QᵀQ = I

The normalized eigenvectors of a symmetric matrix, placed as the columns of Q, and QT multiplied by Q. Every off-diagonal entry is the dot product of two different eigenvectors and comes out 0; every diagonal entry is a squared length and comes out 1. So QT = Q−1: inverting Q costs nothing but a transpose. Step through the check on the spectral decomposition visualizer.

Because Q⁻¹ is just Qᵀ, the decomposition A = QDQᵀ needs no matrix inversion at all.

Quadratic Forms

A quadratic form f(x)=xTAxf(\mathbf{x}) = \mathbf{x}^TA\mathbf{x} with AA symmetric can be diagonalized by the change of variables x=Qy\mathbf{x} = Q\mathbf{y}:

Quadratic Form Diagonalization
xTAx=yTDy=∑i=1nλiyi2,x=Qy\mathbf{x}^T A \mathbf{x} = \mathbf{y}^T D \mathbf{y} = \sum_{i=1}^{n} \lambda_i y_i^2, \qquad \mathbf{x} = Q\mathbf{y}

Fact: Every solid has three wobble-free axes
The inertia matrix of any rigid body, even a potato, is symmetric, so it has three perpendicular eigenvectors: the principal axes of the body. Spun freely about one of them, the body turns without wobbling.

In the eigenvector coordinate system, the quadratic form decouples into a sum of independent squared terms. The eigenvectors define the principal axes of the quadratic surface (ellipsoid, hyperboloid, etc.), and the eigenvalues determine the curvature along each axis.

Positive definite (f>0f > 0 for x≠0\mathbf{x} \neq \mathbf{0}) means all λi>0\lambda_i > 0 — the surface is an ellipsoid. Positive semi-definite (f≥0f \geq 0) means all λi≥0\lambda_i \geq 0. Indefinite (eigenvalues of both signs) means the surface is a hyperboloid — ff takes both positive and negative values.

RULE
Classification of quadratic forms reduces entirely to checking the signs of the eigenvalues.

The full taxonomy — including the negative-definite and negative-semi-definite cases — collects into the table below.
Decompositions · quadratic forms

Definiteness, read from the signs

The quadratic form xTAx\mathbf{x}^{\mathsf{T}}A\mathbf{x} is classified entirely by the signs of the eigenvalues — not their sizes. Five classes, and the surface each one describes follows immediately.

5classes
TypeConditioneigenvalue signssign of the formlevel surface
One sign throughout
Positive definite§ 6all λi>0\lambda_i > 0all strictly positive>0> 0 for every x≠0\mathbf{x} \neq \mathbf{0}ellipsoid
Negative definite§ 6all λi<0\lambda_i < 0all strictly negative<0< 0 for every x≠0\mathbf{x} \neq \mathbf{0}inverted ellipsoid
One sign, with zeros
Positive semi-definite§ 6all λi≥0\lambda_i \geq 0, at least one =0= 0non-negative, some zero≥0\geq 0; vanishes on the null spacedegenerate ellipsoid — a cylinder
Negative semi-definite§ 6all λi≤0\lambda_i \leq 0, at least one =0= 0non-positive, some zero≤0\leq 0; vanishes on the null spaceinverted cylinder
Both signs present
Indefinite§ 6some λi>0\lambda_i > 0 and some <0< 0mixedtakes both signssaddle — hyperboloid
In the eigenbasis the form becomes ∑λiyi2\sum \lambda_i y_i^2, and the sign question answers itself: a sum of squares with all-positive weights is positive, with mixed weights it takes both signs. Everything below is that substitution read off. In practice Cholesky tests definiteness faster than computing the eigenvalues does.
Definiteness, read from the signs·/linear-algebra/decompositions/spectralLearn Math Class
Pitfall: Judging definiteness by the entries
Every entry of A=(1221)A = \begin{pmatrix} 1 & 2 \\ 2 & 1 \end{pmatrix} is positive, yet its eigenvalues are 33 and −1-1, and x=(1,−1)T\mathbf{x} = (1, -1)^T gives xTAx=−2\mathbf{x}^TA\mathbf{x} = -2. The form is indefinite, not positive definite.

The classification is immediate once the decomposition is in hand. Substituting x=Qy\mathbf{x} = Q\mathbf{y} turns the form into ∑λiyi2\sum \lambda_i y_i^2 — a weighted sum of squares — and the sign of a sum of squares is decided by the signs of the weights and nothing else. The magnitudes only stretch the surface; they never change which of the five classes it belongs to.

Principal Component Analysis

The spectral decomposition of a covariance matrix is the mathematical core of principal component analysis (PCA).

The covariance matrix Σ\Sigma of a dataset is symmetric positive semi-definite. Its spectral decomposition Σ=QDQT\Sigma = QDQ^T identifies the eigenvectors qi\mathbf{q}_i as the principal component directions — the orthogonal axes along which the data varies most — and the eigenvalues λi\lambda_i as the variance captured by each direction.

The first principal component q1\mathbf{q}_1 (corresponding to the largest eigenvalue λ1\lambda_1) is the direction of maximum variance. The second q2\mathbf{q}_2 is the direction of maximum variance orthogonal to q1\mathbf{q}_1, and so on.

Dimensionality reduction follows: projecting the data onto the top kk eigenvectors (those with the kk largest eigenvalues) captures as much variance as possible in kk dimensions. The discarded directions have small eigenvalues and contribute little information. This is PCA — the spectral decomposition applied to the covariance matrix.

Spectral Decomposition vs. General Eigendecomposition

The general eigendecomposition writes a diagonalizable matrix as A=PDP−1A = PDP^{-1} with PP invertible but not necessarily orthogonal. The spectral decomposition writes a symmetric matrix as A=QDQTA = QDQ^T with QQ orthogonal.

The orthogonality of QQ provides three advantages. Inversion is free: Q−1=QTQ^{-1} = Q^T, no computation needed. Multiplication preserves norms: ∥Qx∥=∥x∥\|Q\mathbf{x}\| = \|\mathbf{x}\|, so numerical errors are not amplified. Projections are orthogonal: the rank-one terms qiqiT\mathbf{q}_i\mathbf{q}_i^T are orthogonal projection matrices, making the outer product form geometrically transparent.

The spectral decomposition exists only for symmetric matrices (real case) or normal matrices, those with AA∗=A∗AAA^{*} = A^{*}A (complex case, with UU unitary); among these, DD is real exactly for Hermitian AA. For non-symmetric matrices, the eigendecomposition PDP−1PDP^{-1} may exist (when the matrix is diagonalizable) but PP is not orthogonal, and the computational and geometric advantages are lost.
DownloadPNG2×PDF
Before you read
Special cases of eigendecomposition
Every diagonalizable matrix has A=PDP−1A = PDP^{-1}. Narrower classes get a better PP: unitary for normal matrices, orthogonal for real symmetric ones.

Aᵀ = A⊂AA* = A*A⊂PDP⁻¹⊂n × n

n × n
Square
an eigendecomposition may not exist
PDP⁻¹
PP invertible
AA* = A*A
Normal
adds the complex case · UU unitary
Aᵀ = A
A=QDQTA = QDQ^T, QQ orthogonal
Takeaway
What symmetry buys
With A=QDQTA = QDQ^T, inversion is free, norms are preserved and the pieces are orthogonal projections. DD is real exactly when the matrix is Hermitian.
Special cases of eigendecomposition·/linear-algebra/decompositions/spectralLearn Math Class

Spectral Decomposition and SVD

COROLLARY
For a symmetric positive semi-definite matrix AA (all eigenvalues ≥0\geq 0), the spectral decomposition and the singular value decomposition coincide.

The singular values are the eigenvalues, and U=V=QU = V = Q: A=QDQT=QΣQTA = QDQ^T = Q\Sigma Q^T.

For a general symmetric matrix with negative eigenvalues, the relationship requires a sign adjustment. The singular values are the absolute values ∣λi∣|\lambda_i|, and the signs are absorbed into UU or VV. If λi<0\lambda_i < 0, the corresponding column of UU is negated relative to the corresponding column of VV.

The SVD generalizes the spectral decomposition to non-symmetric and non-square matrices. Every property that the spectral decomposition provides for symmetric matrices — rank, pseudoinverse, best low-rank approximation, condition number — the SVD provides for arbitrary matrices. The spectral decomposition is the special case where symmetry allows UU and VV to coincide.

Summary: What the Spectral Decomposition Gives You

Once A=QDQTA = QDQ^T is in hand, most matrix-level quantities of interest reduce to operations on the diagonal DD, with the orthogonal QQ rotating in and out of the eigenvector basis. The table below collects the six properties most commonly read off the decomposition — inverse, power, exponential, trace, determinant, and rank — alongside the formula in terms of QQ and DD, the parallel formula in terms of individual eigenvalues, and the conditions under which each formula applies.
Every entry below reads DD and leaves QQ alone. That is the structural fact worth carrying away: the orthogonal factor is fixed by the matrix, so anything asked of AA becomes the same question asked of its eigenvalues. The first group applies a function to them, the second reduces them to a single number.
Decompositions · spectral

What the decomposition gives you

Once A=QDQTA = QDQ^{\mathsf{T}} is in hand, every entry below is read off DD alone. The orthogonal factor never changes — which is the whole reason functions of the matrix become functions of its eigenvalues.

7readings
Functions of the matrix4
1
k≥0k \geq 0 integer; any kk if all λi>0\lambda_i > 0
Ak=QDkQTA^k = QD^kQ^{\mathsf{T}}
The middle factors collapse: QDQTQDQT=QD2QTQDQ^{\mathsf{T}}QDQ^{\mathsf{T}} = QD^2Q^{\mathsf{T}}, since QTQ=IQ^{\mathsf{T}}Q = I. Raising a diagonal matrix to a power means raising each entry, so A100A^{100} costs no more than A2A^2 — the reason diagonalization is worth the effort at all.
2
all λi≠0\lambda_i \neq 0
A−1=QD−1QTA^{-1} = QD^{-1}Q^{\mathsf{T}}
Inverting a diagonal matrix means reciprocating its entries, so the whole inversion costs nothing once the factorization exists. A zero eigenvalue is precisely what makes it fail — the same condition as everywhere else, read off the diagonal.
3
all λi≥0\lambda_i \geq 0 — positive semi-definite
A1/2=QD1/2QTA^{1/2} = QD^{1/2}Q^{\mathsf{T}}
A symmetric square root exists exactly when no eigenvalue is negative, and it is unique among positive semi-definite matrices. It is a different factor from the triangular one in Cholesky, though both satisfy A=BBTA = BB^{\mathsf{T}}, and it is the one behind whitening a covariance matrix.
4
always defined
eA=QeDQTe^{A} = Qe^{D}Q^{\mathsf{T}}
No condition at all, since exe^x is defined for every real xx. This is what solves the linear system of differential equations x′=Ax\mathbf{x}' = A\mathbf{x} — the solution is eAtx0e^{At}\mathbf{x}_0, and the decomposition makes it computable.
Scalars, straight off the diagonal3
5
always
tr⁡(A)=λ1+⋯+λn\operatorname{tr}(A) = \lambda_1 + \cdots + \lambda_n
The trace is similarity invariant, so tr⁡(A)=tr⁡(D)\operatorname{tr}(A) = \operatorname{tr}(D) and DD is diagonal — the sum is immediate.
6
det⁡(A)=λ1λ2⋯λn\det(A) = \lambda_1 \lambda_2 \cdots \lambda_n
Same argument with the multiplicative property: det⁡Q⋅det⁡D⋅det⁡QT=det⁡D\det Q \cdot \det D \cdot \det Q^{\mathsf{T}} = \det D, since det⁡Q=±1\det Q = \pm 1 and the two cancel.
7
always
count of λi≠0\lambda_i \neq 0
Multiplying by an invertible matrix preserves rank, so rank⁡(A)=rank⁡(D)\operatorname{rank}(A) = \operatorname{rank}(D), which is the number of nonzero diagonal entries. For a symmetric matrix, algebraic and geometric multiplicity always agree — so this count is unambiguous in a way it is not for a general matrix.
The pattern is one rule: f(A)=Qf(D)QTf(A) = Qf(D)Q^{\mathsf{T}}, and f(D)f(D) applies ff to each diagonal entry. Powers, inverses, roots and exponentials are all the same statement with a different ff, which is what makes a symmetric matrix genuinely easier to work with rather than merely nicer to look at.
What the decomposition gives you·/linear-algebra/decompositions/spectralLearn Math Class
The four function entries are one rule with four choices of ff: powers, reciprocals, roots and exponentials all reduce to f(A)=Qf(D)QTf(A) = Qf(D)Q^{\mathsf{T}}. What differs is only which eigenvalues ff accepts — every real number for the exponential, nonzero for the inverse, non-negative for the square root. Read the condition column downward and it is a list of what each function needs, not a list of separate theorems.
This works because AA is symmetric. A general matrix may fail to diagonalize at all, and even when it does the eigenvector matrix need not be orthogonal, so P−1P^{-1} must be computed rather than transposed. The spectral theorem is what guarantees both the orthogonality and the existence — which is why this page can state everything unconditionally where the general case cannot.

Common Pitfalls

Four mistakes account for many wrong answers when a symmetric matrix is decomposed, or used through its decomposition. Each is marked with a box where it happens in the sections above. Here each is worked through in full, with the wrong and the right working side by side.

Assuming eigenvectors are always orthogonal

Eigenvectors that belong to different eigenvalues of a symmetric matrix are orthogonal automatically, and this is taken to hold for all eigenvectors. When an eigenvalue repeats, the basis that row reduction gives for its eigenspace is put into QQ unchanged.

Wrong working: A=(211121112)A = \begin{pmatrix} 2 & 1 & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 2 \end{pmatrix} has eigenvalues 4,1,14, 1, 1. For λ=4\lambda = 4 the unit eigenvector is 13(1,1,1)T\frac{1}{\sqrt{3}}(1, 1, 1)^T. Row reducing A−IA - I leaves the single equation x1+x2+x3=0x_1 + x_2 + x_3 = 0, with basis (1,−1,0)T(1, -1, 0)^T and (1,0,−1)T(1, 0, -1)^T. Normalizing these two and using them as columns,
Q=(1/31/21/21/3−1/201/30−1/2)Q = \begin{pmatrix} 1/\sqrt{3} & 1/\sqrt{2} & 1/\sqrt{2} \\ 1/\sqrt{3} & -1/\sqrt{2} & 0 \\ 1/\sqrt{3} & 0 & -1/\sqrt{2} \end{pmatrix}

has columns 22 and 33 with dot product 12\frac{1}{2}, so QTQ≠IQ^TQ \neq I, and
QDQT=(7/35/65/65/611/64/35/64/311/6)≠AQDQ^T = \begin{pmatrix} 7/3 & 5/6 & 5/6 \\ 5/6 & 11/6 & 4/3 \\ 5/6 & 4/3 & 11/6 \end{pmatrix} \neq A


Right working: apply Gram-Schmidt inside the eigenspace.
(1,0,−1)T−12(1,−1,0)T=12(1,1,−2)T(1, 0, -1)^T - \frac{1}{2}(1, -1, 0)^T = \frac{1}{2}(1, 1, -2)^T

This is still an eigenvector for λ=1\lambda = 1, since A(1,1,−2)T=(1,1,−2)TA(1, 1, -2)^T = (1, 1, -2)^T. With q1=13(1,1,1)T\mathbf{q}_1 = \frac{1}{\sqrt{3}}(1, 1, 1)^T, q2=12(1,−1,0)T\mathbf{q}_2 = \frac{1}{\sqrt{2}}(1, -1, 0)^T, q3=16(1,1,−2)T\mathbf{q}_3 = \frac{1}{\sqrt{6}}(1, 1, -2)^T and D=diag(4,1,1)D = \text{diag}(4, 1, 1), the columns are orthonormal and QDQT=AQDQ^T = A.

Why it happens: the automatic orthogonality is stated for distinct eigenvalues. Inside one eigenspace every nonzero vector is an eigenvector, so any basis looks equally valid and nothing in the row reduction signals the problem.

How to check: before assembling QQ, compute the dot product of every pair of columns. Each must be 00.

Leaving the eigenvectors unnormalized

Row reduction returns each eigenvector at a convenient scale, and the vectors go into QQ at that scale. The transpose is then used as the inverse, which is valid only for unit columns.

Wrong working: for A=(3113)A = \begin{pmatrix} 3 & 1 \\ 1 & 3 \end{pmatrix} with D=diag(4,2)D = \text{diag}(4, 2), take Q=(111−1)Q = \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}. Then
QDQT=(424−2)(111−1)=(6226)=2AQDQ^T = \begin{pmatrix} 4 & 2 \\ 4 & -2 \end{pmatrix}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} = \begin{pmatrix} 6 & 2 \\ 2 & 6 \end{pmatrix} = 2A


Right working: divide each column by its length 2\sqrt{2}, so Q=12(111−1)Q = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}. Then QTQ=IQ^TQ = I and
QDQT=12(6226)=(3113)=AQDQ^T = \frac{1}{2}\begin{pmatrix} 6 & 2 \\ 2 & 6 \end{pmatrix} = \begin{pmatrix} 3 & 1 \\ 1 & 3 \end{pmatrix} = A


Why it happens: in the general form A=PDP−1A = PDP^{-1} any scaling of the eigenvectors works, because P−1P^{-1} undoes it. Replacing P−1P^{-1} by QTQ^T is what makes unit length necessary.

How to check: QTQQ^TQ must be II. Here the unscaled QQ gives QTQ=2IQ^TQ = 2I, and the result comes out multiplied by exactly that factor 22.

Powering the entries of A

A power or another function of AA is computed by applying it to each entry of AA, the way it is applied to each entry of DD.

Wrong working: for A=(3113)A = \begin{pmatrix} 3 & 1 \\ 1 & 3 \end{pmatrix},
A2→(9119),A−1→(1/3111/3)A^2 \to \begin{pmatrix} 9 & 1 \\ 1 & 9 \end{pmatrix}, \qquad A^{-1} \to \begin{pmatrix} 1/3 & 1 \\ 1 & 1/3 \end{pmatrix}


Right working: power the eigenvalues 44 and 22 and rebuild with the projections q1q1T=12(1111)\mathbf{q}_1\mathbf{q}_1^T = \frac{1}{2}\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} and q2q2T=12(1−1−11)\mathbf{q}_2\mathbf{q}_2^T = \frac{1}{2}\begin{pmatrix} 1 & -1 \\ -1 & 1 \end{pmatrix}.
A2=16 q1q1T+4 q2q2T=(8888)+(2−2−22)=(106610)A^2 = 16\,\mathbf{q}_1\mathbf{q}_1^T + 4\,\mathbf{q}_2\mathbf{q}_2^T = \begin{pmatrix} 8 & 8 \\ 8 & 8 \end{pmatrix} + \begin{pmatrix} 2 & -2 \\ -2 & 2 \end{pmatrix} = \begin{pmatrix} 10 & 6 \\ 6 & 10 \end{pmatrix}

A−1=14 q1q1T+12 q2q2T=(1/81/81/81/8)+(1/4−1/4−1/41/4)=(3/8−1/8−1/83/8)A^{-1} = \frac{1}{4}\,\mathbf{q}_1\mathbf{q}_1^T + \frac{1}{2}\,\mathbf{q}_2\mathbf{q}_2^T = \begin{pmatrix} 1/8 & 1/8 \\ 1/8 & 1/8 \end{pmatrix} + \begin{pmatrix} 1/4 & -1/4 \\ -1/4 & 1/4 \end{pmatrix} = \begin{pmatrix} 3/8 & -1/8 \\ -1/8 & 3/8 \end{pmatrix}


Why it happens: for the diagonal matrix DD, powers and other functions really do act entry by entry, and the rule is carried over to AA, whose off-diagonal entries mix the eigenvector directions.

How to check: the trace of AkA^k must equal λ1k+⋯+λnk\lambda_1^k + \cdots + \lambda_n^k. For A2A^2 that is 16+4=2016 + 4 = 20; the correct matrix has trace 10+10=2010 + 10 = 20, the entry-by-entry one only 1818. For A−1A^{-1}, multiply back: AA−1AA^{-1} must be II.

Judging definiteness by the entries

A symmetric matrix whose entries are all positive is called positive definite, as if positive numbers in the matrix made the form xTAx\mathbf{x}^TA\mathbf{x} positive.

Wrong working: every entry of A=(1221)A = \begin{pmatrix} 1 & 2 \\ 2 & 1 \end{pmatrix} is positive, so AA is declared positive definite.

Right working: det⁡(A−λI)=(1−λ)2−4=0\det(A - \lambda I) = (1 - \lambda)^2 - 4 = 0 gives λ=3\lambda = 3 and λ=−1\lambda = -1. The signs are mixed, so the form is indefinite. Directly, xTAx=x12+4x1x2+x22\mathbf{x}^TA\mathbf{x} = x_1^2 + 4x_1x_2 + x_2^2 is 66 at x=(1,1)T\mathbf{x} = (1, 1)^T and −2-2 at x=(1,−1)T\mathbf{x} = (1, -1)^T.

Why it happens: for a diagonal matrix the entries are the eigenvalues, so positive entries do mean positive definite. With off-diagonal entries present, the cross term 2a12x1x22a_{12}x_1x_2 changes sign with x1x2x_1x_2 and can outweigh the squares.

How to check: test a vector whose components have opposite signs, or, for a 2×22 \times 2 matrix, use the test a11>0a_{11} > 0 and det⁡A>0\det A > 0. Here det⁡A=1−4=−3<0\det A = 1 - 4 = -3 < 0.

Spectral Decomposition FAQ

Why is it written QDQTQDQ^{T} rather than QDQ−1QDQ^{-1}?

+
Because for an orthogonal QQ the two are the same matrix, and the transpose announces that no inversion is needed. Writing A=QDQ−1A = QDQ^{-1} is equally correct and essentially never seen, since it hides the saving. The letter QQ rather than PP is itself the signal that the change of basis is orthogonal.Read more →

Is the outer product sum an approximation?

+
Not with all its terms present, where the equality is exact. The instinct comes from truncated series, but nothing is being discarded here: each term λiqiqiT\lambda_i\mathbf{q}_i\mathbf{q}_i^{T} is a rank-one piece and together they reconstruct AA perfectly. Dropping terms is a separate decision, and that is precisely what turns the same line into low-rank approximation.Read more →

Are singular values the same as eigenvalues?

+
They coincide only for symmetric positive semi-definite matrices and for nothing else. Singular values are never negative, so where an eigenvalue is negative you get σi=∣λi∣\sigma_i = |\lambda_i| and the discarded sign is stored by negating the matching column elsewhere in the factorisation. The absolute value is doing bookkeeping, not measurement.Read more →