Singular value decomposition

Illustration of the singular value decomposition UΣV of a real 2 × 2 matrix M.
  • Top: The action of M, indicated by its effect on the unit disc D and the two canonical unit vectors e1 and e2.
  • Left: The action of V, a rotation, on D, e1, and e2.
  • Bottom: The action of Σ, a scaling by the singular values σ1 horizontally and σ2 vertically.
  • Right: The action of U, another rotation.

In linear algebra, the singular value decomposition (SVD) is a factorization of a real or complex matrix into a rotation, followed by a rescaling followed by another rotation. It generalizes the eigendecomposition of a square normal matrix with an orthonormal eigenbasis to any matrix. It is related to the polar decomposition.

Specifically, the singular value decomposition of an complex matrix is a factorization of the form where is an complex unitary matrix, is an rectangular diagonal matrix with non-negative real numbers on the diagonal, is an complex unitary matrix, and is the conjugate transpose of . Such decomposition always exists for any complex matrix. If is real, then and can be guaranteed to be real orthogonal matrices; in such contexts, the SVD is often denoted

The diagonal entries of are uniquely determined by and are known as the singular values of . The number of non-zero singular values is equal to the rank of . The columns of and the columns of are called left-singular vectors and right-singular vectors of , respectively. They form two sets of orthonormal bases and and if they are sorted so that the singular values with value zero are all in the highest-numbered columns (or rows), the singular value decomposition can be written as

where is the rank of

The SVD is not unique, however it is always possible to choose the decomposition such that the singular values are in descending order. In this case, (but not and ) is uniquely determined by

The term sometimes refers to the compact SVD, a similar decomposition in which is square diagonal of size where is the rank of and has only the non-zero singular values. In this variant, is an semi-unitary matrix and is an semi-unitary matrix, such that

Mathematical applications of the SVD include computing the pseudoinverse, matrix approximation, and determining the rank, range, and null space of a matrix. The SVD is also extremely useful in all areas of science, engineering, and statistics, such as signal processing, least squares fitting of data, and process control.

Intuitive interpretations[edit]

Animated illustration of the SVD of a 2D, real shearing matrix M. First, we see the unit disc in blue together with the two canonical unit vectors. We then see the actions of M, which distorts the disk to an ellipse. The SVD decomposes M into three simple transformations: an initial rotation V, a scaling along the coordinate axes, and a final rotation U. The lengths σ1 and σ2 of the semi-axes of the ellipse are the singular values of M, namely Σ1,1 and Σ2,2.
Visualization of the matrix multiplications in singular value decomposition

Rotation, coordinate scaling, and reflection[edit]

In the special case when is an real square matrix, the matrices and can be chosen to be real matrices too. In that case, "unitary" is the same as "orthogonal". Then, interpreting both unitary matrices as well as the diagonal matrix, summarized here as as a linear transformation of the space the matrices and represent rotations or reflection of the space, while represents the scaling of each coordinate by the factor Thus the SVD decomposition breaks down any linear transformation of into a composition of three geometrical transformations: a rotation or reflection (), followed by a coordinate-by-coordinate scaling (), followed by another rotation or reflection ().

In particular, if has a positive determinant, then and can be chosen to be both rotations with reflections, or both rotations without reflections.[citation needed] If the determinant is negative, exactly one of them will have a reflection. If the determinant is zero, each can be independently chosen to be of either type.

If the matrix is real but not square, namely with it can be interpreted as a linear transformation from to Then and can be chosen to be rotations/reflections of and respectively; and besides scaling the first coordinates, also extends the vector with zeros, i.e. removes trailing coordinates, so as to turn into

Singular values as semiaxes of an ellipse or ellipsoid[edit]

As shown in the figure, the singular values can be interpreted as the magnitude of the semiaxes of an ellipse in 2D. This concept can be generalized to -dimensional Euclidean space, with the singular values of any square matrix being viewed as the magnitude of the semiaxis of an -dimensional ellipsoid. Similarly, the singular values of any matrix can be viewed as the magnitude of the semiaxis of an -dimensional ellipsoid in -dimensional space, for example as an ellipse in a (tilted) 2D plane in a 3D space. Singular values encode magnitude of the semiaxis, while singular vectors encode direction. See below for further details.

