# SingularValueDecomposition

gives the singular value decomposition for a numerical matrix m as a list of matrices {u,w,v}, where w is a diagonal matrix and m can be written as u.w.Conjugate[Transpose[v]].

SingularValueDecomposition[{m,a}]

gives the generalized singular value decomposition of m with respect to a.

gives the singular value decomposition associated with the k largest singular values of m.

gives the decomposition for the k largest singular values, or as many as are available.

SingularValueDecomposition[{m,a},k]

gives the generalized singular value decomposition associated with the k largest singular values.

# Details and Options • The matrix m may be rectangular.
• The diagonal elements of w are the singular values of m.
• SingularValueDecomposition sets to zero any singular values that would be dropped by SingularValueList.
• The option Tolerance can be used as in SingularValueList to determine which singular values will be considered to be zero. »
• u and v are column orthonormal matrices, whose transposes can be considered as lists of orthonormal vectors.
• SingularValueDecomposition[{m,a}] gives a list of matrices {{u,ua},{w,wa},v} such that m can be written as u.w.Conjugate[Transpose[v]] and a can be written as ua.wa.Conjugate[Transpose[v]]. »
• gives the decomposition for the k largest singular values, or as many as are available.

# Examples

open allclose all

## 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:

## Generalizations & Extensions(3)

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:

m is a singular 4×5 matrix:

Find the decomposition associated with the 3 largest singular values, or as many as there are if fewer:

s is a sparse matrix:

## Options(1)

### Tolerance(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 m.x:

The columns of u give the directions of minimal and maximal stretching of vectors by x.m:

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 that minimizes :

The components of are the coefficients given by Fit:

## Properties & Relations(4)

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 MoorePenrose 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:

## Possible Issues(1)

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:

Introduced in 2003
(5.0)
|
Updated in 2014
(10.0)
2015
(10.3)