Singular Value Decomposition
Formal
SVD
Let be a rectangular matrix of rank . The SVD of is a decomposition of the form
with an orthogonal matrix with column vectors and an orthogonal matrix with column vectors . Moreover, is an with and .
The diagonal entries of are called singular values, are called left-singular vectors and are called right-singular vectors. By convention, the singular values are ordered, i.e., .
SVD exists for every matrix .
Construction of SVD
The construction of the Singular Value Decomposition (SVD) for any rectangular matrix is based on the properties of two related symmetric matrices: and . The process involves finding the eigenvalues and eigenvectors of these matrices, which in turn define the components of the SVD. 1. Find the Right-Singular Vector () and Singular Values () Compute the eigendecomposition of matrix .
- Construct . This is guaranteed to be an SPD matrix. (Symmetric, Positive Definite Matrices) which implies that its Eigenvalues are real and non-negative, and its eigenvectors form an orthonormal basis.
- Eigendecomposition: Find the eigenvalues and the corresponding orthonormal eigenvectors.
- The right-singular vectors () in SVD of are the eigenvectors of . These vectors form the columns of the orthogonal matrix .
- The singular values () of the SVD of are the square root of the eigenvalues of . These form the diagonal matrix . These come from the substitution of SVD formula into the expression for :
2. Find the Left-Singular Vectors U Similar to the first step, the left-singular vectors () of A are the orthonormal eigenvectors of the matrix . The eigenvalues of are also equal to .
Intuition
At its heart, the SVD tells us that every linear transformation can be broken down into a sequence of three simple geometric operations: a rotation, a scaling, and another rotation. This holds true for any rectangular matrix A, making SVD a universally applicable tool.
A beautiful way to visualize this comes from observing how a matrix transforms a set of unit vectors (Column View of a System of Linear Equations) . Imagine a circle of unit vectors in your input space. Applying the matrix A will transform this circle into an ellipse in the output space. The SVD elegantly describes this transformation:
- The right-singular vectors () are the special, orthonormal vectors on the original unit circle that get mapped directly onto the principal axes of the output ellipse. They represent the principal directions of the input space.
- The left-singular vectors () are the orthonormal unit vectors that define the directions of the principal axes of the output ellipse. They represent the principal directions of the output space.
- The singular values () are the lengths of these principal axes. Each is the scaling factor applied to its corresponding vector to map it to an axis of length σi in the direction of .
This fundamental relationship, , is the core geometric insight of SVD. It shows that the complex action of a matrix A can be understood as finding an orthonormal basis in the input space () that maps to an orthogonal (but scaled) basis in the output space ().
The full decomposition operationalizes this as a three-step process, as shown in the diagram above
- (First Rotation): Aligns the principal input directions () with the standard coordinate axes.
- (Scaling): Scales the space along these axes by the singular values σi. This is also where dimensionality might change (e.g., from ).
- (Second Rotation): Orients the scaled result to its final position in the output space.
ML Applications
SVD is a fundamental tool with broad applications in machine learning, primarily due to its ability to find optimal low-rank approximations.
- Principal Component Analysis (PCA) and Dimensionality Reduction: SVD provides the most direct way to perform PCA. The Eckart-Young Theorem states that the best rank- approximation of a matrix is found by truncating its SVD to the top singular values. This truncated SVD, , minimizes the reconstruction error. In PCA, the columns of (the first left-singular vectors) form the basis of the principal subspace that best captures the data’s variance.
- Recommender Systems: SVD can uncover latent (hidden) factors in data. In the movie-rating example (Example 4.14), SVD decomposes the user-movie matrix into vectors that represent abstract concepts like “sci-fi lover” or “art-house film,” allowing for powerful recommendations based on these latent features.
- Numerical Stability: SVD is the preferred method for solving linear systems of equations and computing the pseudo-inverse, especially for ill-conditioned or non-square matrices.
Connections
- Forward Links:
- Backward Links: Matrix decomposition landscape, Eigendecomposition and Diagonalization, Eigenvalues and eigenvectors