Contents · Linear Algebra
Part 0 · Orientation
Part 1 · Vectors & Spaces
Part 2 · Matrices as Maps
Part 3 · Solving Systems
Part 4 · Orthogonality
Part 5 · Eigenvalues
Part 6 · Singular Value Decomposition
- The Singular Value Decomposition
Part 7 · Spectral & Positive Definite
Part 8 · Numerical Linear Algebra
Part 6 · Singular Value Decomposition
The Singular Value Decomposition
Eigenvalues demanded a square, cooperative matrix. The singular value decomposition demands nothing. Every matrix, any shape, real or rectangular, factors into a rotation, a set of axis-aligned stretches, and another rotation. It is the closest thing linear algebra has to a universal normal form.
The factorization
For any real there exist orthogonal matrices and and a diagonal so that
The are the singular values, the columns of the left singular vectors, and the columns of the right singular vectors. The defining relation is : each right singular vector is sent to a scaled left singular vector. Equivalently is a sum of rank-one pieces,
The are the orthonormal eigenvectors of , the those of , and their shared eigenvalues.1
The geometry: sphere to ellipsoid
Read right to left on a unit vector . First rotates into the singular basis. Then stretches coordinate by . Then rotates the result out. Writing ,
So the image of the unit sphere is an ellipsoid whose semi-axes are the vectors : the directions come from , the lengths are the singular values. The rank is exactly the number of nonzero , the number of axes the ellipsoid actually has.
- σ₁
- 2.29
- σ₂
- 0.87
- σ₁·σ₂
- 2.00
- |det A|
- 2.00
The circle stretches into an ellipse with semi-axes σ₁ and σ₂. Their product σ₁σ₂ equals |det A|, the area scale factor.
Rank, approximation, and the pseudoinverse
Truncating the sum after terms gives the best rank- approximation of ,
No rank- matrix comes closer in either the spectral or the Frobenius norm. This is the Eckart-Young theorem, and it is why the SVD underlies image compression, denoising, and latent-factor models.2
When is not invertible the SVD still supplies the right inverse. Inverting each nonzero stretch gives the pseudoinverse
and is the least-squares solution of of smallest norm.
PCA is the SVD of centered data
Center a data matrix by subtracting the column means, then take . The right singular vectors are the principal directions, the eigenvectors of the sample covariance , and the variance captured along is . Principal component analysis is not a separate algorithm: it is the SVD of the centered data, and the leading singular values say how much of the spread lives in how few directions.1
A 2×2 by hand
Take
The singular values are the square roots of the eigenvalues of . For a symmetric matrix the eigenvalues follow from the trace and determinant. Here and , so
Taking square roots,
Two checks. The product of the singular values is the area scale factor: , and indeed . The sum of their squares is the squared Frobenius norm: . Both hold, so the ellipse this draws has semi-axes near and , enclosing an area times that of the unit circle.