Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Spectral Decomposition


Orthonormal eigenvectors into Q, eigenvalues into Λ, and A = Q Λ Qᵀ — a sum of weighted projections.

Preset?A symmetric matrix has real eigenvalues and eigenvectors that can be chosen perpendicular to one another. Normalize them to unit length and put them in Q; then Q⁻¹ = Qᵀ and A = Q Λ Qᵀ with the eigenvalues in Λ. Equivalently A is a sum of rank-one pieces λᵢ qᵢqᵢᵀ, one per eigenvector — a projection onto each eigen-direction, weighted by its eigenvalue. The signs of the eigenvalues classify the quadratic form xᵀAx.
Size (symmetric)
A2× 2
Entries of A
A2×2
2
1
1
2
Step 1 / 9

Step explanations

1Spectral decomposition of a 2×2 symmetric matrix
For a symmetric matrix the eigenvalues are real and the eigenvectors can be chosen orthonormal. The plan: find the eigenvalues, one unit eigenvector for each (orthogonalizing inside any repeated eigenspace), collect them in Q, and write A = Q Λ Qᵀ — no inverse needed, since Q⁻¹ = Qᵀ. Then split A into rank-one pieces, one per eigenvector.
Real eigenvalues, perpendicular eigenvectors, and a transpose instead of an inverse. Learn more about Q · the theorem








Key Terms

Spectral theorem — every real symmetric matrix has real eigenvalues and an orthonormal basis of eigenvectors.

Spectral decompositionA=QΛQTA = Q\Lambda Q^T with QQ orthogonal and Λ\Lambda diagonal; the diagonalization of a symmetric matrix by an orthogonal change of basis.

Orthogonal matrixQTQ=IQ^TQ = I, so Q1=QTQ^{-1} = Q^T; its columns are orthonormal.

Orthonormal eigenvectors — unit-length eigenvectors, mutually perpendicular; eigenvectors for different eigenvalues of a symmetric matrix are perpendicular automatically.

Rank-one formA=λiqiqiTA = \sum \lambda_i\mathbf{q}_i\mathbf{q}_i^T; each qiqiT\mathbf{q}_i\mathbf{q}_i^T projects onto an eigen-direction.

Gram–Schmidt inside an eigenspace — the step needed when an eigenvalue is repeated, to make the basis of its eigenspace orthogonal.

Quadratic formxTAx\mathbf{x}^TA\mathbf{x}, which becomes λiyi2\sum \lambda_i y_i^2 in the eigen-coordinates y=QTx\mathbf{y} = Q^T\mathbf{x}.

Definiteness — positive definite when all eigenvalues are positive, semidefinite when none is negative, indefinite when the signs mix.

Getting Started with the Visualizer

Choose a symmetric matrix and watch it split into an orthogonal QQ and a diagonal Λ\Lambda.

• Use the Preset pills for seven matrices: a classic 2×22 \times 2, an indefinite one, a projection, a 3×33 \times 3 with distinct eigenvalues, a repeated eigenvalue needing Gram–Schmidt, a positive semidefinite matrix, and a non-symmetric shear that stops the run
• Use the Size stepper for 2×22 \times 2 or 3×33 \times 3, and Shuffle for a random symmetric matrix
• Edit any entry; with mirror edits on, the entry across the diagonal follows, so the matrix stays symmetric
• Hover the ? icon for a reminder of the theorem and what the pieces mean
• Press play or step manually; the step log on the right keeps every stage

The eigenvalues are reported rather than derived, since the eigenvalue visualizer shows that derivation. This tool concentrates on what symmetry adds: perpendicular eigenvectors, a transpose in place of an inverse, and the rank-one expansion.

The Scenes in Order

The visualizer follows the textbook procedure exactly.

Symmetry check — if AATA \neq A^T the run stops, with the offending entries marked
Eigenvalues — the roots of det(AλI)\det(A - \lambda I), all real
Eigenvectors — for each eigenvalue, AλIA - \lambda I row reduced and one vector per free column, scaled to integers
Gram–Schmidt — only for a repeated eigenvalue: the second basis vector of its eigenspace is replaced by its component perpendicular to the first
Normalize — each eigenvector divided by its length; the unit vectors become the columns of QQ, the eigenvalues the diagonal of Λ\Lambda
CheckQTQ=IQ^TQ = I
FactorA=QΛQTA = Q \cdot \Lambda \cdot Q^T multiplied out and compared with AA
Rank-one sumA=λ1q1q1T+λ2q2q2T+A = \lambda_1\mathbf{q}_1\mathbf{q}_1^T + \lambda_2\mathbf{q}_2\mathbf{q}_2^T + \cdots, with zero-eigenvalue terms dropped
Done — the definiteness verdict from the signs of the eigenvalues, and the quadratic form in eigen-coordinates

From Eigenvectors to Q

The frozen picture below shows the default preset's integer eigenvectors (1,1)(1, 1) and (1,1)(1, -1) on the left, the unit columns of QQ in the middle, and Λ\Lambda on the right. Each column of QQ is an eigenvector divided by its length 2\sqrt{2}.

The columns are already perpendicular; normalization is all that separates a diagonalizing PP from an orthogonal QQ.
eigenvectors2×2111−1Q2×20.70710.70710.7071−0.7071Λ2×23001
Eigenvectors to Q, frozen

The default preset: (1, 1) and (1, −1) divided by √2 become the unit columns of Q, with Λ = diag(3, 1) in the same order. The columns were perpendicular already.

Normalization matters because the transpose trick depends on it. PTPP^TP for the integer vectors is diag(2,2)\operatorname{diag}(2, 2), not II, so PTP^T is not P1P^{-1}; after dividing each column by 2\sqrt{2} the product becomes II exactly. The eigenvectors are only determined up to scale, and the unit scale is the one that makes QQ orthogonal.

For a 2×22 \times 2 matrix QQ is a rotation or a reflection of the plane. Here it is the 45°45° rotation followed by a reflection, since detQ=1\det Q = -1; swapping the columns, together with the entries of Λ\Lambda, would give a pure rotation.

Q Transpose Q Equals I

The frozen picture below shows QTQ=IQ^TQ = I for the default preset. The diagonal entries are qiqi=1\mathbf{q}_i\cdot\mathbf{q}_i = 1 and the off-diagonal ones q1q2=0\mathbf{q}_1\cdot\mathbf{q}_2 = 0.

This single identity replaces the computation of an inverse in every symmetric problem.
Qᵀ2×20.70710.70710.7071−0.7071·Q2×20.70710.70710.7071−0.7071=I2×21001
QᵀQ = I, frozen

Ones on the diagonal (unit length), zeros off it (perpendicular). So Q⁻¹ = Qᵀ, and no inverse is ever computed.

An orthogonal matrix preserves dot products, QxQy=xyQ\mathbf{x}\cdot Q\mathbf{y} = \mathbf{x}\cdot\mathbf{y}, hence lengths and angles. Changing to eigen-coordinates by y=QTx\mathbf{y} = Q^T\mathbf{x} is therefore a rigid motion of the axes, which is why the geometry of the quadratic form, its ellipse or hyperbola, is undistorted by the change: the principal axes really are perpendicular in the original picture.

For a non-symmetric diagonalizable matrix the corresponding PP is not orthogonal, the eigen-coordinates are skewed, and the same change of basis stretches and shears the picture.

The Factorization

The frozen picture below shows A=QΛQTA = Q\Lambda Q^T for the default preset, with the columns of QQ and the rows of QTQ^T in matching colours.

Read from the right: QTQ^T rotates into the eigenvector axes, Λ\Lambda stretches by 33 along one and 11 along the other, and QQ rotates back.
A2×22112=Q2×20.70710.70710.7071−0.7071·Λ2×23001·Qᵀ2×20.70710.70710.7071−0.7071
A = Q Λ Qᵀ, frozen

Columns of Q and rows of Qᵀ in matching colours. Right to left: rotate into the eigen-axes, stretch by 3 and 1, rotate back. The product reproduces A.

This is the geometric content of the theorem. A symmetric matrix is a stretch along perpendicular axes, nothing more; the axes are the columns of QQ and the stretch factors the eigenvalues. The unit circle is mapped to an ellipse whose axes are the eigenvectors and whose semi-axes are the eigenvalues, when they are positive.

Contrast a general matrix, whose image of the unit circle is also an ellipse but whose axes are not eigenvectors. The singular value decomposition recovers a stretch-along-perpendicular-axes description for every matrix, at the cost of two different orthogonal matrices instead of one.

The Rank-One Expansion

The frozen picture below shows the default preset written as 3q1q1T+1q2q2T3\mathbf{q}_1\mathbf{q}_1^T + 1\mathbf{q}_2\mathbf{q}_2^T: the matrix of halves 12(1111)\frac{1}{2}\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} weighted by 33, plus 12(1111)\frac{1}{2}\begin{pmatrix} 1 & -1 \\ -1 & 1 \end{pmatrix} weighted by 11.

Each piece is the orthogonal projection onto an eigen-direction; the pieces add to II without the weights and to AA with them.
A2×22112=3·q₁q₁ᵀ2×23/23/23/23/2+1·q₂q₂ᵀ2×21/2−1/2−1/21/2
Rank-one expansion, frozen

A = 3·q₁q₁ᵀ + 1·q₂q₂ᵀ: the halves matrix weighted by 3 plus the alternating halves matrix weighted by 1. Each term projects onto an eigen-direction.

The expansion makes the action of AA transparent. To compute AxA\mathbf{x}, project x\mathbf{x} onto each eigenvector, scale each projection by its eigenvalue, and add. Since the projections of x\mathbf{x} onto an orthonormal basis reassemble x\mathbf{x}, the unweighted sum is the identity, and AA is II with the directions reweighted.

It is also the form used for approximation. Keeping only the terms with the largest eigenvalues gives the best low-rank approximation of a symmetric matrix, the principle behind principal component analysis; the projection preset, with one term, is already rank one.

Gram–Schmidt Inside a Repeated Eigenspace

The repeated preset has λ=1\lambda = 1 twice, and row reduction of AIA - I hands over (1,1,0)(1, -1, 0) and (1,0,1)(1, 0, -1), which are not perpendicular. The frozen picture below shows the Gram–Schmidt scene: the second vector loses its component along the first and becomes (1,1,2)(1, 1, -2).

Both are still eigenvectors for 11, since the eigenspace is a plane and any vector in it qualifies.
before3×211−100−1orthogonal3×211−110−2
Gram–Schmidt in the λ = 1 plane, frozen

The repeated preset: (1, −1, 0) and (1, 0, −1) are both eigenvectors for 1 but not perpendicular. Subtracting the projection of the second onto the first gives (1, 1, −2).

The theorem guarantees an orthonormal eigenvector basis exists, not that row reduction will produce one. Eigenvectors for different eigenvalues come out perpendicular by themselves, and here (1,1,1)(1, 1, 1) for λ=4\lambda = 4 is perpendicular to both of the others already. Inside a repeated eigenspace there is freedom, and Gram–Schmidt is how the freedom is spent.

The semidefinite preset shows the other possibility: its repeated eigenvalue 22 has eigenvectors (1,1,0)(1, 1, 0) and (0,0,1)(0, 0, 1), which happen to be perpendicular, and the Gram–Schmidt scene changes nothing.

A Single Rank-One Term

The projection preset 12(1111)\frac{1}{2}\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} has eigenvalues 11 and 00. The frozen picture below shows its rank-one scene: one term, 1q1q1T1\cdot\mathbf{q}_1\mathbf{q}_1^T with q1=(1,1)/2\mathbf{q}_1 = (1, 1)/\sqrt{2}, which is the matrix itself.

The zero eigenvalue contributes nothing, and the rank is one.
A2×21/21/21/21/2=1·q₁q₁ᵀ2×21/21/21/21/2
A single term, frozen

The projection preset has eigenvalues 1 and 0, so the rank-one sum has one term, q₁q₁ᵀ with q₁ = (1, 1)/√2 - which is A itself. Rank one.

A projection matrix is the simplest spectral decomposition: eigenvalue 11 on the subspace projected onto, 00 on its orthogonal complement, and A=qqTA = \mathbf{q}\mathbf{q}^T when the subspace is a line. Every orthogonal projection is symmetric with eigenvalues in {0,1}\{0, 1\}, and conversely; it is positive semidefinite, and its rank is the dimension of the target.

The number of non-zero eigenvalues is the rank in general, and the rank-one sum with the zero terms removed is the shortest way to write a singular symmetric matrix.

When the Matrix Is Not Symmetric

The last preset is the shear (1201)\begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix}. The frozen picture below shows the run stopping at the symmetry check, with the two entries that differ across the diagonal marked.

Without symmetry none of the guarantees hold: this matrix is in fact defective, with one eigenvector for its double eigenvalue.
A2×21201
Not symmetric, frozen

The shear stops at the symmetry check with the entries 2 and 0 marked. No orthogonal Q exists; this matrix is defective besides.

The theorem is an equivalence in one direction: QΛQTQ\Lambda Q^T is always symmetric, so a non-symmetric matrix cannot have such a form. It may still be diagonalizable with a non-orthogonal PP, in which case the diagonalization tool applies; it may be defective, like this shear; or it may have complex eigenvalues, like a rotation.

The mirror-edits option keeps the entry grid symmetric while you experiment. Turn it off to see how quickly an asymmetric change removes the structure, and turn it back on to restore it.

Reading the Scene Player

Each scene shows the matrices for one step with the arithmetic in the caption.

• The columns of QQ are colour-coded, one colour per eigenvector, and the rows of QTQ^T use the same colours, since they are the same vectors
• The diagonal of Λ\Lambda is blue and its zeros grey; in the final scene positive eigenvalues are accent, negative ones muted, zeros secondary
• Entries of QQ are shown as decimals because they involve square roots; the captions give the exact form, such as (1,1)/2(1, 1)/\sqrt{2}
• The rank-one terms are computed from the integer eigenvectors as λvvT/(vv)\lambda\mathbf{v}\mathbf{v}^T / (\mathbf{v}\cdot\mathbf{v}), so they appear as fractions
• In the Gram–Schmidt scene the left matrix holds the raw basis of the eigenspace and the right one the orthogonalized basis

Choosing a Matrix

The seven presets each make a different point.

2×22 \times 2 classic — eigenvalues 33 and 11 with eigenvectors (1,1)(1, 1) and (1,1)(1, -1); QQ is a 45°45° rotation
Indefinite — eigenvalues 22 and 3-3; the quadratic form is a saddle
Projection — eigenvalues 11 and 00; the rank-one sum has a single term and A=qqTA = \mathbf{q}\mathbf{q}^T is the projection onto the line of (1,1)(1, 1)
3×33 \times 3 distinct — eigenvalues 1111, 22, 11; the same matrix as the eigenvalue tool's default, with eigenvectors (0,1,2)(0, 1, 2), (1,0,0)(1, 0, 0), (0,2,1)(0, 2, -1), perpendicular as promised
Repeatedλ=4\lambda = 4 once and λ=1\lambda = 1 twice; the plane of eigenvectors for 11 needs Gram–Schmidt
Semidefinite — eigenvalues 22, 22, 00; positive semidefinite and singular, rank 22
Not symmetric — the shear; the run stops at the first scene

Shuffle produces small-integer symmetric matrices; their eigenvalues are usually irrational and the tool shows them to four decimals.

