Functions > Vector and Matrix > Matrix Factorization > Example: SVD Matrix Factorization
  
Example: SVD Matrix Factorization
Use the svd function to perform SVD factorization of matrices. This is useful in solving linear systems. The algorithms underlying these functions are also used in lsolve.
1. Input a real matrix M (not necessarily square).
Click to copy this expression
2. Use the svd function to perform SVD decomposition of matrix M. Uncollapse the nested matrices to view their content.
Click to copy this expression
3. Show that the svds function returns a vector of singular values of matrix M, and that it is identical to the first nested array of the results returned by the svd function.
Click to copy this expression
4. Set variables s, U and V to be element 0, 1 and 2, respectively of matrix S.
Click to copy this expression
Click to copy this expression
Click to copy this expression
5. Use the diag function to create a matrix whose diagonal elements are the elements of s.
Click to copy this expression
6. Show that the product of U, D and V returns input matrix M.
Click to copy this expressionClick to copy this expression
The two matrices are identical.