Every matrix is a sum of simple pieces
A greyscale image is just a matrix: one number per pixel, arranged in rows and columns. The singular value decomposition (SVD) says that any such matrix A, of any shape, can be written exactly as a sum of simple rank-1 pieces — each one being a column vector times a row vector, scaled by a single number.
A = U Σ Vᵀ = Σᵢ σᵢ · uᵢ vᵢᵀ uᵢ, vᵢ — the i-th columns of U and V (orthonormal "direction" vectors) σᵢ — the i-th singular value, σ1 ≥ σ2 ≥ σ3 ≥ ... ≥ 0 uᵢ vᵢᵀ — a rank-1 matrix: same shape as A, but built from just two vectors
The crucial detail is the ordering: the singular values σᵢ are always sorted from largest to smallest, and each one tells you exactly how much that particular rank-1 layer contributes to reconstructing A. The first layer, weighted by σ1, is the single most important pattern in the whole image; the second layer refines it; and by the time you are down among the smallest singular values, you are adding back fine texture, sharp edges and — in a real photograph — sensor noise.
The best possible rank-k approximation
Truncating the sum after the first k terms gives a rank-k matrix, and the Eckart-Young theorem guarantees this is not just a reasonable approximation — it is provably the closest rank-k matrix to A in the least-squares sense, better than any other rank-k matrix you could construct by any other method. That guarantee is what makes SVD compression more than a curiosity: for a fixed compression budget, keeping the top k singular values is mathematically the optimal choice.
A_k = Σᵢ₌₁ᵏ σᵢ · uᵢ vᵢᵀ (rank-k approximation, k terms kept) reconstruction error: ||A − A_k|| = σ(k+1) (the largest dropped singular value)
Why natural images compress so well
A random matrix, with no structure at all, spreads its energy across singular values almost evenly, and truncating it badly degrades the reconstruction with very few terms kept. A photograph is nothing like that: neighbouring pixels are strongly correlated — a patch of sky is nearly uniform, a face has smooth gradients of light and shadow — and that redundancy means the singular values fall off fast, often close to exponentially for the first several dozen. The first handful of rank-1 layers already capture the coarse shapes, the overall lighting and the major contours; a face or a landscape becomes recognisable from a rank-20 or rank-40 approximation of an image that might be 512 pixels on a side, long before you have kept anywhere near all 512 singular values.
When keeping k values actually saves storage
Storing the full m × n image costs mn numbers. Storing a rank-k approximation costs the k columns of U (m numbers each), the k singular values, and the k rows of Vᵀ (n numbers each) — a total of k(m + n + 1) numbers. That is smaller than mn only once k is small enough:
k(m + n + 1) < m·n ⇒ k < mn / (m + n) (roughly) for a square n×n image: k < n/2 is where compression starts to win
This is why SVD compression is illustrative rather than the industry standard for photo storage: computing a full SVD is expensive for large images, and formats like JPEG get comparable or better compression using the much cheaper discrete cosine transform on small blocks instead. Where SVD genuinely shines is on data with strong global correlation and a legitimate need for a low-rank structure — compressing correlated sensor arrays, reducing the dimensionality of large numerical datasets, or as the backbone of recommendation systems, where the "image" being decomposed is a matrix of user preferences rather than pixels.
Frequently asked questions
Why does keeping only a few singular values still look like the original image?
Singular values are sorted from largest to smallest, and by the Eckart-Young theorem the top k of them capture the best possible rank-k approximation of the image in a least-squares sense. Most natural images have highly correlated rows and columns, so a small number of leading rank-1 layers already reconstruct the coarse shapes and gradients, while the remaining, much smaller singular values only add fine texture and noise.
Is SVD compression actually used in real image formats like JPEG?
No. JPEG uses the discrete cosine transform on small blocks, which is far cheaper to compute than a full SVD and does not require storing extra basis vectors. SVD compression is mainly a teaching tool and is used in some scientific and structured-data compression contexts, such as compressing correlated sensor data or reducing the dimensionality of large datasets, rather than in consumer photo formats.
When does keeping k singular values actually save storage?
Storing k rank-1 layers of an m x n image costs k(m + n + 1) numbers versus mn for the original, so it only saves space once k is meaningfully smaller than mn/(m+n). For a square image that threshold is roughly k < n/2, and pushing k much lower than that is where SVD compression becomes genuinely useful rather than just a lossy demonstration.
Try it live
Everything above runs in your browser — open SVD Compression and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open SVD Compression simulation