The SVD: every matrix is a rotate, a stretch, a rotate
The singular value decomposition exposes any matrix as a rotation, a diagonal scaling, and another rotation — the foundation of compression.
Eigenvectors are wonderful, but they only exist cleanly for square matrices — and even then only when there are enough of them. Real data matrices are rectangular, and image, embedding and vocabulary matrices are wildly so. The singular value decomposition rescues the entire idea: every matrix, of any shape, is a rotation followed by a non-uniform stretch followed by another rotation.
The eigens story, generalized
The SVD finds the directions in the input space that get stretched the most, the corresponding directions in the output space, and the stretch factors between them. Those stretch factors are the singular values, and they are always non-negative and ordered by size.
The matrix below is the sum of three rank-1 pieces with weights 4, 2 and 1. Slide the rank and watch how much of the original survives.
Keep the top k singular directions — how much of the matrix survives?
Original (rank 3)
Best rank-1 approximation
- relative error
- 48.8%
- energy kept
- 76%
Each bar is a singular value. Dropping the small ones costs almost nothing in error but can cut the storage dramatically — here rank 1 already keeps most of the energy, and rank 3 reproduces the matrix exactly. This is image and embedding compression, and it is also why low-rank structure shows up wherever data is redundant.
The decomposition
For any there exist orthogonal matrices and , and a diagonal matrix with non-negative entries, such that
Written term by term, this is a sum of rank-1 layers:
where is the rank of . The are orthonormal left singular vectors (directions in the output space) and the are orthonormal right singular vectors (directions in the input space). Unlike eigenvectors, this sum always exists and the terms are always mutually orthogonal.
Low-rank approximation
The reason the SVD is everywhere is a theorem (Eckart–Young): truncating the sum at terms gives the best possible rank- approximation in the Frobenius norm,
The squared error of the truncation is exactly the sum of the discarded squared singular values:
So a quickly decaying spectrum means the matrix is compressible. If the first few singular values dominate, you can store numbers instead of and lose almost nothing. That is image compression, and it is also why LoRA can fine-tune a large model by adding a tiny low-rank update rather than changing every weight.
Relationships worth knowing
- With the eigendecomposition. The right singular vectors are eigenvectors of and the left are eigenvectors of ; the singular values are the square roots of the (non-negative) eigenvalues of either. When is symmetric and positive semidefinite, SVD and eigendecomposition coincide.
- With PCA. Center the data matrix, take its SVD, and the right singular vectors are the principal directions; the squared singular values divided by the sample size are the variances along them.
- Condition number. measures how unequally the map stretches directions. A large value means small input changes can become large output changes — the source of numerical instability in solving systems.
Singular values are not eigenvalues
Singular values are always real and non-negative. Eigenvalues can be negative or complex. For a square matrix they are related but generally different; only for symmetric positive semidefinite matrices do they agree. Do not substitute one for the other in a formula.
Illustrative vs real
The widget uses a rank-3 matrix so the truncation fits on screen. A image has up to 768 singular values, and a term "rank-1 layer" there is a whole outer-product image. The theorem is shape-independent; the picture is a convenient size, not the domain of the result.
Check yourself
Eduspheria wiki · Mathematics for AI, Linear algebra
0 / 5 answered
Where next: probability — from transformations of space to the mathematics of uncertainty.