Singular Value Decomposition

Breaking any table of numbers into rotate, stretch, rotate. It powers PCA and more.

🔴 advanced5 min readlinear-algebra
Singular value decomposition, or SVD, breaks any table of numbers into three simpler pieces: a rotation, a stretch along a few independent directions, and another rotation. The stretch amounts, called singular values, say how much each direction matters. Keep only the biggest few and throw the rest away, and you get the best possible compressed version of the original table. That one idea sits behind PCA, image compression, recommenders that fill in missing ratings, and early topic models for text.

The Fundamental SVD Equation

Every real m×nm \times n matrix AA can be factored as:

A = U * Sigma * V^T

  Matrix A (m × n)          Left Vectors U (m × m)    Singular Values Σ (m × n)   Right Vectors V^T (n × n)
  ┌──────────────┐          ┌──────────────┐          ┌───┬───┬───┐               ┌──────────────┐
  │              │    =     │              │    ×     │σ1 │ 0 │ 0 │       ×       │              │
  │              │          │              │          ├───┼───┼───┤               │              │
  └──────────────┘          └──────────────┘          └───┴───┴───┘               └──────────────┘
  1. Left-Singular Vectors U (m × m): Orthogonal matrix (UTU=IU^T U = I). Columns are eigenvectors of AATA A^T.
  2. Singular Values Sigma (m × n): Diagonal matrix. Values σ1≥σ2≥⋯≥σr>0\sigma_1 \ge \sigma_2 \ge \dots \ge \sigma_r > 0 are square roots of eigenvalues of ATAA^T A.
  3. Right-Singular Vectors V^T (n × n): Orthogonal matrix (VTV=IV^T V = I). Columns of VV are eigenvectors of ATAA^T A.

Geometric Interpretation: Three Transformations

SVD breaks down any linear transformation into three geometric steps:

  1. V^T: Rotate the input vector space.
  2. Sigma: Scale along orthogonal axes by singular values σi\sigma_i.
  3. U: Rotate into the output vector space.
  Unit Circle x ──► [ Rotate V^T ] ──► [ Stretch Σ by σ1, σ2 ] ──► [ Rotate U ] ──► Ellipse Ax

Truncated SVD & Image Compression

To compress a matrix AA to rank k≪min⁡(m,n)k \ll \min(m, n):

Keep only the top kk largest singular values:

A_k = sum_{i=1}^k \sigma_i u_i v_i^T

The Eckart-Young-Mirsky Theorem proves that AkA_k is the mathematically optimal rank-kk approximation of AA, minimizing Frobenius norm error ∥A−Ak∥F\|A - A_k\|_F.

Key Machine Learning Applications

  1. Principal Component Analysis (PCA): Compute SVD on mean-centered matrix XX. The right-singular vectors VV are the principal components.
  2. Latent Semantic Analysis (LSA): Apply SVD to term-document matrices to discover hidden semantic concepts in text collections.
  3. Recommender Systems: Decompose sparse rating matrices for collaborative filtering.

Say this out loud

SVD factorizes any matrix A into U Sigma V^T, where U and V are orthogonal rotation matrices and Sigma contains non-negative singular values. Truncated SVD keeps the top k singular values to give the optimal low-rank matrix approximation under the Eckart-Young theorem. SVD forms the mathematical engine behind PCA, dimensional reduction, and latent semantic analysis.

Follow-ups to expect

Check yourself

Question 1 of 3

What is the formal matrix factorization equation for SVD of an m × n real matrix A?

More in Math & Statistics

See all →
Bayes’ Theorem4 minCentral Limit Theorem4 minLaw of Large Numbers4 min