Singular value decomposition

core 12 mindecompositionssvdlow-rank

Builds on:Eigenvalues and eigenvectors

The idea

The SVD says every matrix — rectangular, singular, ugly, it does not matter — is secretly three simple operations chained together:

A=UΣV⊤A = U \Sigma V^\top

rotate (by V⊤V^\top), stretch along perpendicular axes (by the diagonal Σ\Sigma), rotate again (by UU). The columns of VV are an orthonormal basis of input directions, the columns of UU an orthonormal basis of output directions, and the singular values σ1≥σ2≥⋯≥0\sigma_1 \ge \sigma_2 \ge \dots \ge 0 are gain knobs pairing them up:

Avi=σiuiA v_i = \sigma_i u_i

Feed the matrix its ii-th input direction, get the ii-th output direction, amplified by σi\sigma_i. The singular values rank what the matrix actually does: direction 1 is its loudest behavior, and directions with tiny σi\sigma_i barely matter.

That reading makes the most useful identity in applied linear algebra almost obvious — the matrix as a sum of rank-1 layers:

A=∑i=1rσi uivi⊤A = \sum_{i=1}^{r} \sigma_i \, u_i v_i^\top

Keep the kk loudest layers and you get the truncated SVD AkA_k, and the Eckart-Young theorem says this greedy choice is optimal: no rank-kk matrix is closer to AA, and the squared Frobenius error is exactly the discarded energy ∑i>kσi2\sum_{i > k} \sigma_i^2. That single theorem is why SVD sits under PCA, LSA/topic models, image compression, and denoising.

Where does it come from? Multiply out A⊤A=VΣ2V⊤A^\top A = V \Sigma^2 V^\top: the right singular vectors are the eigenvectors of A⊤AA^\top A, and σi=λi(A⊤A)\sigma_i = \sqrt{\lambda_i(A^\top A)} (all λi≥0\lambda_i \ge 0 because A⊤AA^\top A is symmetric PSD). Likewise UU holds eigenvectors of AA⊤A A^\top. So the SVD is eigendecomposition applied to the two symmetric matrices any AA generates — which is exactly why it exists for every matrix while eigendecomposition of AA itself may not.

Worked example

Take

A=[3045].A = \begin{bmatrix} 3 & 0 \\ 4 & 5 \end{bmatrix}.

Step 1 — form A⊤AA^\top A:

A⊤A=[25202025].A^\top A = \begin{bmatrix} 25 & 20 \\ 20 & 25 \end{bmatrix}.

Step 2 — find its eigenvalues and singular values:

λ2−50λ+225=0,λ1=45,λ2=5,σ1=45=35≈6.71,σ2=5≈2.24.\begin{aligned} \lambda^2 - 50\lambda + 225 &= 0, \\ \lambda_1 &= 45, & \lambda_2 &= 5, \\ \sigma_1 &= \sqrt{45} = 3\sqrt{5} \approx 6.71, & \sigma_2 &= \sqrt{5} \approx 2.24. \end{aligned}

Two checks account for the determinant and all Frobenius energy:

σ1σ2=225=15=det⁡A,σ12+σ22=50=32+02+42+52.\begin{aligned} \sigma_1\sigma_2 &= \sqrt{225} = 15 = \det A, \\ \sigma_1^2 + \sigma_2^2 &= 50 = 3^2 + 0^2 + 4^2 + 5^2. \end{aligned}

Step 3 — right singular vectors (eigenvectors of A⊤AA^\top A):

v1=12(1,1),v2=12(1,−1).v_1 = \frac{1}{\sqrt{2}}(1,1), \qquad v_2 = \frac{1}{\sqrt{2}}(1,-1).

Step 4 — left singular vectors via ui=Avi/σiu_i = A v_i / \sigma_i:

u1=(3,9)/235=110(1,3),u2=(3,−1)/25=110(3,−1)u_1 = \frac{(3, 9)/\sqrt{2}}{3\sqrt{5}} = \frac{1}{\sqrt{10}}(1, 3), \qquad u_2 = \frac{(3, -1)/\sqrt{2}}{\sqrt{5}} = \frac{1}{\sqrt{10}}(3, -1)

Check: u1⋅u2=(3−3)/10=0u_1 \cdot u_2 = (3 - 3)/10 = 0 — orthonormal, as promised.

Step 5 — rank-1 truncation. Keeping only the top layer:

A1=σ1u1v1⊤=32[1133]=[1.51.54.54.5]A_1 = \sigma_1 u_1 v_1^\top = \frac{3}{2}\begin{bmatrix} 1 & 1 \\ 3 & 3 \end{bmatrix} = \begin{bmatrix} 1.5 & 1.5 \\ 4.5 & 4.5 \end{bmatrix}

which captures σ12/(σ12+σ22)=45/50=90%\sigma_1^2 / (\sigma_1^2 + \sigma_2^2) = 45/50 = 90\% of the squared Frobenius energy. The error matrix is

A−A1=[1.5−1.5−0.50.5]A - A_1 = \begin{bmatrix} 1.5 & -1.5 \\ -0.5 & 0.5 \end{bmatrix}

with squared Frobenius norm 2.25+2.25+0.25+0.25=5=σ222.25 + 2.25 + 0.25 + 0.25 = 5 = \sigma_2^2 — Eckart-Young verified on the spot: the residual is exactly the discarded layer σ2u2v2⊤\sigma_2 u_2 v_2^\top.

Cheat sheet

Structure

Numbers you can read off the spectrum

QuantityIn terms of singular values
Rankcount of σi>0\sigma_i > 0 (numerically: above tolerance)
Frobenius norm∑iσi2\sqrt{\sum_i \sigma_i^2}
Spectral normσ1\sigma_1 (largest amplification factor)
Condition numberκ=σmax⁡/σmin⁡\kappa = \sigma_{\max}/\sigma_{\min}
Best rank-k errormin⁡rank B≤k∥A−B∥F2=∑i>kσi2\min_{\mathrm{rank}\, B \le k} \lVert A - B \rVert_F^2 = \sum_{i > k} \sigma_i^2
Energy kept at rank k∑i≤kσi2/∑iσi2\sum_{i \le k} \sigma_i^2 / \sum_i \sigma_i^2

Decision rules

Gotchas