SVD Decomposition Explorer

Split a matrix into directions, stretch strengths, and a low-rank reconstruction.

Loading interactive simulation...

Truncating the SVD is provably the best you can do 🖖

Keep only the k largest singular values and discard the rest, and you have not merely found a decent rank-k approximation — you have found the optimal one. The Eckart–Young–Mirsky theorem says no other matrix of rank k comes closer to the original, in either the Frobenius or the spectral norm. The error is exact rather than estimated: in the spectral norm it equals σk+1, the first singular value you threw away, and in the Frobenius norm it is the square root of the sum of squares of all discarded values. That single theorem is why image compression, principal component analysis and latent semantic indexing all reduce to the same instruction — compute the SVD, then cut it off.

Any matrix is a stack of layers 🖖

SVD rewrites any matrix as a weighted sum of simple rank-1 layers — each built from one left-side pattern and one right-side pattern — ordered from most to least important by its singular value. Squaring each singular value tells you how much of the matrix's total energy that layer carries. Keep only the top handful and you rebuild most of the data from a tiny fraction of the numbers — which is exactly why the kept-energy bar climbs so steeply at the start.

Discovered five times before it was useful 🖖

SVD is not a computer-age invention. It was derived independently by Beltrami (1873), Jordan (1874), Sylvester (1889), Schmidt (1907), and Weyl (1912) — pure matrix theory with no application in sight. Only in 1965 did Golub and Kahan publish a numerically stable way to compute it, and that unlocked everything you see here: image compression, denoising, search engines, and recommender systems.

Problem solved in full

  1. Three singular values and a 34.5% error from keeping 88.1% of the energy 6 steps

    Find the three singular values of the matrix on this page by hand — the characteristic polynomial does factor — and then explain why keeping 88.1% of the energy still leaves a 34.5% error.

    1. Singular values are the square roots of the eigenvalues of AᵀA, so form that product first. It is symmetric, which guarantees the eigenvalues are real and non-negative.

    2. The determinant of AᵀA − λI factors, which is the lucky part: the first column contributes a bracket that pulls out cleanly and leaves a quadratic.

    3. One eigenvalue is 10 exactly; the other two are the roots of the quadratic. Their surd form is exact and the decimals follow.

    4. Take square roots. The check is free — the three squared values must add to the trace of AᵀA, and 26 is the sum of the diagonal.

    5. Keeping two directions keeps their share of that 26. The Frobenius error is the square root of the discarded share, and that square root is the whole answer.

    6. Two further identities come free from the same three numbers: their product is the absolute determinant, and their ratio is the condition number. At 2.04 this matrix is thoroughly well behaved — the 34.5% is not near-singularity, it is a genuine third direction.

    Answer

    Because the error is a square root: √0.119 = 0.345. Energy is measured in squared singular values and error in unsquared ones, so throwing away an eighth of the energy costs a third of the norm, and the two numbers on the panel are the same fact reported on two different scales. This is the trap in every "we kept 95% of the variance" claim: 95% of the energy is a 22% reconstruction error, and 99% is still 10%. Eckart and Young proved in 1936 that no rank-2 matrix does better than 34.5% here, so this is a floor set by the matrix, not a weakness of the truncation.

Learning path

Matrices that move things

Leads to Principal components

References (2)

Example problems

  • rank-2 matrix - Small matrix decomposition shows principal singular directions and values.
  • mixed 3x3 - Σ comes back 3.591515, 3.162278, 1.760971 — three stretch strengths within a factor of 2.04 of each other, so no direction dominates. Drop the smallest and you still hold 88.1% of the energy while the rebuild sits 34.5% off, and the tool points out that rank 2 of a 3×3 is not smaller than storing A. Truncation here explains the matrix without compressing it.
  • diagonal 3x3 - U and Vᵀ come back as the identity. A diagonal matrix has no directions to find, so Σ just repeats the diagonal: 5, 2, 0.5. This is the one preset here where truncating saves anything: rank 1 stores about 77.8% as many numbers as A itself, where rank 2 of the mixed matrix stores more. Keeping that single direction holds 85.5% of the energy and leaves the rebuild 38.1% wrong.