Skip to main content

Someone wanted to learn this too, so Grasp built them a personal learning path.

You can keep exploring this one or create your own

Introduction to Singular Value Decomposition (SVD)

Hello! Welcome to your next lesson in our journey through the mathematical foundations of AI.

Introduction

In our last lesson, we saw how Principal Component Analysis (PCA) can be used for dimensionality reduction. We concluded with a preview of a more general and numerically robust method for this task: the Singular Value Decomposition (SVD). We briefly mentioned that the SVD of the data matrix itself contains all the information needed for PCA, bypassing the explicit formation of the covariance matrix.

Today, we will formally define the Singular Value Decomposition. Our learning outcome is to define the SVD and the properties of its constituent matrices (U, Σ, V). Unlike eigendecomposition, which is limited to certain square matrices, the SVD exists for any rectangular matrix. This universality makes it one of the most fundamental and powerful matrix decompositions in linear algebra and data science.

We will derive the SVD from first principles, building upon your understanding of symmetric matrices and their eigendecomposition. Let's start with a high-level overview.

Singular Value Decomposition (SVD) Formula and Properties
This image provides a visual anchor for the Singular Value Decomposition. Any m x n matrix A can be factored into three matrices: U (an m x m orthogonal matrix of left singular vectors), Σ (an m x n rectangular diagonal matrix of singular values), and V^T (the transpose of an n x n orthogonal matrix of right singular vectors).

The Need for a More General Decomposition

As you know, the eigendecomposition is incredibly useful, but it has two key limitations:

  1. The matrix must be square.
  2. A full basis of eigenvectors is only guaranteed for certain classes of matrices (like symmetric matrices, which give an orthonormal basis).

For a general matrix , the equation doesn't even make sense if , as would be in while is in . SVD overcomes these issues by finding two different sets of orthonormal basis vectors, one for the input space () and one for the output space (), that are linked by the transformation .

6. Singular Value Decomposition (SVD)

Let's start by understanding why SVD is necessary. In this video, Professor Gilbert Strang explains the limitations of eigenvalues for non-symmetric or rectangular matrices and introduces the three key components of SVD: the left singular vectors (U), the right singular vectors (V), and the singular values (Σ).

Watch the first 3 minutes and 24 seconds of this classic lecture. Pay close attention to the distinction he draws between eigenvectors (one basis) and singular vectors (two separate orthonormal bases), and the properties of the singular values.

Deriving the SVD

The core idea behind deriving the SVD for a matrix is to construct related matrices that are symmetric, allowing us to use the power of the spectral theorem. These matrices are and .

The Anatomy of the SVD

The Singular Value Decomposition of an matrix is a factorization of the form:

where:

  • is an orthogonal matrix. Its columns, , are called the right singular vectors.
  • is an orthogonal matrix. Its columns, , are called the left singular vectors.
  • is an rectangular matrix that is zero everywhere except for its main diagonal. The diagonal entries, , are the singular values of .

Now, let's derive how to find these three matrices. The following video walks through the entire derivation, which we will then formalize with rigorous definitions.

6. Singular Value Decomposition (SVD)

The ingenious approach to finding U, Σ, and V is to analyze the eigendecomposition of the symmetric matrices A^T A and A A^T. This video demonstrates precisely how this is done.

Watch the segment from 03:24 to 17:15. Follow the derivation closely. You'll see how: The right singular vectors (V) are revealed to be the eigenvectors of A^T A. The left singular vectors (U) are the eigenvectors of A A^T. The singular values (σ) are the square roots of the eigenvalues of these symmetric matrices.

Formalizing the Construction

Let's consolidate the derivation from the video with formal mathematical statements.

  1. Finding V and Σ:

    • Consider the matrix . It is symmetric, so it has an orthonormal basis of eigenvectors and real eigenvalues.
    • Property: The eigenvalues of are non-negative.
    • Proof: Let be an eigenpair of . Then .

      Since norms are non-negative, . As is an eigenvector, , so we must have .
    • We define the singular values of , denoted , as the square roots of the eigenvalues of : . By convention, they are ordered such that .
    • The right singular vectors, , are the corresponding orthonormal eigenvectors of . These form the columns of the matrix V.
  2. Finding U:

    • Similarly, consider the matrix . This is also a symmetric matrix with non-negative eigenvalues.
    • It can be shown that and have the same non-zero eigenvalues.
    • The left singular vectors, , are the orthonormal eigenvectors of . These form the columns of the matrix U.