The columns of U and V are orthonormal bases[edit]

Since and are unitary, the columns of each of them form a set of orthonormal vectors, which can be regarded as basis vectors. The matrix maps the basis vector to the stretched unit vector By the definition of a unitary matrix, the same is true for their conjugate transposes and except the geometric interpretation of the singular values as stretches is lost. In short, the columns of and are orthonormal bases. When is a positive-semidefinite Hermitian matrix, and are both equal to the unitary matrix used to diagonalize However, when is not positive-semidefinite and Hermitian but still diagonalizable, its eigendecomposition and singular value decomposition are distinct.

Relation to the four fundamental subspaces[edit]

  • The first columns of are a basis of the column space of .
  • The last columns of are a basis of the null space of .
  • The first columns of are a basis of the column space of (the row space of in the real case).
  • The last columns of are a basis of the null space of .

Geometric meaning[edit]

Because and are unitary, we know that the columns of yield an orthonormal basis of and the columns of yield an orthonormal basis of (with respect to the standard scalar products on these spaces).

The linear transformation

has a particularly simple description with respect to these orthonormal bases: we have

where is the -th diagonal entry of and for

The geometric content of the SVD theorem can thus be summarized as follows: for every linear map one can find orthonormal bases of and such that maps the -th basis vector of to a non-negative multiple of the -th basis vector of and sends the left-over basis vectors to zero. With respect to these bases, the map is therefore represented by a diagonal matrix with non-negative real diagonal entries.

To get a more visual flavor of singular values and SVD factorization – at least when working on real vector spaces – consider the sphere of radius one in The linear map maps this sphere onto an ellipsoid in Non-zero singular values are simply the lengths of the semi-axes of this ellipsoid. Especially when and all the singular values are distinct and non-zero, the SVD of the linear map can be easily analyzed as a succession of three consecutive moves: consider the ellipsoid and specifically its axes; then consider the directions in sent by onto these axes. These directions happen to be mutually orthogonal. Apply first an isometry sending these directions to the coordinate axes of On a second move, apply an endomorphism diagonalized along the coordinate axes and stretching or shrinking in each direction, using the semi-axes lengths of as stretching coefficients. The composition then sends the unit-sphere onto an ellipsoid isometric to To define the third and last move, apply an isometry to this ellipsoid to obtain As can be easily checked, the composition coincides with

Example[edit]

Consider the matrix

A singular value decomposition of this matrix is given by

The scaling matrix is zero outside of the diagonal (grey italics) and one diagonal element is zero (red bold, light blue bold in dark mode). Furthermore, because the matrices and are unitary, multiplying by their respective conjugate transposes yields identity matrices, as shown below. In this case, because and are real valued, each is an orthogonal matrix.

This particular singular value decomposition is not unique. Choosing such that

is also a valid singular value decomposition.

SVD and spectral decomposition[edit]

Singular values, singular vectors, and their relation to the SVD[edit]

A non-negative real number is a singular value for if and only if there exist unit-length vectors in and in such that

The vectors and are called left-singular and right-singular vectors for respectively.

In any singular value decomposition

the diagonal entries of are equal to the singular values of The first columns of and are, respectively, left- and right-singular vectors for the corresponding singular values. Consequently, the above theorem implies that:

  • An matrix has at most distinct singular values.
  • It is always possible to find a unitary basis for with a subset of basis vectors spanning the left-singular vectors of each singular value of
  • It is always possible to find a unitary basis for with a subset of basis vectors spanning the right-singular vectors of each singular value of

A singular value for which we can find two left (or right) singular vectors that are linearly independent is called degenerate. If and are two left-singular vectors which both correspond to the singular value σ, then any normalized linear combination of the two vectors is also a left-singular vector corresponding to the singular value σ. The similar statement is true for right-singular vectors. The number of independent left and right-singular vectors coincides, and these singular vectors appear in the same columns of and corresponding to diagonal elements of all with the same value

As an exception, the left and right-singular vectors of singular value 0 comprise all unit vectors in the cokernel and kernel, respectively, of which by the rank–nullity theorem cannot be the same dimension if Even if all singular values are nonzero, if then the cokernel is nontrivial, in which case is padded with orthogonal vectors from the cokernel. Conversely, if then is padded by orthogonal vectors from the kernel. However, if the singular value of exists, the extra columns of or already appear as left or right-singular vectors.

Non-degenerate singular values always have unique left- and right-singular vectors, up to multiplication by a unit-phase factor (for the real case up to a sign). Consequently, if all singular values of a square matrix are non-degenerate and non-zero, then its singular value decomposition is unique, up to multiplication of a column of by a unit-phase factor and simultaneous multiplication of the corresponding column of by the same unit-phase factor. In general, the SVD is unique up to arbitrary unitary transformations applied uniformly to the column vectors of both and spanning the subspaces of each singular value, and up to arbitrary unitary transformations on vectors of and spanning the kernel and cokernel, respectively, of

Relation to eigenvalue decomposition[edit]

The singular value decomposition is very general in the sense that it can be applied to any matrix, whereas eigenvalue decomposition can only be applied to squared diagonalizable matrices. Nevertheless, the two decompositions are related.

If has SVD the following two relations hold:

The right-hand sides of these relations describe the eigenvalue decompositions of the left-hand sides. Consequently:

  • The columns of (referred to as right-singular vectors) are eigenvectors of
  • The columns of (referred to as left-singular vectors) are eigenvectors of
  • The non-zero elements of (non-zero singular values) are the square roots of the non-zero eigenvalues of or

In the special case of being a normal matrix, and thus also squared, the spectral theorem ensures that it can be unitarily diagonalized using a basis of eigenvectors, and thus decomposed as for some unitary matrix and diagonal matrix with complex elements along the diagonal. When is positive semi-definite, will be non-negative real numbers so that the decomposition is also a singular value decomposition. Otherwise, it can be recast as an SVD by moving the phase of each to either its corresponding or The natural connection of the SVD to non-normal matrices is through the polar decomposition theorem: where is positive semidefinite and normal, and is unitary.

Thus, except for positive semi-definite matrices, the eigenvalue decomposition and SVD of while related, differ: the eigenvalue decomposition is where is not necessarily unitary and is not necessarily positive semi-definite, while the SVD is where is diagonal and positive semi-definite, and and are unitary matrices that are not necessarily related except through the matrix While only non-defective square matrices have an eigenvalue decomposition, any matrix has a SVD.

Applications of the SVD[edit]

Pseudoinverse[edit]

The singular value decomposition can be used for computing the pseudoinverse of a matrix. The pseudoinverse of the matrix with singular value decomposition is,

where is the pseudoinverse of , which is formed by replacing every non-zero diagonal entry by its reciprocal and transposing the resulting matrix. The pseudoinverse is one way to solve linear least squares problems.

Solving homogeneous linear equations[edit]

A set of homogeneous linear equations can be written as for a matrix and vector A typical situation is that is known and a non-zero is to be determined which satisfies the equation. Such an belongs to 's null space and is sometimes called a (right) null vector of The vector can be characterized as a right-singular vector corresponding to a singular value of that is zero. This observation means that if is a square matrix and has no vanishing singular value, the equation has no non-zero as a solution. It also means that if there are several vanishing singular values, any linear combination of the corresponding right-singular vectors is a valid solution. Analogously to the definition of a (right) null vector, a non-zero satisfying with denoting the conjugate transpose of is called a left null vector of

Total least squares minimization[edit]

A total least squares problem seeks the vector that minimizes the 2-norm of a vector under the constraint The solution turns out to be the right-singular vector of corresponding to the smallest singular value.

Range, null space and rank[edit]

Another application of the SVD is that it provides an explicit representation of the range and null space of a matrix The right-singular vectors corresponding to vanishing singular values of span the null space of and the left-singular vectors corresponding to the non-zero singular values of span the range of For example, in the above example the null space is spanned by the last row of and the range is spanned by the first three columns of

