SVD and low-rank structure

evergreen#foundations#linear-algebra

Up: 10_Foundations-MOC

Bar: visualize what SVD does to a unit circle, and relate it to PCA, embeddings, and matrix factorization without notes.

Intuition first

Every matrix AA (any shape) factors into rotate → scale → rotate:

A=UΣVA = U\Sigma V^{\top}

A unit circle becomes an ellipse whose semi-axis lengths are the singular values σi\sigma_i. The number of nonzero σi\sigma_i is the rank. Small σi\sigma_i = directions that barely matter → throw them away.

Low-rank approximation (the whole point)

Keep the top kk singular triplets:

Ak=i=1kσiuiviA_k = \sum_{i=1}^{k}\sigma_i u_i v_i^{\top}
Eckart–Young: AkA_k is the best possible rank-kk approximation in Frobenius (and spectral) norm, and the error is exactly the dropped energy:
AAkF2=i>kσi2\|A-A_k\|_F^2 = \sum_{i>k}\sigma_i^2
That is compression, denoising, and "find the latent structure" all at once.

Worked example (by hand)

A=[1111]A=\begin{bmatrix}1&1\\1&1\end{bmatrix}

AA is symmetric, so SVD = eigen-decomposition. Eigenvalues: 22 (eigenvector 12(1,1)\tfrac1{\sqrt2}(1,1)) and 00 (eigenvector 12(1,1)\tfrac1{\sqrt2}(1,-1)). Hence

σ1=2, σ2=0,A=2(12,12)(12,12).\sigma_1=2,\ \sigma_2=0,\qquad A = 2\,(\tfrac1{\sqrt2},\tfrac1{\sqrt2})^{\top}(\tfrac1{\sqrt2},\tfrac1{\sqrt2}).
AA is rank 1: one direction (1,1)(1,1) explains everything; the orthogonal direction has zero stretch. The best rank-1 approximation of AA is AA itself, with error σ22=0\sigma_2^2 = 0.

How it connects to the rest of ML

By-hand exercise (meets the bar)

  1. Sketch what A=[3001]A=\begin{bmatrix}3&0\\0&1\end{bmatrix} does to the unit circle (ellipse with axes 3 and 1; U=V=IU=V=I, σ=(3,1)\sigma=(3,1)).
  2. For a rank-2 approximation of a matrix with σ=(5,4,2,1)\sigma=(5,4,2,1), what fraction of energy is kept? ($ \tfrac{25+16}{25+16+4+1}=\tfrac{41}{46}\approx 89%$.)