Volume I, Chapter 1 — Part IV. Complete derivation of the SVD from the spectral theorem, Eckart-Young optimal low-rank approximation, connection to PCA, pseudoinverse, and theoretical foundations of LoRA and matrix completion.
Eigendecomposition applies only to square matrices and requires diagonalizability. The Singular Value Decomposition (SVD) applies to every matrix A∈Rm×n and always exists with orthogonal factors. It reveals that any linear map is a rotation, axis-aligned scaling, and another rotation:
A=UΣVT.(0)
The singular values σ1≥σ2≥⋯≥0 measure the "strength" of each rank-1 component. Truncating small singular values yields the best low-rank approximation — the mathematical justification for PCA, compression, LoRA fine-tuning, and collaborative filtering.
Series context. This is Part IV of Chapter 1. It completes the linear algebra foundation before Positive Definite Matrices.
Interactive: Singular Value Decomposition
σ₁
2.558
σ₂
0.977
SVD Steps: A = UΣV^T
Original (unit circle)
Matrix A:
Key insight: SVD decomposes any matrix into rotate → stretch → rotate. The unit circle maps to an ellipse. σ₁/σ₂ are the semi-axis lengths. Step through to see each geometric stage.
Statement of the SVD
Theorem 1 (Singular Value Decomposition).For every matrix A∈Rm×n with rank r, there exist:
Orthogonal U∈Rm×m (left singular vectors)
Orthogonal V∈Rn×n (right singular vectors)
Diagonal Σ∈Rm×n with Σii=σi>0 for i=1,…,r and Σii=0 otherwise, where σ1≥σ2≥⋯≥σr
such that
A=UΣVT.(1)
The σi are the singular values; columns ui of U and vi of V are left and right singular vectors respectively.
Compact SVD. Often written with Ur∈Rm×r, Σr=diag(σ1,…,σr), Vr∈Rn×r:
A=UrΣrVrT.(2)
Existence Proof
Proof. The matrix ATA∈Rn×n is symmetric and positive semidefinite, since
xTATAx=∥Ax∥2≥0.(3)
By the spectral theorem:
ATA=VΛVT,λi≥0,(4)
where V is orthogonal and Λ=diag(λ1,…,λn).
Step 1 — Singular values. Define σi=λi for i=1,…,r where r=rank(A)=rank(ATA).
Step 2 — Left singular vectors. For i=1,…,r, define
ui=σi1Avi.(5)
This is well-defined since σi>0 for i≤r. Verify orthonormality:
Step 3 — Extension. Extend {u1,…,ur} to an orthonormal basis of Rm (adding vectors in null(AT) if r<m).
Step 4 — Verification. For i≤r: Avi=σiui by (5). For i>r: λi=0, so ∥Avi∥2=viTATAvi=0, hence Avi=0.
In matrix form: AV=UΣ, so A=UΣVT. ■
Important equation. Equation (1) always exists — no diagonalizability requirement. This universality makes SVD the default tool for rectangular data matrices.
Geometric Interpretation
The map x↦Ax decomposes as:
xVTrotate in RnΣscale axes, embed into RmUrotate in Rm.(7)
The unit sphere {x:∥x∥=1} maps to an ellipsoid in Rm with semi-axis lengths σi along directions ui.
Visual description. Picture inflating a balloon (sphere) through a pipe (linear map). The balloon emerges as an ellipsoid. The SVD identifies the balloon's original orientation (V), how much it stretched along each axis (Σ), and the final orientation in output space (U).
Relation to four subspaces:
col(A)=span(u1,…,ur)
row(A)=span(v1,…,vr)
null(A)=span(vr+1,…,vn)
null(AT)=span(ur+1,…,um)
Outer Product and Rank Structure
Theorem 2 (Outer Product Expansion).
A=i=1∑rσiuiviT.(8)
Each term σiuiviT is a rank-1 matrix. The SVD decomposes A into r rank-1 components ordered by magnitude σi.
Proof.(UΣVT)=∑iσiuiviT by matrix multiplication. ■
This connects to the outer-product view of matrix multiplication from Matrix Operations.
Theorem 3 (Eckart-Young-Mirsky).The best rank-k approximation to A in Frobenius norm is
Ak=i=1∑kσiuiviT=UkΣkVkT,(12)
with error
∥A−Ak∥F=i=k+1∑rσi2,∥A−Ak∥2=σk+1.(13)
Proof (Frobenius norm — key steps). Let B be any rank-k matrix. Then dim(null(B))≥n−k. The space span(v1,…,vk+1) has dimension k+1, so there exists unit z in both null spaces. Then:
∥(A−B)z∥=∥Az∥≥σk+1,(14)
since z has a component along vk+1. Hence ∥A−B∥F≥σk+1. The truncated SVD achieves equality. ■
Energy captured:
∥A∥F2∥Ak∥F2=∑i=1rσi2∑i=1kσi2.(15)
Important equation. Equation (15) quantifies how much of a matrix's structure is captured by its top-k singular components — the basis for dimensionality reduction and LoRA.
Truncated SVD and PCA
For centered data X∈RN×d (rows = samples):
X=UΣVT.(16)
Sample covariance:
C=N−11XTX=N−11VΣ2VT.(17)
Hence:
Principal components = columns of V
Covariance eigenvalues = σi2/(N−1)
PC scores = XV=UΣ
Numerical advantage. SVD of X avoids forming XTX, which squares the condition number. Always prefer SVD over direct covariance eigendecomposition for ill-conditioned data.
The Moore-Penrose Pseudoinverse
Definition 3. The pseudoinverseA+∈Rn×m is:
A+=VrΣr−1UrT,(18)
where Σr−1=diag(1/σ1,…,1/σr).
Theorem 4.The minimum-norm least-squares solution to Ax=b is x^=A+b.
Proof sketch.A+b lies in row(A) and satisfies the normal equations. Minimum norm among all least-squares solutions follows from orthogonality to null(A). ■
When A has full column rank, A+=(ATA)−1AT — the familiar form from Matrix Operations.
Application: Low-Rank Adaptation (LoRA)
Fine-tuning a pretrained weight matrix W0∈Rd×d uses:
W=W0+ΔW=W0+BA,B∈Rd×r,A∈Rr×d,r≪d.(19)
SVD justification. If the ideal update ΔW∗ has singular values decaying rapidly, then by Eckart-Young:
∥ΔW∗−BA∥F≥i=r+1∑dσi2,(20)
with equality when BA=(ΔW∗)r. Low-rank adaptation is optimal when task-specific changes are approximately low-rank.
Parameter count. Full update: d2. LoRA: 2dr. For d=4096, r=16: reduction factor d/(2r)=128.
Application: Matrix Completion
In collaborative filtering, the rating matrix R∈Rm×n has entries observed only on a subset Ω. The low-rank hypothesis: R≈UVT with U∈Rm×k, V∈Rn×k.
This is a partial, regularized low-rank factorization. When all entries are observed, the optimum relates to the truncated SVD of R.
Common Pitfalls and Misconceptions
Pitfall 1: Confusing SVD with eigendecomposition of A. For nonsquare or nonsymmetric A, eigenvalues of A may be complex or fail to diagonalize. SVD always uses orthogonal factors and real nonnegative singular values.
Pitfall 2: Truncating SVD without checking decay. If singular values decay slowly, rank-k truncation loses substantial information. Inspect the scree plot (σi vs i).
Pitfall 3: Applying PCA via SVD without centering. SVD of raw X finds directions of maximum variance including the mean offset. Always center columns first.
Pitfall 4: Assuming LoRA rank r is universally sufficient. Optimal r depends on task complexity and how quickly ΔW∗ singular values decay.
Pitfall 5: Using full SVD for very large matrices. Randomized SVD methods approximate top-k components in O(mnlogk) rather than O(min(mn2,m2n)).
Research Perspective
The SVD was developed independently by Beltrami (1873), Jordan (1874), and later formalized by Eckart and Young (1936) for low-rank approximation. Golub and Reinsch (1970) provided the first stable numerical algorithm.
In machine learning, latent semantic indexing (Deerwester et al., 1990) applied truncated SVD to term-document matrices. Matrix completion (Candès & Recht, 2009; Netflix Prize) exploited low-rank structure with theoretical guarantees. LoRA (Hu et al., 2021) brought low-rank updates to billion-parameter language models, motivated by the empirical observation that fine-tuning changes are low-rank.
Randomized numerical linear algebra (Halko et al., 2011) enables approximate SVD at scale — essential for modern data pipelines.
Summary of Takeaways
SVD — A=UΣVT — Universal factorization
Rank-k approx — Ak=UkΣkVkT — PCA, compression
Eckart-Young — Optimal in —⋅—F — Justifies LoRA, truncation
Pseudoinverse — A+=VrΣr−1UrT — Least squares
Energy ratio — ∑i=1kσi2/∑σi2 — Variance explained
Exercise 1. Compute the SVD of A=[300−2]. Identify U, Σ, V and verify (1).
Exercise 2. Prove ∥A∥F2=∑iσi2 and ∥A∥2=σ1.
Exercise 3. For rank-1 A=uvT, show the SVD has a single singular value σ1=∥u∥∥v∥.
Exercise 4 (Eckart-Young). For A with σ1=5,σ2=3,σ3=1, compute ∥A−A1∥F and the fraction of energy in the rank-1 approximation.
Exercise 5 (PCA). Given centered X∈R100×5 with SVD singular values (10,5,2,0.5,0.1), compute the proportion of variance explained by the first two principal components.
Exercise 6 (Pseudoinverse). For A=[1111], compute the SVD and A+. Verify AA+A=A.
Exercise 7 (Conceptual). Explain why ATA and AAT have the same nonzero eigenvalues, and relate them to singular values of A.
Appendix: The Polar Decomposition
Every square matrix A∈Rn×n admits a polar decomposition:
A=QP,(A.1)
where Q is orthogonal and P=(ATA)1/2 is symmetric positive semidefinite.
Derivation from SVD. Write A=UΣVT. Define Q=UVT (orthogonal when A is square and full rank) and P=VΣVT (symmetric PSD). Then A=QP.
Interpretation.P captures the "stretch" part of the transformation; Q captures the "rotation" part. For symmetric A, the polar decomposition coincides with the spectral theorem (Q=I, P=A when A≻0).
Connection to optimization. The polar decomposition appears in orthogonality constraints on weight matrices (orthogonal regularization) and in analyzing the singular value thresholding operator used in matrix completion algorithms.