Singular Value DecompositionThe singular value decomposition of a rectangular matrix involves the computation of orthogonal matrices and and a diagonal matrix such that The diagonal elements of the matrix are called the singular values of . In Mathematica, the functions SingularValueList computes the singular values and SingularValueDecomposition computes the full singular value decomposition. In[1]:=  |
Out[2]=
|
In[3]:=  |
Out[4]=
|
This is a factorization so the original matrix can be restored. In[5]:=  |
Out[5]//MatrixForm=
|
Because the matrices and are orthogonal, they can be used as an orthogonal transformation of the original matrix to generate the diagonal matrix with the singular values on the diagonal. In[6]:=  |
Out[6]//MatrixForm=
|
If the matrix is singular then some of the singular values will be zero. In[7]:=  |
Out[9]//MatrixForm=
|
SingularValueList only returns the nonzero singular values. In[10]:=  |
Out[10]=
|
Note that if the matrix is complex, the definition of the singular value decomposition uses the conjugate transpose. There are many applications of the singular value decomposition. The singular values of a matrix give information on the linear transformation represented by . For example, the action of on a unit sphere generates an ellipsoid with semiaxes given by the singular values. The singular values can be used to compute the rank of a matrix; the number of nonzero singular values is equal to the rank. The singular values can be used to compute the 2-norm of a matrix, and the columns of the matrix that correspond to zero singular values are the null space of the matrix. Certain applications of singular values do not require all of the singular values to be computed. Mathematica provides a mechanism for obtaining only some singular values. This returns the smallest singular value of the input matrix; because it is zero, this demonstrates the matrix is not full rank. In[11]:=  |
Out[12]=
|
Generalized Singular ValuesFor an m n matrix and p n matrix the generalized singular values are given by the pair of factorizations where is , is , and is ; and are orthogonal, and is invertible. These are some sample matrices. In[1]:=  |
This returns the generalized singular values of the matrices matA and matB. In[3]:=  |
Out[3]=
|
This computes the full generalized singular value decomposition of the matrices matA and matB. In[4]:=  |
This demonstrates the identity for matA. In[5]:=  |
Out[5]//MatrixForm=
|
This demonstrates the identity for matB. In[6]:=  |
Out[6]//MatrixForm=
|
Finally, the singular values are computed by dividing the corresponding diagonal elements. In[7]:=  |
Out[7]=
|
OptionsThe functions SingularValueList and SingularValueDecomposition both take a Tolerance option. The option controls the size at which singular values are treated as being zero. By default, values that are tol times smaller than the largest singular value are dropped, where tol is 100×$MachineEpsilon for machine number matrices. For arbitrary-precision matrices it is , where is the precision of the matrix. The smallest singular value of this matrix is just larger than the default setting for the tolerance. It is not treated as being equivalent to a zero singular value. In[1]:=  |
Out[2]=
|
Increasing the setting for the tolerance causes the small singular value to be treated as being zero. In[3]:=  |
Out[3]=
|
|