As a consequence, the rank of equals the number of non-zero singular values which is the same as the number of non-zero diagonal elements in . In numerical linear algebra the singular values can be used to determine the effective rank of a matrix, as rounding error may lead to small but non-zero singular values in a rank deficient matrix. Singular values beyond a significant gap are assumed to be numerically equivalent to zero.

Low-rank matrix approximation[edit]

Some practical applications need to solve the problem of approximating a matrix with another matrix , said to be truncated, which has a specific rank . In the case that the approximation is based on minimizing the Frobenius norm of the difference between and under the constraint that it turns out that the solution is given by the SVD of namely

where is the same matrix as except that it contains only the largest singular values (the other singular values are replaced by zero). This is known as the Eckart–Young theorem, as it was proved by those two authors in 1936 (although it was later found to have been known to earlier authors; see Stewart 1993).

Separable models[edit]

The SVD can be thought of as decomposing a matrix into a weighted, ordered sum of separable matrices. By separable, we mean that a matrix can be written as an outer product of two vectors or, in coordinates, Specifically, the matrix can be decomposed as,

Here and are the -th columns of the corresponding SVD matrices, are the ordered singular values, and each is separable. The SVD can be used to find the decomposition of an image processing filter into separable horizontal and vertical filters. Note that the number of non-zero is exactly the rank of the matrix.[citation needed] Separable models often arise in biological systems, and the SVD factorization is useful to analyze such systems. For example, some visual area V1 simple cells' receptive fields can be well described[1] by a Gabor filter in the space domain multiplied by a modulation function in the time domain. Thus, given a linear filter evaluated through, for example, reverse correlation, one can rearrange the two spatial dimensions into one dimension, thus yielding a two-dimensional filter (space, time) which can be decomposed through SVD. The first column of in the SVD factorization is then a Gabor while the first column of represents the time modulation (or vice versa). One may then define an index of separability

which is the fraction of the power in the matrix M which is accounted for by the first separable matrix in the decomposition.[2]

Nearest orthogonal matrix[edit]

It is possible to use the SVD of a square matrix to determine the orthogonal matrix closest to The closeness of fit is measured by the Frobenius norm of The solution is the product [3] This intuitively makes sense because an orthogonal matrix would have the decomposition where is the identity matrix, so that if then the product amounts to replacing the singular values with ones. Equivalently, the solution is the unitary matrix of the Polar Decomposition in either order of stretch and rotation, as described above.

A similar problem, with interesting applications in shape analysis, is the orthogonal Procrustes problem, which consists of finding an orthogonal matrix which most closely maps to Specifically,

where denotes the Frobenius norm.

This problem is equivalent to finding the nearest orthogonal matrix to a given matrix .

The Kabsch algorithm[edit]