What the Spectral Theorem Says

A real symmetric matrix AA satisfies AT=AA^T = A. The spectral theorem says two things about it: every eigenvalue is real, and there is an orthonormal basis of eigenvectors. Put those eigenvectors in the columns of QQ and the eigenvalues down the diagonal of Λ\Lambda; then AQ=QΛAQ = Q\Lambda as for any diagonalization, and because QQ is orthogonal, Q1=QTQ^{-1} = Q^T:

A=QΛQTA = Q\Lambda Q^T


Why the eigenvectors are perpendicular is a two-line argument. If Au=λuA\mathbf{u} = \lambda\mathbf{u} and Av=μvA\mathbf{v} = \mu\mathbf{v}, then λuv=(Au)v=u(ATv)=u(Av)=μuv\lambda\,\mathbf{u}\cdot\mathbf{v} = (A\mathbf{u})\cdot\mathbf{v} = \mathbf{u}\cdot(A^T\mathbf{v}) = \mathbf{u}\cdot(A\mathbf{v}) = \mu\,\mathbf{u}\cdot\mathbf{v}, so (λμ)uv=0(\lambda - \mu)\,\mathbf{u}\cdot\mathbf{v} = 0, and for λμ\lambda \neq \mu the dot product must vanish. For a repeated eigenvalue the eigenspace has full dimension, and any orthonormal basis of it will do; Gram–Schmidt supplies one.

Expanding the product column by column gives the other form of the theorem,

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 qiqiT\mathbf{q}_i\mathbf{q}_i^T is the orthogonal projection onto the line of qi\mathbf{q}_i, so a symmetric matrix is a weighted sum of projections onto perpendicular directions: it stretches space along nn perpendicular axes, by λi\lambda_i along each. That is the whole geometry of symmetric matrices.

For the theory, see the spectral decomposition theory page and the eigenvalues overview.

Key Properties

Facts that follow from A=QΛQTA = Q\Lambda Q^T.

Real eigenvalues, always; complex eigenvalues cannot occur for a symmetric matrix
Always diagonalizable; a symmetric matrix is never defective, and its geometric multiplicities equal its algebraic ones
Orthogonal QQ: QTQ=QQT=IQ^TQ = QQ^T = I, so the change to eigen-coordinates preserves lengths and angles
Quadratic form: xTAx=λiyi2\mathbf{x}^TA\mathbf{x} = \sum \lambda_i y_i^2 with y=QTx\mathbf{y} = Q^T\mathbf{x}; the principal axes are the columns of QQ
Definiteness is read from the signs: all positive means positive definite, none negative means semidefinite, mixed means indefinite
Rank equals the number of non-zero eigenvalues
Powers and functions: Ak=QΛkQTA^k = Q\Lambda^kQ^T and f(A)=Qf(Λ)QTf(A) = Qf(\Lambda)Q^T; a positive definite matrix has a symmetric positive definite square root
Extremes: the largest eigenvalue is the maximum of xTAx\mathbf{x}^TA\mathbf{x} over unit vectors, attained at q1\mathbf{q}_1; the smallest is the minimum
Norm: A2=maxλi\|A\|_2 = \max|\lambda_i| for symmetric AA

Why It Matters

Symmetric matrices are the most common kind in applications, and the spectral theorem is why they are tractable.

Principal component analysis: the covariance matrix is symmetric; its eigenvectors are the principal axes and its eigenvalues the variances along them
Quadratic forms and conics: xTAx=1\mathbf{x}^TA\mathbf{x} = 1 is an ellipse, hyperbola or pair of lines according to the signs of the eigenvalues, with axes along the columns of QQ
Optimization: the Hessian at a critical point is symmetric, and its definiteness decides minimum, maximum or saddle
Mechanics: the inertia tensor, the stress tensor and the stiffness matrix are symmetric; their eigenvectors are principal axes, principal stresses, normal modes
Graphs: the adjacency and Laplacian matrices are symmetric, and spectral clustering uses their eigenvectors
Singular value decomposition: ATAA^TA is symmetric positive semidefinite, and its spectral decomposition is where the singular values come from
Numerical stability: orthogonal QQ means no error amplification in the change of basis

