skip to content

Why is the truncated SVD the best rank-k approximation of a matrix?

level: middleimportance: must knowfreq 62%

answer

  1. a sum of rank-1 layers, biggest first
  2. orthogonal layers, so energy adds in squares
  3. there is a named optimality theorem here
  4. the discarded tail fixes the error exactly
  5. Eckart-Young, in Frobenius and spectral norm

basics

~20 s

The Eckart-Young theorem guarantees it: keeping the k largest singular values and their vectors minimizes the approximation error over all matrices of rank at most k, in both Frobenius and spectral norm. The discarded singular values fix the error exactly.

solid answer

~50 s

Write the SVD as a sum of rank-1 layers, `A = sigma_1 u_1 v_1^T + sigma_2 u_2 v_2^T + ...`, ordered by decreasing sigma. Truncating after k terms gives A_k, and the Eckart-Young theorem says no matrix B with rank at most k achieves a smaller `||A - B||`, in the Frobenius norm or the spectral norm; the same A_k is optimal for both. The errors are exactly `||A - A_k||_F = sqrt(sigma_{k+1}^2 + ... + sigma_r^2)` and `||A - A_k||_2 = sigma_{k+1}`, so the tail of the spectrum tells you what a given k costs before you commit. The intuition is that the layers are mutually orthogonal, so their contributions add in squares and dropping the smallest ones is the cheapest possible loss. Storing A_k for an m-by-n matrix takes k(m + n + 1) numbers instead of mn.

go deeper

for a junior

Know that keeping only the largest few singular values yields a compressed approximation of the matrix, and that the ones dropped are the smallest.

for a middle

Name Eckart-Young and state what it optimizes: minimum error over all matrices of rank at most k, in both Frobenius and spectral norm, with the error given by the discarded singular values.

for a senior

Judge whether truncation is worth it on real data: look at how fast the spectrum decays, weigh k(m + n + 1) against mn, and say plainly when a flat spectrum means no useful compression exists.

for a principal

Own the tradeoff between an exact but expensive full decomposition and cheaper randomized or iterative low-rank methods once the matrix is too large to factor outright, and the accuracy guarantees you give up.

## The matrix as a sum of layers Multiplying out `A = U S V^T` gives `A = sigma_1 u_1 v_1^T + sigma_2 u_2 v_2^T + ... + sigma_r u_r v_r^T` where r is the rank and each term is a rank-1 matrix: an outer product of a left and a right singular vector, scaled by a singular value. The terms are ordered by decreasing sigma, so the sum lists the matrix's structure from most to least important. Truncating after k terms defines `A_k = sum from i = 1 to k of sigma_i u_i v_i^T` which has rank k (assuming `sigma_k > 0`). ## Eckart-Young The **Eckart-Young theorem** (extended to all unitarily invariant norms by Mirsky) states that A_k is a *global minimizer* of the approximation error over the entire set of matrices of rank at most k: `||A - A_k|| <= ||A - B||` for every B with rank(B) <= k This holds in the Frobenius norm (the entrywise root-sum-of-squares) and in the spectral norm (the largest singular value of the difference). The remarkable part is that the same truncation is optimal for both, and that you get it by *deleting terms* rather than by solving an optimization problem. There is nothing to fit or tune. The errors are known in closed form: - `||A - A_k||_F = sqrt(sigma_{k+1}^2 + sigma_{k+2}^2 + ... + sigma_r^2)` - `||A - A_k||_2 = sigma_{k+1}` Both follow immediately from the fact that `A - A_k` is itself the SVD sum of the discarded layers, so its singular values are precisely the discarded singular values. ## Why deleting the smallest works The layers are mutually orthogonal: the left singular vectors are orthonormal and so are the right ones, so different rank-1 terms do not interfere. Energy therefore adds in squares, `||A||_F^2 = sigma_1^2 + ... + sigma_r^2`, and every layer contributes independently. Discarding a layer costs exactly its squared singular value and nothing more, so removing the smallest ones is the cheapest way to shed r - k layers. Any other rank-k matrix has to spend its budget of k directions somewhere, and no other choice of directions captures more energy than the leading singular directions. ## What it buys in storage For an m-by-n matrix the truncated form stores k left singular vectors of length m, k right singular vectors of length n, and k singular values: `k(m + n + 1)` numbers versus `m n` for the full matrix. A grayscale image of 1000 by 1000 pixels holds 1,000,000 numbers; at k = 50 the truncated form holds 50 * 2001 = 100,050, about a tenth, and the image is often still recognisable, because most of the picture's energy sits in the first few dozen singular values. The break-even is `k(m + n + 1) = m n`, so once k approaches the smaller dimension the representation saves nothing. ## When it does not help Everything above is optimal, but optimal is not the same as good. If the spectrum is flat, meaning `sigma_1` through `sigma_r` are comparable in size, then the discarded tail is large for any k well below r and the best rank-k approximation is still a bad approximation. The theorem tells you the error exactly; it does not promise the error is small. Deciding whether a matrix has exploitable low-rank structure means looking at how fast the singular values decay, not at the theorem. ## Uniqueness A_k is the unique minimizer when `sigma_k > sigma_{k+1}`. If those two are equal there is a tie over which layer to keep, and several distinct rank-k matrices attain the same minimal error. The minimum error value is unique regardless. ## Common mistakes Calling truncation a heuristic with no guarantee; reporting the Frobenius error as the plain sum of the discarded singular values instead of the root of the sum of their squares; confusing dropping small singular values with dropping rows or columns of the matrix, which is a completely different and generally much worse approximation; and assuming a low-rank form always saves space regardless of k and the matrix shape.

  • How much error does truncating at rank k leave, in terms of the singular values?
    In Frobenius norm the error is exactly the root of the sum of the squared discarded singular values, sqrt(sigma_{k+1}^2 + ... + sigma_r^2). In spectral norm it is sigma_{k+1} alone, the largest value you threw away. Both are computable from the spectrum before you commit to any k, which is why the singular values are inspected first.
  • When does a truncated SVD save you nothing?
    When the spectrum is flat. If the singular values are all comparable, every layer carries similar energy, so any k short of the full rank leaves a large error. Storage also breaks even at k(m + n + 1) = mn, so a k approaching the smaller dimension costs as much as the original matrix. Low-rank approximation pays only when the singular values decay quickly.
  • Is the best rank-k approximation unique?
    It is unique when sigma_k is strictly greater than sigma_{k+1}. If those two are equal there is a tie over which layer to include, and several different rank-k matrices attain the same minimal error. The minimum error value itself is unique in every case.

Compressing a grayscale photo: keeping the top k layers stores k(m + n + 1) numbers instead of mn, and the picture stays recognisable because most of its energy sits in the first few singular values.

saying these in an interview costs you the question

  • Calls truncation a heuristic with no optimality guarantee
  • Claims you must optimize to find the best rank-k matrix
  • Reports Frobenius error as the sum, not the root sum of squares
  • Confuses dropping singular values with dropping rows or columns
  • Assumes low rank always compresses, whatever the spectrum

context