The Kabsch algorithm (called Wahba's problem in other fields) uses SVD to compute the optimal rotation (with respect to least-squares minimization) that will align a set of points with a corresponding set of points. It is used, among other applications, to compare the structures of molecules.

Signal processing[edit]

The SVD and pseudoinverse have been successfully applied to signal processing,[4] image processing[5] and big data (e.g., in genomic signal processing).[6][7][8][9]

Astrodynamics[edit]

In astrodynamics, the SVD and its variants are used as an option to determine suitable maneuver directions for transfer trajectory design[10] and orbital station-keeping.[11]

Other examples[edit]

The SVD is also applied extensively to the study of linear inverse problems and is useful in the analysis of regularization methods such as that of Tikhonov. It is widely used in statistics, where it is related to principal component analysis and to correspondence analysis, and in signal processing and pattern recognition. It is also used in output-only modal analysis, where the non-scaled mode shapes can be determined from the singular vectors. Yet another usage is latent semantic indexing in natural-language text processing.

In general numerical computation involving linear or linearized systems, there is a universal constant that characterizes the regularity or singularity of a problem, which is the system's "condition number" . It often controls the error rate or convergence rate of a given computational scheme on such systems.[12][13]

The SVD also plays a crucial role in the field of quantum information, in a form often referred to as the Schmidt decomposition. Through it, states of two quantum systems are naturally decomposed, providing a necessary and sufficient condition for them to be entangled: if the rank of the matrix is larger than one.

One application of SVD to rather large matrices is in numerical weather prediction, where Lanczos methods are used to estimate the most linearly quickly growing few perturbations to the central numerical weather prediction over a given initial forward time period; i.e., the singular vectors corresponding to the largest singular values of the linearized propagator for the global weather over that time interval. The output singular vectors in this case are entire weather systems. These perturbations are then run through the full nonlinear model to generate an ensemble forecast, giving a handle on some of the uncertainty that should be allowed for around the current central prediction.

SVD has also been applied to reduced order modelling. The aim of reduced order modelling is to reduce the number of degrees of freedom in a complex system which is to be modeled. SVD was coupled with radial basis functions to interpolate solutions to three-dimensional unsteady flow problems.[14]

Interestingly, SVD has been used to improve gravitational waveform modeling by the ground-based gravitational-wave interferometer aLIGO.[15] SVD can help to increase the accuracy and speed of waveform generation to support gravitational-waves searches and update two different waveform models.

Singular value decomposition is used in recommender systems to predict people's item ratings.[16] Distributed algorithms have been developed for the purpose of calculating the SVD on clusters of commodity machines.[17]

Low-rank SVD has been applied for hotspot detection from spatiotemporal data with application to disease outbreak detection.[18] A combination of SVD and higher-order SVD also has been applied for real time event detection from complex data streams (multivariate data with space and time dimensions) in disease surveillance.[19]

Proof of existence[edit]

An eigenvalue of a matrix is characterized by the algebraic relation When is Hermitian, a variational characterization is also available. Let be a real symmetric matrix. Define

By the extreme value theorem, this continuous function attains a maximum at some when restricted to the unit sphere By the Lagrange multipliers theorem, necessarily satisfies

for some real number The nabla symbol, , is the del operator (differentiation with respect to ). Using the symmetry of we obtain

Therefore so is a unit length eigenvector of For every unit length eigenvector of its eigenvalue is so is the largest eigenvalue of The same calculation performed on the orthogonal complement of gives the next largest eigenvalue and so on. The complex Hermitian case is similar; there is a real-valued function of real variables.

Singular values are similar in that they can be described algebraically or from variational principles. Although, unlike the eigenvalue case, Hermiticity, or symmetry, of is no longer required.

This section gives these two arguments for existence of singular value decomposition.

Based on the spectral theorem[edit]

Let be an complex matrix. Since is positive semi-definite and Hermitian, by the spectral theorem, there exists an unitary matrix such that

where is diagonal and positive definite, of dimension , with the number of non-zero eigenvalues of (which can be shown to verify ). Note that is here by definition a matrix whose -th column is the -th eigenvector of , corresponding to the eigenvalue . Moreover, the -th column of , for , is an eigenvector of with eigenvalue . This can be expressed by writing as , where the columns of and therefore contain the eigenvectors of corresponding to non-zero and zero eigenvalues, respectively. Using this rewriting of , the equation becomes:

This implies that

Moreover, the second equation implies .[20] Finally, the unitary-ness of translates, in terms of and , into the following conditions:

where the subscripts on the identity matrices are used to remark that they are of different dimensions.

Let us now define

Then,

since This can be also seen as immediate consequence of the fact that . This is equivalent to the observation that if is the set of eigenvectors of corresponding to non-vanishing eigenvalues , then is a set of orthogonal vectors, and is a (generally not complete) set of orthonormal vectors. This matches with the matrix formalism used above denoting with the matrix whose columns are , with the matrix whose columns are the eigenvectors of with vanishing eigenvalue, and the matrix whose columns are the vectors .

We see that this is almost the desired result, except that and are in general not unitary, since they might not be square. However, we do know that the number of rows of is no smaller than the number of columns, since the dimensions of is no greater than and . Also, since

the columns in are orthonormal and can be extended to an orthonormal basis. This means that we can choose