Worked Example

Take the default preset,

A=(2112)A = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}


Eigenvalues. λ24λ+3=(λ3)(λ1)\lambda^2 - 4\lambda + 3 = (\lambda - 3)(\lambda - 1), so λ=3,1\lambda = 3, 1.

Eigenvectors. For 33: A3I=(1111)A - 3I = \begin{pmatrix} -1 & 1 \\ 1 & -1 \end{pmatrix} gives v1=(1,1)\mathbf{v}_1 = (1, 1). For 11: AI=(1111)A - I = \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} gives v2=(1,1)\mathbf{v}_2 = (1, -1). Their dot product is 00.

Normalize. q1=(1,1)/2\mathbf{q}_1 = (1, 1)/\sqrt{2}, q2=(1,1)/2\mathbf{q}_2 = (1, -1)/\sqrt{2}, so

Q=12(1111),Λ=(3001)Q = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}, \qquad \Lambda = \begin{pmatrix} 3 & 0 \\ 0 & 1 \end{pmatrix}


Check. QTQ=12(2002)=IQ^TQ = \frac{1}{2}\begin{pmatrix} 2 & 0 \\ 0 & 2 \end{pmatrix} = I, and QΛQT=12(3131)(1111)=12(4224)=AQ\Lambda Q^T = \frac{1}{2}\begin{pmatrix} 3 & 1 \\ 3 & -1 \end{pmatrix}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} = \frac{1}{2}\begin{pmatrix} 4 & 2 \\ 2 & 4 \end{pmatrix} = A.

Rank-one sum. 3q1q1T=32(1111)3\mathbf{q}_1\mathbf{q}_1^T = \frac{3}{2}\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} and 1q2q2T=12(1111)1\mathbf{q}_2\mathbf{q}_2^T = \frac{1}{2}\begin{pmatrix} 1 & -1 \\ -1 & 1 \end{pmatrix}; their sum is (2112)\begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}.

Quadratic form. 2x12+2x1x2+2x22=3y12+y222x_1^2 + 2x_1x_2 + 2x_2^2 = 3y_1^2 + y_2^2 with y1=(x1+x2)/2y_1 = (x_1 + x_2)/\sqrt{2} and y2=(x1x2)/2y_2 = (x_1 - x_2)/\sqrt{2}. Both eigenvalues are positive: AA is positive definite, and xTAx=1\mathbf{x}^TA\mathbf{x} = 1 is an ellipse with axes along (1,1)(1, 1) and (1,1)(1, -1).

Common Mistakes

A few mistakes recur.

Forgetting to normalize — with integer eigenvectors in PP, P1PTP^{-1} \neq P^T and PΛPTAP\Lambda P^T \neq A; the transpose trick needs unit columns
Assuming perpendicularity inside a repeated eigenspace — the two vectors row reduction hands you for a repeated eigenvalue are usually not perpendicular; Gram–Schmidt is needed
Applying the theorem to a non-symmetric matrix — the eigenvectors of a non-symmetric matrix are not perpendicular in general, and its eigenvalues need not be real
Mismatching the order — column ii of QQ must carry the eigenvalue in position ii of Λ\Lambda
Reading definiteness from the entries — positive entries do not make a matrix positive definite; only the eigenvalues, or equivalently the leading principal minors, decide it
Dropping the factor λ\lambda in the rank-one sumA=λiqiqiTA = \sum \lambda_i\mathbf{q}_i\mathbf{q}_i^T; without the weights the sum is QQT=IQQ^T = I
Confusing QΛQTQ\Lambda Q^T with QTΛQQ^T\Lambda Q — both are symmetric, but only the first is AA; the second is AA in the rotated frame