Mathematics
Image Compression Using Singular Value Decomposition
Quick fact
Using SVD, you can compress an image by storing only a handful of singular values and their corresponding vectors—sometimes just 10-20 singular values per color channel can reproduce an image that is visually nearly indistinguishable from the original.
Why this is interesting
You've probably stored and sent thousands of images, each a massive grid of numbers. What if you could throw away most of those numbers without anyone noticing the difference?
Read the full explanation
Understanding Image Compression Using Singular Value Decomposition
Think of an image as a giant matrix: each pixel's brightness is a number. For a grayscale image, this is a matrix with rows and columns representing pixel positions. A color image is a stack of three such matrices—one for red, green, and blue. SVD decomposes any matrix A into a product of three matrices: A = U Σ Vᵀ. The matrix Σ is diagonal, with numbers called singular values along its diagonal, arranged from largest to smallest. These singular values capture the 'importance' of different patterns in the image. The matrices U and V store the corresponding patterns (left and right singular vectors). The secret to compression is that most images contain a lot of redundant structure—smooth regions, repeated textures—so the singular values drop off quickly. That means we can keep only the first k singular values and ignore the rest, effectively reducing the number of numbers we need to store. The result is a compressed image that looks almost the same, because we have retained the dominant features while discarding details that would be barely noticeable.
A deeper explanation
The mathematical mechanism behind SVD compression is that each singular value σᵢ, along with its corresponding left and right singular vectors uᵢ and vᵢ, forms a rank-1 matrix uᵢ σᵢ vᵢᵀ. The original matrix A is the sum of all these rank-1 pieces: A = Σᵢ σᵢ uᵢ vᵢᵀ. By truncating this sum to the first k terms, we obtain a matrix Ak that is the best approximation of A among all matrices of rank k, in the sense of minimizing the Frobenius or spectral norm (the Eckart–Young theorem). The compression ratio is determined by how many singular values we keep. For a typical photograph, the singular values decay rapidly: the first few capture broad contrast and major shapes, while later ones encode fine textures and noise. By choosing a threshold, we can trade off file size against visual fidelity. This approach is conceptually elegant, though in practice JPEG uses the discrete cosine transform because it exploits spatial redundancy even more effectively. However, SVD compression remains a powerful illustration of how linear algebra can be used to find structure in data and reduce dimensionality.