Singular Value Decompositions
Learning Objectives
- Construct an SVD of a matrix
- Identify pieces of an SVD
- Use an SVD to solve a problem
Singular Value Decomposition
An real matrix has a singular value decomposition of the form
where is an orthogonal matrix, is an orthogonal matrix, and is an diagonal matrix. Specifically,
- is an orthogonal matrix whose columns are eigenvectors of . The columns of are called the left singular vectors of .
is also an orthogonal matrix, we can apply diagonalization ().
We have the columns of are the eigenvectors of , with eigenvalues in the diagonal entries of .
- is an orthogonal matrix whose columns are eigenvectors of . The columns of are called the right singular vectors of .
Similar to above, we have the columns of as the eigenvectors of , with eigenvalues in the diagonal entries of .
- is an diagonal matrix of the form:
where and are the square roots of the eigenvalues values of . The diagonal entries are called the singular values of .
Note that if , then and both have the same eigenvalues:
(left-multiply both sides by )
Time Complexity
The time-complexity for computing the SVD factorization of an arbitrary matrix is , where the constant ranges from 4 to 10 (or more) depending on the algorithm.
In general, we can define the cost as:
Reduced SVD
The SVD factorization of a non-square matrix of size can be represented in a reduced format:
- For : is , is , and is
- For : is , is , and is (note if is , then is )
The following figure depicts the reduced SVD factorization (in red) against the full SVD factorizations (in gray).
In general, we will represent the reduced SVD as:
where is a matrix, is a matrix, is a matrix, and .
Example: Computing the SVD
We begin with the following non-square matrix,
and we will compute the reduced form of the SVD (where here ):
(1) Compute :
(2) Compute the eigenvectors and eigenvalues of :
(3) Construct from the eigenvectors of :
(4) Construct from the square roots of the eigenvalues of :
(5) Find by solving .
For our reduced case, we can find .
You could also find by computing the eigenvectors of .
We obtain the following singular value decomposition for :
Recall that we computed the reduced SVD factorization (i.e. is square, is non-square) here.
Rank, null space and range of a matrix
Suppose is a matrix where (without loss of generality):
We can re-write the above as:
Furthermore, the product of two matrices can be written as a sum of outer products:
For a general rectangular matrix, we have:
where .
If has non-zero singular values, the matrix is full rank, i.e. .
If has non-zero singular values, and , the matrix is rank deficient, i.e. .
In other words, the rank of equals the number of non-zero singular values which is the same as the number of non-zero diagonal elements in .
Rounding errors may lead to small but non-zero singular values in a
rank deficient matrix. Singular values that are smaller than a given tolerance are assumed to be numerically equivalent to zero, defining what is sometimes called the effective rank.
The right-singular vectors (columns of ) corresponding to vanishing
singular values of span the null space of , i.e. null() = span{, , …, }.
The left-singular vectors (columns of ) corresponding to the non-zero singular values of span the range of , i.e. range() = span{, , …, }.
Example:
The rank of is 2.
The vectors and provide an orthonormal basis for the range of .
The vector provides an orthonormal basis for the null space of .
(Moore-Penrose) Pseudoinverse
If the matrix is rank deficient, we cannot get its inverse. We define instead the pseudoinverse:
For a general non-square matrix with known SVD (), the pseudoinverse is defined as:
For example, if we consider a full rank matrix where :
Euclidean norm of matrices
The induced 2-norm of a matrix can be obtained using the SVD of the matrix :
And hence,
In the above equations, all the notations for the norm refer to the Euclidean norm, and we used the fact that and are orthogonal matrices and hence .
Example:
We begin with the following non-square matrix :
The matrix of singular values, , computed from the SVD factorization is:
Consequently the 2-norm of is
Euclidean norm of the inverse of matrices
Following the same derivation as above, we can show that for a full rank matrix we have:
where is the smallest singular value.
For non-square matrices, we can use the definition of the pseudoinverse (regardless of the rank):
where is the smallest non-zero singular value. Note that for a full rank square matrix, we have . An exception of the definition above is the zero matrix. In this case,
2-Norm Condition Number
The 2-norm condition number of a matrix is given by the ratio of its largest singular value to its smallest singular value:
If the matrix is rank deficient, i.e. , then .
Low-rank Approximation
The best rank- approximation for a matrix , where , for some matrix norm , is one that minimizes the following problem:
Under the induced -norm, the best rank- approximation is given by the sum of the first outer products of the left and right singular vectors scaled by the corresponding singular value (where, ):
Observe that the norm of the difference between the best approximation and the matrix under the induced -norm condition is the magnitude of the singular value of the matrix:
Note that the best rank- approximation to can be stored efficiently by only storing the singular values , the left singular vectors , and the right singular vectors .
The figure below show best rank- approximations of an image (you can find the code snippet that generates these images in the IPython notebook):
SVD Summary
- The SVD is a factorization of an matrix into where is an orthogonal matrix, is an orthogonal matrix, and is an diagonal matrix.
- Reduced form: where is an matrix, is an matrix, and is an diagonal matrix. Here, .
- The columns of are the eigenvectors of the matrix , and are called the left singular vectors of .
- The columns of are the eigenvectors of the matrix , and are called the right singular vectors of .
- The square roots of the eigenvalues of are the diagonal entries of , called the singular values .
- The singular values are always non-negative.
Review Questions
ChangeLog