The following resource provides a rigorous definition of the SVD and proves its existence.

Notes on singular value decomposition for Math 54

To solidify these concepts with formal definitions and proofs, please study the following notes. They provide a concise and mathematically precise description of the SVD components and the theorem guaranteeing their existence.

First, read Section 1, 'Singular values', to see the formal definition of singular values and the proof of their non-negativity. Then, read Section 2, 'Definition of singular value decomposition', for the precise definition of the A = UΣV^T factorization. Finally, focus on Theorem 3.2 and its associated proof, which formally shows how the U and V matrices are constructed and related.

Test your understanding!

Suppose . You are told that the eigenvectors of are the columns of and the eigenvalues are the squares of the singular values in . Starting from , can you prove this relationship by calculating ?

Show answer

Starting with , we compute its transpose:

Now, we can compute :

Since is an orthogonal matrix, . The expression simplifies to:

Let's call the matrix . Since is a rectangular diagonal matrix, will be a square diagonal matrix. Specifically, if is , then is , and is an diagonal matrix whose entries are .

So we have . Since is orthogonal, , which means . This is precisely the eigendecomposition of the matrix . The columns of are the eigenvectors, and the diagonal entries of (which are ) are the corresponding eigenvalues. This confirms the relationship.

Properties and Geometric Intuition

A key part of the construction is that the vectors defined as (for ) are guaranteed to be orthonormal. This remarkable property ensures that everything fits together perfectly. SVD can be geometrically interpreted as decomposing any linear transformation into a sequence of fundamental operations.

6. Singular Value Decomposition (SVD)

A critical property we have relied on is that the vectors we construct for the U matrix are not just any vectors, but are themselves orthonormal. Professor Strang provides a beautiful proof of this fact and then offers a powerful geometric interpretation of what SVD does to a vector space.

First, watch from 17:15 to 26:27 to see the elegant proof that the vectors {A\mathbf{v}_i / σ_i} are orthogonal. Then, watch from 28:31 to 33:16 for the geometric picture of SVD as a rotation (V^T), a scaling (Σ), and another rotation (U), which transforms a unit circle into an ellipse.

To prepare for our next lesson, it's useful to see one more way of writing the SVD.

Chapter 6 The Singular Value Decomposition

This resource provides the most general formal statement of the SVD theorem. It also introduces the 'dyadic form' of the decomposition, which expresses the matrix A as a sum of simpler, rank-one matrices. This form is the foundation for low-rank approximation.

Please read Theorem 13 in Section 6.8 for the final, general statement of the SVD. Then, review Section 6.3, 'The dyadic form of the SVD', to see how A can be expressed as a sum: A = Σ σ_i u_i v_i^T. We will explore this in detail next time.

Conclusion

In this lesson, we have formally defined the Singular Value Decomposition and rigorously derived its components. You now understand the deep connection between the SVD of a matrix and the eigendecomposition of the related symmetric matrices and .

Key Takeaways:

  • Any matrix can be decomposed as .
  • V, the matrix of right singular vectors, is an orthogonal matrix whose columns are the orthonormal eigenvectors of .
  • U, the matrix of left singular vectors, is an orthogonal matrix whose columns are the orthonormal eigenvectors of .
  • Σ is an rectangular diagonal matrix containing the non-negative singular values , which are the square roots of the eigenvalues of (and ).
  • Geometrically, the SVD decomposes any linear transformation into a rotation, a scaling along the axes, and a second rotation.

Preview of the Next Lesson:
We ended by introducing the dyadic form of the SVD: . The singular values are ordered by magnitude. This suggests that we can approximate the matrix by keeping only the first few terms in this sum—those corresponding to the largest singular values. In our next lesson, we will explore this idea and use SVD to perform low-rank approximation of a data matrix, a technique with profound applications from image compression to recommender systems.

Can't find a good explanation? Sign up and we'll make it for you

Sign up