Hello! Welcome to the final lesson in our module on Singular Value Decomposition.
In the previous lessons, we've explored the power of SVD to deconstruct any matrix into its fundamental components: . We used this decomposition to understand a matrix's rank, kernel, and image, and even to compute the pseudoinverse, , which provides the "best" solution to any linear system.
Today, we'll explore another powerful application of SVD that is central to modern data science and machine learning. Our goal is to apply SVD to find the best low-rank approximation of a matrix. This technique is the foundation for everything from data compression and noise reduction to building recommender systems.
1. The "Why": Data Compression and Latent Features
Imagine you have a massive matrix, perhaps representing every pixel in a high-resolution image or the ratings of millions of users for thousands of movies. Storing and performing calculations with such a large matrix can be computationally expensive. What if we could capture the essence of the matrix in a much smaller, simpler form?
This is the core idea behind low-rank approximation. We want to find a new matrix, with a lower rank, that is as close as possible to the original. A lower-rank matrix has fewer linearly independent columns/rows, implying it contains less complex information and can be stored more efficiently.
This article, 'Understanding SVD's Intuition', gives a great high-level overview of why low-rank approximation is so valuable. It frames SVD as a tool to find 'latent features' hidden in the data.
Please read the sections 'Why Was SVD Developed?', 'What does it mean to find the best approximation of a matrix by a lower-rank matrix?', and 'Application in Dimensionality Reduction'. This will provide the motivation for why we are doing this.
As the article highlights, low-rank approximation helps us:
- Compress data: By storing fewer numbers while preserving the main structure.
- Filter noise: By discarding the less important, often noisy, components of the data.
- Discover latent features: By revealing the underlying patterns that govern the data.
2. SVD as a Sum of Weighted, Rank-One Matrices
To understand how SVD gives us the best approximation, we first need to look at the decomposition in a slightly different way. Instead of a product of three matrices, we can express as a weighted sum of simpler matrices.
The SVD can be rewritten as:
where is the rank of , is the -th singular value, is the -th column of (a left singular vector), and is the -th row of (the transpose of a right singular vector).
Each term in this sum, , is an outer product of two vectors, which results in a rank-one matrix. So, the SVD tells us that any matrix can be built by adding together a series of rank-one matrices, each weighted by its corresponding singular value.
Since the singular values are always sorted in descending order (), the first term is the most significant "piece" of the matrix. The second term adds the next most significant piece, and so on.
Singular Value Decomposition (SVD): Matrix Approximation
Steve Brunton provides an excellent visualization of this concept, showing how the matrix A is constructed piece by piece from its most important components.
Watch the video from 1:30 to 8:17. Focus on how the product U \Sigma V^T is expanded into a sum of outer products and why each of these terms is a rank-one matrix.
3. Truncating the SVD for the Best Approximation
The insight that SVD is a weighted sum of rank-one matrices gives us a straightforward way to create a low-rank approximation. If we want a rank- approximation (where ), we can simply keep the first "most important" terms from the sum and discard the rest.
This is called the truncated SVD. The rank- approximation of , which we'll call , is defined as:
This is equivalent to reconstructing the matrix using only the first singular values and their corresponding singular vectors:
Where:
- is the matrix containing the first columns of .
- is the top-left diagonal matrix of .
- is the matrix containing the first rows of .

4. The Eckart-Young Theorem: A Guarantee of Optimality
Here's the most important part: the matrix we just constructed is not just an approximation; it is the best possible rank-k approximation of .
This is formally stated by the Eckart-Young-Mirsky Theorem. It guarantees that among all possible matrices of rank , is the one that minimizes the approximation error. The error is typically measured using the Frobenius norm, , which is like the Euclidean distance for matrices (the square root of the sum of the squares of all its elements).
Eckart-Young Theorem: For a given matrix , the rank- matrix that minimizes the error is the truncated SVD approximation .
Furthermore, the theorem gives us a precise formula for the approximation error using the 2-norm:
This is a remarkable result! The error of our best rank- approximation is simply the size of the first singular value we discarded. This gives us direct control over the accuracy of our approximation.
Singular Value Decomposition (SVD): Matrix Approximation
Let's return to the video by Steve Brunton, where he introduces this powerful theorem.
Watch from 8:17 to 11:55. He discusses the truncation process and then formally states the Eckart-Young theorem, which guarantees the optimality of this approximation.
Test your understanding!
A matrix has singular values . You want to create the best rank-2 approximation, .
- How would you construct using the SVD expansion form?
- What is the 2-norm error of this approximation, ?
Show answer
- You would construct by taking the first two terms of the SVD expansion:
- The 2-norm error is the first discarded singular value, which is . So, the error is .
5. Application: Image Compression
A fantastic and highly intuitive application of low-rank approximation is image compression. Since a grayscale image can be represented as a matrix of pixel values, we can use SVD to compress it.

The rapid decay of singular values is typical for natural images. This means that a vast majority of the image's visual information is contained in the first few singular components. By creating a low-rank approximation , we can store the image not as the full matrix of pixels, but as the three much smaller matrices (), (), and (). For a small , this results in significant storage savings.
The following reading provides a detailed walkthrough of this process, which will feel very natural given your background in computer science.
This document from Brigham Young University's ACME labs provides a hands-on guide to using SVD for image compression, complete with visual examples and problem descriptions that resemble coding assignments.
Please read the sections 'Using the SVD for Data Compression' and 'Image Compression' (pages 4-7). Pay attention to Figure 6.3, which shows how the quality of the image improves as the rank of the approximation increases. Note how color images are handled by applying SVD to each color channel (Red, Green, Blue) separately.
6. How Many Ranks to Keep?
A practical question remains: how do we choose the rank ? As we saw with image compression, it's a trade-off. A smaller gives more compression but lower fidelity, while a larger is more accurate but less compressed.
One popular heuristic is to choose a rank that preserves a certain percentage (e.g., 90%) of the total "energy" of the matrix. The total energy is defined as the sum of the squares of all singular values.
We would choose the smallest that gets this ratio above our desired threshold.
Lecture 49 — SVD Gives the Best Low Rank Approximation (Advanced) | Stanford
This video from a Stanford course explains this 'energy preservation' rule of thumb for choosing the number of dimensions to keep.
Watch the segment from 5:14 to 6:40. This will give you a practical method for deciding on an appropriate rank for your approximation in real-world scenarios.
Conclusion
This lesson concludes our deep dive into Singular Value Decomposition, and it's a fitting finale. The ability to find the best low-rank approximation is arguably one of SVD's most impactful applications in the modern world.
Key Takeaways:
- Any matrix can be expressed as a weighted sum of rank-one matrices: .
- The singular values act as importance weights for each rank-one component.
- The best rank- approximation of a matrix is found by truncating the SVD, keeping only the first terms of the sum: .
- The Eckart-Young Theorem guarantees that this approximation is optimal, minimizing the error among all possible rank- matrices.
- This technique is the basis for powerful applications like data compression, noise reduction, and discovering latent features in data.
Preview of the Next Module:
You have now completed the module on SVD! We've covered its geometric interpretation, its use in determining fundamental matrix properties, calculating the pseudoinverse, and finding optimal low-rank approximations.
In the next module, Applications in Data Analysis, we will see how these concepts come together to solve real-world problems. Our very first topic will be the least squares problem, which is the mathematical engine behind linear regression. We'll see how the pseudoinverse we learned about gives us a direct way to find the best-fit line through a set of data points, a cornerstone of machine learning.