From the Gram Matrix to an SVD
For a real matrix \(\mathbf{A}\), the matrix \(\mathbf{A}^{\top}\mathbf{A}\) packages information about how \(\mathbf{A}\) acts on vectors in its domain. Its orthonormal eigenvectors provide the right singular vectors of \(\mathbf{A}\), and the square roots of its eigenvalues give the singular values. The remaining task is to turn the images of those right singular vectors into left singular vectors and assemble the factors in the correct order.
Throughout, let \(\mathbf{A}\in\mathbb{R}^{m\times n}\). An SVD, or singular value decomposition, is a factorization \(\mathbf{A}=\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{\top}\), where \(\mathbf{U}\) and \(\mathbf{V}\) are orthogonal matrices and \(\boldsymbol{\Sigma}\) is an \(m\times n\) diagonal-shaped matrix. Orthogonal means that the columns form an orthonormal basis, equivalently \(\mathbf{U}^{\top}\mathbf{U}=\mathbf{I}_m\) and \(\mathbf{V}^{\top}\mathbf{V}=\mathbf{I}_n\). The singular values are the nonnegative diagonal entries of \(\boldsymbol{\Sigma}\), written in decreasing order.
The Gram matrix \(\mathbf{A}^{\top}\mathbf{A}\) is \(n\times n\), symmetric, and positive semidefinite: for every \(\mathbf{x}\in\mathbb{R}^n\), \(\mathbf{x}^{\top}\mathbf{A}^{\top}\mathbf{A}\mathbf{x}=(\mathbf{A}\mathbf{x})^{\top}(\mathbf{A}\mathbf{x})\ge 0\). By the real Spectral Theorem, it has an orthonormal eigenbasis. Also, if \(\mathbf{A}^{\top}\mathbf{A}\mathbf{v}=\lambda\mathbf{v}\) with \(\mathbf{v}\ne\mathbf{0}\), then \(\lambda\|\mathbf{v}\|^2=\|\mathbf{A}\mathbf{v}\|^2\ge0\), so every eigenvalue is nonnegative.
Why the Construction Produces Orthonormal Vectors
Before carrying out the procedure, it is useful to check why dividing the images by their singular values works. Take an orthonormal list of eigenvectors \(\mathbf{v}_1,\dots,\mathbf{v}_r\) of \(\mathbf{A}^{\top}\mathbf{A}\) with positive eigenvalues \(\lambda_i=\sigma_i^2\). Define \(\mathbf{u}_i=\mathbf{A}\mathbf{v}_i/\sigma_i\).
Proof. The equation \(\mathbf{A}\mathbf{v}_i=\sigma_i\mathbf{u}_i\) follows from the definition of \(\mathbf{u}_i\), since \(\sigma_i>0\). For any \(i,j\), use the eigenvector equation and the orthonormality of the \(\mathbf{v}_i\):
If \(i\ne j\), then \(\mathbf{v}_i^{\top}\mathbf{v}_j=0\), so \(\mathbf{u}_i^{\top}\mathbf{u}_j=0\). If \(i=j\), then \(\mathbf{v}_i^{\top}\mathbf{v}_i=1\) and \(\lambda_i=\sigma_i^2\), so \(\mathbf{u}_i^{\top}\mathbf{u}_i=1\). These are exactly the required orthogonality and unit-length conditions. \(\square\)
The division in this definition requires a positive singular value. If \(\lambda=0\), then \(\|\mathbf{A}\mathbf{v}\|^2=0\), which gives \(\mathbf{A}\mathbf{v}=\mathbf{0}\); dividing that image by \(\sqrt{\lambda}=0\) is not allowed. Instead, the left singular vectors not yet constructed are chosen to complete the existing orthonormal list to an orthonormal basis of \(\mathbb{R}^m\). Orthonormal completion in a finite-dimensional real inner-product space can be performed by extending a list to a basis and applying Gram–Schmidt.
A Step-by-Step Procedure
Compute \(\mathbf{G}=\mathbf{A}^{\top}\mathbf{A}\), which is an \(n\times n\) real symmetric matrix.
Choose orthonormal eigenvectors \(\mathbf{v}_1,\dots,\mathbf{v}_n\) and list their eigenvalues in decreasing order, \(\lambda_1\ge\cdots\ge\lambda_n\ge0\).
Set \(\sigma_i=\sqrt{\lambda_i}\). These are nonnegative and remain in decreasing order.
For each \(\sigma_i>0\), compute \(\mathbf{u}_i=\mathbf{A}\mathbf{v}_i/\sigma_i\). The proposition proves these vectors are orthonormal.
Do not divide by a zero singular value. Complete the already constructed left vectors to an orthonormal basis of \(\mathbb{R}^m\).
Put the left vectors into \(\mathbf{U}\), the right vectors into \(\mathbf{V}\), and the singular values on the diagonal of \(\boldsymbol{\Sigma}\). Check the orthogonality of the factors and multiply \(\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{\top}\).
Here is the precise reason this procedure gives the original matrix. Let \(r\) be the number of positive Gram eigenvalues, so \(\sigma_1,\dots,\sigma_r>0\) and the remaining eigenvalues are zero. For \(j>r\), the norm identity gives \(\|\mathbf{A}\mathbf{v}_j\|^2=0\), hence \(\mathbf{A}\mathbf{v}_j=\mathbf{0}\). The constructed \(\mathbf{u}_1,\dots,\mathbf{u}_r\) are orthonormal, so \(r\le m\) and they can be completed to \(m\) orthonormal vectors.
Proof. The positive-eigenvalue vectors constructed as \(\mathbf{u}_i\) are orthonormal by the proposition. For every remaining eigenvector, \(\lambda_j=0\), and \(\|\mathbf{A}\mathbf{v}_j\|^2=\lambda_j\|\mathbf{v}_j\|^2=0\), so \(\mathbf{A}\mathbf{v}_j=\mathbf{0}\). The columns of \(\mathbf{V}\) form an orthonormal basis, and therefore \(\mathbf{I}_n=\sum_{j=1}^n\mathbf{v}_j\mathbf{v}_j^{\top}\). It follows that \(\mathbf{A}=\mathbf{A}\mathbf{I}_n=\sum_{j=1}^n(\mathbf{A}\mathbf{v}_j)\mathbf{v}_j^{\top}=\sum_{i=1}^r\sigma_i\mathbf{u}_i\mathbf{v}_i^{\top}\). In \(\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{\top}\), each positive diagonal entry contributes exactly \(\sigma_i\mathbf{u}_i\mathbf{v}_i^{\top}\); every other diagonal entry is zero, so the completed left vectors contribute nothing further. Thus this product equals the displayed sum and hence equals \(\mathbf{A}\). \(\square\)
Worked Calculations
Worked Example: Distinct Positive Singular Values
Compute an SVD of
The columns have squared lengths \(13/2,13/2,1\), with the first two having inner product \(5/2\); each of the first two has inner product \(0\) with the third. Thus
The first two coordinates give eigenvector \(\mathbf{v}_1=(1,1,0)^{\top}/\sqrt{2}\) with eigenvalue \(9\), and \(\mathbf{v}_2=(1,-1,0)^{\top}/\sqrt{2}\) with eigenvalue \(4\). The third coordinate gives \(\mathbf{v}_3=(0,0,1)^{\top}\) with eigenvalue \(1\). For example, the first two eigenvalue checks are \((13/2+5/2)/\sqrt{2}=9/\sqrt{2}\) and \((13/2-5/2)/\sqrt{2}=4/\sqrt{2}\) in the first coordinate, with the corresponding second coordinates \(9/\sqrt{2}\) and \(-4/\sqrt{2}\). Therefore the singular values are \(3,2,1\).
Apply \(\mathbf{A}\) to the right vectors:
Dividing by \(3,2,1\), respectively, gives \(\mathbf{u}_1=(1,0,0)^{\top}\), \(\mathbf{u}_2=(0,-1,0)^{\top}\), and \(\mathbf{u}_3=(0,0,1)^{\top}\). Hence
Check: Multiplying \(\mathbf{U}\boldsymbol{\Sigma}\) gives \(\begin{bmatrix}3&0&0\\0&-2&0\\0&0&1\end{bmatrix}\). Multiplying this by \(\mathbf{V}^{\top}\) gives rows \((3/\sqrt{2},3/\sqrt{2},0)\), \((-\sqrt{2},\sqrt{2},0)\), and \((0,0,1)\), exactly \(\mathbf{A}\). The columns of both \(\mathbf{U}\) and \(\mathbf{V}\) are orthonormal.
Worked Example: A Zero Singular Value and Left-Basis Completion
For
the columns are \((1,-1,2)^{\top}\), \((1,1,0)^{\top}\), and \(\mathbf{0}\). Their pairwise inner products give \(\mathbf{A}^{\top}\mathbf{A}=\begin{bmatrix}6&0&0\\0&2&0\\0&0&0\end{bmatrix}\). Its standard basis eigenvectors give singular values \(\sqrt{6},\sqrt{2},0\), in that order. The first two left vectors are
For the third left vector, choose \(\mathbf{u}_3=(1,-1,-1)^{\top}/\sqrt{3}\). Its squared length is \((1+1+1)/3=1\). Its inner products with the first two are \((1+1-2)/\sqrt{18}=0\) and \((1-1)/\sqrt{6}=0\). Thus the columns of \(\mathbf{U}=[\mathbf{u}_1\ \mathbf{u}_2\ \mathbf{u}_3]\) are orthonormal. With \(\mathbf{V}=\mathbf{I}_3\), use
Check: The columns of \(\mathbf{U}\boldsymbol{\Sigma}\) are \(\sqrt{6}\mathbf{u}_1=(1,-1,2)^{\top}\), \(\sqrt{2}\mathbf{u}_2=(1,1,0)^{\top}\), and \(\mathbf{0}\). Since \(\mathbf{V}^{\top}=\mathbf{I}_3\), their assembled matrix is exactly \(\mathbf{A}\). No left vector was obtained by dividing by the zero singular value.
Worked Example: A Non-Diagonal Gram Matrix
Let \(\mathbf{A}\) have columns \(\mathbf{c}_1=(1,0,1)^{\top}\), \(\mathbf{c}_2=(0,1,1)^{\top}\), and \(\mathbf{c}_3=(1,1,2)^{\top}\). Computing the six distinct column inner products gives
Direct multiplication shows that \(\mathbf{v}_1=(1,1,2)^{\top}/\sqrt{6}\), \(\mathbf{v}_2=(1,-1,0)^{\top}/\sqrt{2}\), and \(\mathbf{v}_3=(-1,-1,1)^{\top}/\sqrt{3}\) are eigenvectors with eigenvalues \(9,1,0\). For instance, the matrix sends \((1,1,2)^{\top}\) to \((9,9,18)^{\top}\), sends \((1,-1,0)^{\top}\) to \((1,-1,0)^{\top}\), and sends \((-1,-1,1)^{\top}\) to \(\mathbf{0}\). The three vectors are unit and pairwise orthogonal, so \(\mathbf{V}=[\mathbf{v}_1\ \mathbf{v}_2\ \mathbf{v}_3]\) is orthogonal. The singular values are \(3,1,0\).
Applying \(\mathbf{A}\) gives \(\mathbf{A}\mathbf{v}_1=3\mathbf{v}_1\), \(\mathbf{A}\mathbf{v}_2=\mathbf{v}_2\), and \(\mathbf{A}\mathbf{v}_3=\mathbf{0}\). Therefore take \(\mathbf{U}=\mathbf{V}\) and \(\boldsymbol{\Sigma}=\operatorname{diag}(3,1,0)\). To check the product, its nonzero terms are \(3\mathbf{v}_1\mathbf{v}_1^{\top}+\mathbf{v}_2\mathbf{v}_2^{\top}\):
This verifies \(\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{\top}=\mathbf{A}\), including the zero contribution from the third singular value.
Common Mistakes to Avoid
Using an eigenvalue as the singular value. In the last example, the largest Gram eigenvalue is \(9\), but the corresponding singular value is \(\sqrt{9}=3\), not \(9\). If one incorrectly places \(9\) on the diagonal and uses the same left and right vectors, the first rank-one term becomes \(9\mathbf{v}_1\mathbf{v}_1^{\top}\) instead of \(3\mathbf{v}_1\mathbf{v}_1^{\top}\); it does not reproduce \(\mathbf{A}\).
Dividing by zero. If \(\lambda_i=0\), then \(\mathbf{A}\mathbf{v}_i=\mathbf{0}\), but \(\mathbf{A}\mathbf{v}_i/\sqrt{\lambda_i}\) is undefined. Complete the left orthonormal basis using vectors orthogonal to those already found. Then check the resulting columns directly, as in the second example.
Checking only the factor sizes is not enough. A proposed SVD also requires orthonormal columns in \(\mathbf{U}\) and \(\mathbf{V}\), correct square roots on the diagonal, and a product equal to the original matrix. Multiplying the factors back is a direct way to catch sign, ordering, or scaling errors.
Check Your Understanding
For each question, use the Gram-matrix procedure and check any proposed factors by multiplication.
- For \(\mathbf{A}=\begin{bmatrix}1&0\\0&2\end{bmatrix}\), find the eigenvalues of \(\mathbf{A}^{\top}\mathbf{A}\) and the singular values.
- Explain why a unit eigenvector \(\mathbf{v}\) with eigenvalue \(0\) satisfies \(\mathbf{A}\mathbf{v}=\mathbf{0}\).
- If \(\mathbf{A}^{\top}\mathbf{A}\mathbf{v}=16\mathbf{v}\) and \(\|\mathbf{v}\|=1\), what is the singular value, and how is its left singular vector computed?
- For the matrix in the second worked example, verify directly that the three columns of \(\mathbf{U}\) are pairwise orthogonal.
- Why is completing the left singular vectors necessary when a positive singular value has already supplied fewer than \(m\) orthonormal vectors?