This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.

# SingularValueDecomposition

 SingularValueDecomposition[m]gives the singular value decomposition for a numerical matrix m as a list of matrices , where w is a diagonal matrix and m can be written as u.w.Conjugate[Transpose[v]]. SingularValueDecompositiongives the generalized singular value decomposition of m with respect to a. SingularValueDecompositiongives the singular value decomposition associated with the k largest singular values of m. SingularValueDecompositiongives the generalized singular value decomposition associated with the k largest singular values.
• The matrix m may be rectangular.
• The diagonal elements of w are the singular values of m.
• u and v are column orthonormal matrices, whose transposes can be considered as lists of orthonormal vectors.
 Out[1]=
 Out[2]=
 Scope   (3)
m is a 3×2 matrix:
Find the singular value decomposition of m using machine-number arithmetic:
Find the singular value decomposition of m using 24-digit precision arithmetic:
The singular value decomposition of a random complex-valued 2×4 matrix:
m and a are random matrices with 3 columns:
Find the generalized singular value decomposition of m with respect to a:
m is a singular 3×3 matrix:
Find the full singular value decomposition of m:
The original matrix can be reconstructed from the singular value decomposition:
Find the "thin" decomposition associated with the nonzero singular values:
This decomposition still has sufficient information to reconstruct the matrix:
s is a large sparse matrix:
 Options   (1)
m is a nearly singular matrix:
To machine precision, the matrix is effectively singular:
With a smaller tolerance, the nonzero singular value is detected:
The default tolerance is based on precision, so the small value is detected with precision 20:
 Applications   (2)
m is a 2×2 matrix:
Find its singular value decomposition:
The columns of v give the directions of minimal and maximal stretching of vectors by :
The columns of u give the directions of minimal and maximal stretching of vectors by :
Here is some randomly generated data:
Construct a design matrix for fitting the data to basis functions :
Find the condensed singular value decomposition:
Find a vector x that minimizes :
The components of x are the coefficients given by Fit:
m and a are random matrices with 4 columns:
Find the singular value decomposition of m:
Verify that m is equal to u.w.Conjugate[Transpose[v]]:
Find the generalized singular value decomposition of m with respect to a:
Verify that m is equal to u.w.Conjugate[Transpose[v]]:
Verify that a is equal to ua.wa.Conjugate[Transpose[v]]:
m is a random 2×5 matrix:
Find the singular value decomposition of m:
The diagonal elements of w are the square roots of the eigenvalues of m.Transpose[m]:
The columns of u are the eigenvectors of m.Transpose[m] up to sign:
The first two columns of v are the eigenvectors of Transpose[m].m up to sign:
m is a 3×3 singular matrix:
Find the thin singular value decomposition:
Form the inverse of the diagonal matrix w:
Construct the Moore-Penrose pseudoinverse of m:
This is the matrix given by the PseudoInverse command:
m is the outer product of two vectors:
The condensed singular value decomposition for m:
The single column of u and v are normalizations of the two vectors:
The element of w is the product of the norms:
m is a 2×1000 random matrix:
The full singular value decomposition is very large because u is a 1000×1000 matrix:
The condensed singular value decomposition is much smaller:
It still contains sufficient information to reconstruct m: