# spectral decomposition

*Entry of the [Dictionary of Applied Machine Learning](https://dictionaryofml.org) (course edition), by Alexander Jung, Aalto University. CC BY 4.0. Updated 2026-09-21. [HTML](https://dictionaryofml.org/terms/spectraldecomp.html) · [typeset PDF](https://dictionaryofml.org/terms/spectraldecomp.pdf) · [LaTeX](https://dictionaryofml.org/terms/spectraldecomp.tex) · [Python demo](https://dictionaryofml.org/terms/spectraldecomp.py) · [notebook](https://dictionaryofml.org/terms/spectraldecomp.ipynb)*

Math is LaTeX with the book's macros expanded, so no notation package is needed to read it.

## Abstract

A spectral decomposition writes a symmetric matrix as a sum of orthogonal projections onto perpendicular lines, each scaled by a real eigenvalue. It is an eigenvalue decomposition whose eigenvectors form an orthonormal basis, so the matrix is diagonal in a rotated coordinate system. A real matrix admits one exactly when it is symmetric, and over the complex numbers the corresponding class is the normal matrices. The decomposition follows from maximizing the quadratic form ${\mathbf x}^{\top} {\mathbf A} {\mathbf x}$ over the unit sphere: a maximizer exists because the sphere is compact, symmetry makes it an eigenvector, and symmetry again makes the vectors orthogonal to it an invariant subspace, so the argument repeats one size down. The positive semi-definite property enters only at the end, where it amounts to every eigenvalue being nonnegative. The decomposition yields the spectral norm, the rank and the square root of a matrix, and it underlies principal component analysis, kernel methods and the convergence analysis of gradient descent.

## Definition

Stretching the plane by a factor $3$ along one line, and leaving a perpendicular line untouched, turns a circle into an ellipse with its axes along those two lines. One matrix that acts this way is

$$
{\mathbf A} = \begin{pmatrix} 5/2 & \sqrt{3}/2 \\ \sqrt{3}/2 & 3/2
\end{pmatrix} \text{,}
$$

whose two lines sit at $30^{\circ}$ and $120^{\circ}$ (see Fig. 1). A spectral decomposition states that every symmetric matrix acts this way, scaling each of $d$ perpendicular directions by its own real factor.

A spectral decomposition is an eigenvalue decomposition whose eigenvectors are orthonormal. For a real symmetric matrix ${\mathbf A} \in
\mathbb{R}^{d \times d}$ it reads

\begin{equation}
\tag{1}
{\mathbf A} = \mathbf{U} {\boldsymbol \Lambda} \mathbf{U}^{\top} =
\sum_{j=1}^{d} \lambda_{j}
{\mathbf u}^{(j)} \big( {\mathbf u}^{(j)} \big)^{\top}
\text{,}
\end{equation}

with an orthogonal matrix $\mathbf{U} = \big( {\mathbf u}^{(1)},
\ldots, {\mathbf u}^{(d)} \big)$ of eigenvectors and real eigenvalues $\lambda_{1} \geq \cdots \geq
\lambda_{d}$ on the diagonal of ${\boldsymbol \Lambda}$. The converse holds as well, since $\mathbf{U} {\boldsymbol \Lambda} \mathbf{U}^{\top}$ equals its own transpose: a real matrix with an orthonormal basis of eigenvectors is symmetric. That equivalence is known as the spectral theorem (Axler, 2024, 7.29). Over the complex numbers the same statement holds for a normal matrix, with the conjugate transpose in place of the transpose and a unitary matrix in place of an orthogonal matrix, and the eigenvalues are real exactly when ${\mathbf A}$ is Hermitian.

![Figure 1 of the entry spectraldecomp](https://dictionaryofml.org/terms/fig/spectraldecomp-fig1.svg)

*Figure 1: The matrix ${\mathbf A}$ of the display above maps the dashed unit circle onto the solid ellipse. The dotted lines carry the two eigenvectors ${\mathbf u}^{(1)}$ and ${\mathbf u}^{(2)}$, at $30^{\circ}$ and $120^{\circ}$, and the ellipse has its axes along them with half-lengths $\lambda_{1} = 3$ and $\lambda_{2} = 1$. Neither direction is turned into another: ${\mathbf A}$ stretches along ${\mathbf u}^{(1)}$ and leaves ${\mathbf u}^{(2)}$ where it is*

One derivation of the symmetric case rests on a single analytic fact and produces the eigenvectors instead of assuming that they exist. It starts from the quadratic form ${\mathbf x}^{\top} {\mathbf A} {\mathbf x}$ restricted to the unit sphere $\mathbb{S}^{(d-1)} = \big\{ {\mathbf x} \in \mathbb{R}^{d} :
\Vert {{\mathbf x}} \Vert = 1 \big\}$, where it coincides with the Rayleigh quotient ${\mathbf x}^{\top} {\mathbf A} {\mathbf x} / {\mathbf x}^{\top} {\mathbf x}$ (Meyer, 2000, Sect. 7.5, Eq. (7.5.4)). The sphere is closed and bounded, hence compact, and the quadratic form is continuous, so it attains a maximum on the sphere at some ${\mathbf u}^{(1)}$ (Rudin, 1976, Thm. 4.16). Write $\lambda_{1}$ for that maximum. This is the whole analytic input, and the remaining steps are algebra.

The maximizer is an eigenvector. Take a vector ${\mathbf v}$ of unit norm orthogonal to ${\mathbf u}^{(1)}$, so that the curve ${\mathbf x}(t) = \big( {\mathbf u}^{(1)} + t {\mathbf v} \big) / \sqrt{1+t^{2}}$ stays on the sphere, and abbreviate $c = \big( {\mathbf u}^{(1)} \big)^{\top} {\mathbf A}
{\mathbf v}$ and $e = {\mathbf v}^{\top} {\mathbf A} {\mathbf v}$. Along that curve the quadratic form is $f(t) = \big( \lambda_{1} + 2tc + t^{2} e
\big) / \big( 1 + t^{2} \big)$, a differentiable function with a maximum at $t = 0$, so $f'(0) = 2c = 0$. Symmetry enters here: $c = \big( {\mathbf A} {\mathbf u}^{(1)} \big)^{\top} {\mathbf v}$, so the vector ${\mathbf A} {\mathbf u}^{(1)}$ is orthogonal to every vector orthogonal to ${\mathbf u}^{(1)}$, and is therefore a multiple of ${\mathbf u}^{(1)}$. Multiplying ${\mathbf A} {\mathbf u}^{(1)} = \lambda {\mathbf u}^{(1)}$ by $\big( {\mathbf u}^{(1)} \big)^{\top}$ identifies $\lambda = \lambda_{1}$.

The argument then repeats on a smaller matrix. The subspace $\mathcal{W}$ of vectors orthogonal to ${\mathbf u}^{(1)}$ is invariant under ${\mathbf A}$, because $\big( {\mathbf u}^{(1)}
\big)^{\top} {\mathbf A} {\mathbf w} = \big( {\mathbf A} {\mathbf u}^{(1)} \big)^{\top} {\mathbf w} =
\lambda_{1} \big( {\mathbf u}^{(1)} \big)^{\top} {\mathbf w} = 0$ for every ${\mathbf w}
\in \mathcal{W}$. Symmetry is used a second time, and this is where a general matrix fails: for ${\mathbf N} = \big(
\begin{smallmatrix} 0 & 1 \\ 0 & 0 \end{smallmatrix} \big)$ the eigenvector $(1,0)^{\top}$ spans an invariant line, yet ${\mathbf N} (0,1)^{\top} = (1,0)^{\top}$ leaves the orthogonal complement, which is why a general matrix need not be diagonalizable at all. Collecting an orthonormal basis of $\mathcal{W}$ into a matrix $\mathbf{Q} \in
\mathbb{R}^{d \times (d-1)}$ and setting ${\mathbf M} =
\mathbf{Q}^{\top} {\mathbf A} \mathbf{Q}$ gives a symmetric matrix one size smaller, so induction supplies an orthonormal basis of its eigenvectors, and $\mathbf{Q}$ lifts them back to eigenvectors of ${\mathbf A}$ orthogonal to ${\mathbf u}^{(1)}$. Each later maximum is taken over a smaller set, so the eigenvalues arrive in decreasing order.

Nonnegativity of the eigenvalues is a separate matter, and it is where the positive semi-definite property enters. Symmetry is an assumption rather than a consequence of ${\mathbf x}^{\top} {\mathbf A} {\mathbf x} \geq
0$: a skew-symmetric matrix $\mathbf{S}$ with $\mathbf{S}^{\top} = -\mathbf{S}$ satisfies ${\mathbf x}^{\top} \mathbf{S} {\mathbf x} = 0$ for every ${\mathbf x}$, so the quadratic form cannot see any skew part. For a symmetric matrix, expanding a vector in the eigenvector basis gives ${\mathbf x}^{\top} {\mathbf A} {\mathbf x} =
\sum_{j=1}^{d} \lambda_{j} \big(
\big( {\mathbf u}^{(j)} \big)^{\top} {\mathbf x} \big)^{2}$, which is nonnegative for every ${\mathbf x}$ exactly when every eigenvalue is. Each ${\mathbf u}^{(j)} \big( {\mathbf u}^{(j)}
\big)^{\top}$ in Eq. (1) is the orthogonal projection onto a line, and these projections annihilate each other and sum to the identity, so a symmetric matrix resolves a vector along $d$ perpendicular axes, scales each component, and adds the pieces back. The eigenvalues are determined by ${\mathbf A}$, while individual eigenvectors are not when an eigenvalue repeats: any orthonormal basis of the corresponding subspace serves, and what is determined is the orthogonal projection onto that subspace.

Several quantities are immediate from Eq. (1). The spectral norm is $\lambda_{1}$, by the same maximization the derivation started from, while ${\rm tr} \left({\mathbf A}\right)$ and $\det {\mathbf A}$ are the sum and the product of the eigenvalues. The rank of ${\mathbf A}$ counts the nonzero eigenvalues, and the eigenvectors belonging to the zero ones span the nullspace. A positive semi-definite matrix has the square root ${\mathbf A}^{1/2} = \sum_{j=1}^{d}
\sqrt{\lambda_{j}} {\mathbf u}^{(j)} \big(
{\mathbf u}^{(j)} \big)^{\top}$, which is the one positive semi-definite matrix squaring to ${\mathbf A}$, so ${\mathbf A} = {\mathbf B}^{\top} {\mathbf B}$ for ${\mathbf B} = {\mathbf A}^{1/2}$ (Axler, 2024, 7.39). Running the maximization over subspaces rather than one deflation at a time characterizes every eigenvalue the same variational way (Meyer, 2000, Sect. 7.5, Eq. (7.5.5)).

Machine learning meets symmetric matrices wherever a quadratic form appears. The sample covariance matrix of a dataset is symmetric and positive semi-definite, and principal component analysis keeps the eigenvectors of its largest eigenvalues, so the variational step above is what makes the first principal direction the direction of largest variance. A kernel matrix is positive semi-definite by construction, and its square root exhibits it as a Gram matrix of feature vectors, which is what lets a kernel method work without those feature vectors. The training objective of linear regression has the constant Hessian $(2/m) {\mathbf X}^{\top} {\mathbf X}$, whose eigenvalues decide how fast gradient descent converges, and the Laplacian matrix of an undirected graph is symmetric and positive semi-definite, which is what spectral clustering decomposes.

Two remarks on scope. Replacing the transpose by the conjugate transpose carries the derivation verbatim to a Hermitian matrix, for which the quadratic form ${\mathbf x}^{H} {\mathbf A} {\mathbf x}$ is real. In infinite dimensions the argument breaks at exactly one point, the existence of the maximizer, because the unit sphere of an infinite-dimensional Hilbert space is not compact; assuming instead that the operator is compact and self-adjoint restores that step and the rest of the derivation runs unchanged (Young, 1988).

**See also:** [eigenvalue decomposition](https://dictionaryofml.org/terms/evd.html), normal matrix, symmetric matrix, [eigenvector](https://dictionaryofml.org/terms/eigenvector.html), [eigenvalue](https://dictionaryofml.org/terms/eigenvalue.html), positive semi-definite, orthonormal, orthogonal, orthogonal projection, [spectrum](https://dictionaryofml.org/terms/spectrum.html), spectral norm, [principal component analysis](https://dictionaryofml.org/terms/pca.html), [sample covariance matrix](https://dictionaryofml.org/terms/samplecovmtx.html), [spectral clustering](https://dictionaryofml.org/terms/specclustering.html).

## References

- Axler (2024). Linear Algebra Done Right. *Springer*. <https://doi.org/10.1007/978-3-031-41026-0>
- Meyer (2000). Matrix Analysis and Applied Linear Algebra. *SIAM*.
- Rudin (1976). Principles of Mathematical Analysis. *McGraw-Hill*.
- Young (1988). An Introduction to Hilbert Space. *An introduction to Hilbert space*.

## Cite this entry

```bibtex
@misc{dictml_spectraldecomp,
  author = {Jung, Alexander},
  editor = {Olioumtsevits, Konstantina and Schnoor, Ekkehard},
  title = {spectral decomposition},
  howpublished = {Dictionary of Applied Machine Learning (course edition)},
  year = {2026},
  doi = {10.5281/zenodo.21569296},
  note = {ISBN 978-952-64-3013-3, CC BY 4.0, retrieved 2026-11-26},
  url = {https://dictionaryofml.org/terms/spectraldecomp.html}
}
```
