Singular Value Decomposition: SVD

Learn one of the most important matrix decompositions, singular value decomposition.

Definition

The Singular Value Decomposition (SVD) of an n×dn\times d matrix, AA, is the factorization of AA, multiplied by the product of three matrices: A=UΣVTA = U\Sigma V^T, where the matrices Un×nU_{n\times n} and Vd×dTV^T_{d\times d} are orthogonal and the matrix, Σn×d\Sigma_{n\times d}, is a generalized diagonalGeneralizedDiagonal with non-negative real entries.

SVD in numpy

We can compute SVD of a matrix, A, using U,S,Vt = numpy.linalg.svd(A), where S is an array containing diagonal entries of Σ\Sigma and Vt is VTV^T. The diag function in the implementation below converts the S array into the generalized diagonal matrix, Σ\Sigma. We’ve used the D variable to represent Σ\Sigma in the code.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy