Tutorials › Linear Algebra › A Complete Two-By-Two SVD Calculation

Singular Value Decomposition · Tutorial 788 of 1000

A Complete Two-By-Two SVD Calculation

Learn a reliable, fully checked procedure for calculating exact SVDs of real two-by-two matrices.

Advanced 11 min read

What You'll Learn

  • Form the Gram matrix and compute its eigenvalues and eigenvectors.
  • Convert positive Gram-matrix eigenvalues into singular values.
  • Normalize the images of right singular vectors to find left singular vectors.
  • Assemble the factors in decreasing singular-value order.
  • Verify an SVD by multiplying its factors and checking orthonormality.

From a Two-by-Two Matrix to Its SVD

For a real matrix \(\mathbf{A}\), the singular value decomposition separates its action into an orthogonal change of input coordinates, a scaling along perpendicular directions, and an orthogonal change of output coordinates. In a two-by-two calculation, the main work is usually finding eigenvalues and eigenvectors of the Gram matrix \(\mathbf{A}^{\top}\mathbf{A}\), then tracking signs and normalization carefully.

Definition: A full singular value decomposition (SVD) of a real two-by-two matrix \(\mathbf{A}\) is a factorization \(\mathbf{A}=\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{\top}\), where \(\mathbf{U}\) and \(\mathbf{V}\) are orthogonal two-by-two matrices and \(\boldsymbol{\Sigma}=\begin{bmatrix}\sigma_1&0\\0&\sigma_2\end{bmatrix}\), with \(\sigma_1\geq\sigma_2\geq0\). The \(\sigma_i\) are the singular values. The columns of \(\mathbf{V}\) are right singular vectors, and the columns of \(\mathbf{U}\) are left singular vectors.

For a nonsingular \(\mathbf{A}\), the eigenvalues of \(\mathbf{A}^{\top}\mathbf{A}\) are positive, and their square roots are the singular values. If \(\mathbf{v}_i\) is a unit eigenvector for eigenvalue \(\lambda_i\), the corresponding left singular vector is \(\mathbf{u}_i=\mathbf{A}\mathbf{v}_i/\sqrt{\lambda_i}\). The eigenvalues and singular values must be paired in the same order: the largest eigenvalue gives the first (largest) singular value.

The following formula makes the eigenvalue step explicit. It applies to any real symmetric two-by-two matrix. Its eigenvalues are the roots of its characteristic equation, obtained by setting the determinant of the matrix minus \(\lambda\mathbf{I}_2\) equal to zero.

Result (Eigenvalues of a symmetric two-by-two matrix): If \(\mathbf{G}=\begin{bmatrix}a&b\\b&d\end{bmatrix}\), its eigenvalues are \(\lambda_{\pm}=\dfrac{a+d\pm\sqrt{(a-d)^2+4b^2}}{2}\).

Proof. Expanding the characteristic determinant gives \(\det(\mathbf{G}-\lambda\mathbf{I}_2)=(a-\lambda)(d-\lambda)-b^2=\lambda^2-(a+d)\lambda+(ad-b^2)\). The quadratic formula gives roots \(\bigl((a+d)\pm\sqrt{(a+d)^2-4(ad-b^2)}\bigr)/2\). The expression under the square root simplifies to \(a^2-2ad+d^2+4b^2=(a-d)^2+4b^2\), which proves the formula. \(\square\)

A Calculation with a Negative Eigenvalue of the Original Matrix

Worked Example: A Symmetric Matrix with Singular Values 3 and 1

Find a full SVD of \(\mathbf{A}=\begin{bmatrix}1&2\\2&1\end{bmatrix}\). First calculate the Gram matrix:

$$ \mathbf{A}^{\top}\mathbf{A} = \begin{bmatrix}1&2\\2&1\end{bmatrix} \begin{bmatrix}1&2\\2&1\end{bmatrix} = \begin{bmatrix}5&4\\4&5\end{bmatrix}. $$

Its characteristic equation is \((5-\lambda)^2-16=0\), so \(5-\lambda=4\) or \(5-\lambda=-4\). Thus the eigenvalues are \(\lambda_1=9\) and \(\lambda_2=1\), in decreasing order. For \(\lambda_1=9\), the equation \((\mathbf{A}^{\top}\mathbf{A}-9\mathbf{I}_2)\mathbf{v}=\mathbf{0}\) gives \(-4v_1+4v_2=0\), so an eigenvector is \((1,1)^{\top}\). For \(\lambda_2=1\), it gives \(4v_1+4v_2=0\), so an eigenvector is \((1,-1)^{\top}\). Both have length \(\sqrt{2}\), giving the unit vectors

$$ \mathbf{v}_1=\frac{1}{\sqrt{2}}\begin{bmatrix}1\\1\end{bmatrix}, \qquad \mathbf{v}_2=\frac{1}{\sqrt{2}}\begin{bmatrix}1\\-1\end{bmatrix}. $$

The singular values are \(\sigma_1=\sqrt{9}=3\) and \(\sigma_2=\sqrt{1}=1\). Applying \(\mathbf{A}\) to the right singular vectors gives

$$ \mathbf{A}\mathbf{v}_1=\frac{1}{\sqrt{2}}\begin{bmatrix}3\\3\end{bmatrix}, \qquad \mathbf{A}\mathbf{v}_2=\frac{1}{\sqrt{2}}\begin{bmatrix}-1\\1\end{bmatrix}. $$

Dividing each image by its singular value produces unit left singular vectors \(\mathbf{u}_1=(1,1)^{\top}/\sqrt{2}\) and \(\mathbf{u}_2=(-1,1)^{\top}/\sqrt{2}\). Therefore

$$ \mathbf{U}=\frac{1}{\sqrt{2}}\begin{bmatrix}1&-1\\1&1\end{bmatrix}, \qquad \boldsymbol{\Sigma}=\begin{bmatrix}3&0\\0&1\end{bmatrix}, \qquad \mathbf{V}^{\top}=\frac{1}{\sqrt{2}}\begin{bmatrix}1&1\\1&-1\end{bmatrix}. $$

Check. Multiplying the first two factors gives \(\frac{1}{\sqrt{2}}\begin{bmatrix}3&-1\\3&1\end{bmatrix}\). Multiplying by \(\mathbf{V}^{\top}\) then gives \(\frac12\begin{bmatrix}3-1&3+1\\3+1&3-1\end{bmatrix}=\begin{bmatrix}1&2\\2&1\end{bmatrix}=\mathbf{A}\). Also, the columns of each of \(\mathbf{U}\) and \(\mathbf{V}\) are unit vectors with dot product zero, so both factors are orthogonal.

Here \(\mathbf{A}\mathbf{v}_2=-\mathbf{v}_2\), but the singular value is positive: \(\sigma_2=1\). The negative sign is carried by the direction of \(\mathbf{u}_2\), not by \(\boldsymbol{\Sigma}\).

Why the Construction Gives a Factorization

The calculations above use a procedure that works for any nonsingular real two-by-two matrix once an orthonormal eigenbasis of its Gram matrix has been found. Earlier material on orthonormal eigenbases establishes that a real symmetric matrix has such a basis; \(\mathbf{A}^{\top}\mathbf{A}\) is symmetric. Here is a direct verification of why the procedure gives the required factors.

Theorem (Gram-matrix construction for a nonsingular two-by-two matrix): Let \(\mathbf{A}\in\mathbb{R}^{2\times2}\) be nonsingular. Suppose \(\mathbf{v}_1,\mathbf{v}_2\) are an orthonormal eigenbasis of \(\mathbf{A}^{\top}\mathbf{A}\), with eigenvalues \(\lambda_1\geq\lambda_2\). Set \(\sigma_i=\sqrt{\lambda_i}\) and \(\mathbf{u}_i=\mathbf{A}\mathbf{v}_i/\sigma_i\). Then \(\mathbf{A}=\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{\top}\), where the columns of \(\mathbf{U}\) are \(\mathbf{u}_1,\mathbf{u}_2\), the columns of \(\mathbf{V}\) are \(\mathbf{v}_1,\mathbf{v}_2\), and \(\boldsymbol{\Sigma}=\operatorname{diag}(\sigma_1,\sigma_2)\).

Proof. First, each eigenvalue is positive. For either eigenvector \(\mathbf{v}_i\ne\mathbf{0}\), \(\lambda_i\mathbf{v}_i^{\top}\mathbf{v}_i=\mathbf{v}_i^{\top}\mathbf{A}^{\top}\mathbf{A}\mathbf{v}_i=(\mathbf{A}\mathbf{v}_i)^{\top}(\mathbf{A}\mathbf{v}_i)>0\), because \(\mathbf{A}\) is nonsingular and hence \(\mathbf{A}\mathbf{v}_i\ne\mathbf{0}\). Thus \(\sigma_i>0\), so the definition of \(\mathbf{u}_i\) is valid. For \(i,j\in\{1,2\}\),

$$ \mathbf{u}_i^{\top}\mathbf{u}_j =\frac{\mathbf{v}_i^{\top}\mathbf{A}^{\top}\mathbf{A}\mathbf{v}_j}{\sigma_i\sigma_j} =\frac{\lambda_j\mathbf{v}_i^{\top}\mathbf{v}_j}{\sigma_i\sigma_j} =\begin{cases}1,&i=j,\\0,&i\ne j.\end{cases} $$

Therefore \(\mathbf{U}\) is orthogonal; \(\mathbf{V}\) is orthogonal because its columns were assumed orthonormal. Also, \(\mathbf{A}\mathbf{v}_i=\sigma_i\mathbf{u}_i\) for each \(i\), so the two columns of \(\mathbf{A}\mathbf{V}\) are exactly the columns of \(\mathbf{U}\boldsymbol{\Sigma}\). Hence \(\mathbf{A}\mathbf{V}=\mathbf{U}\boldsymbol{\Sigma}\). Multiplying on the right by \(\mathbf{V}^{\top}\), and using \(\mathbf{V}\mathbf{V}^{\top}=\mathbf{I}_2\), yields \(\mathbf{A}=\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{\top}\). \(\square\)

A Nonsymmetric Example with Different Left and Right Vectors

Worked Example: Singular Values 3 and 1 with Rotated Output Directions

Consider \(\mathbf{A}=\frac{1}{\sqrt{2}}\begin{bmatrix}-1&1\\3&3\end{bmatrix}\). Its Gram matrix is

$$ \mathbf{A}^{\top}\mathbf{A} =\frac12\begin{bmatrix}-1&3\\1&3\end{bmatrix} \begin{bmatrix}-1&1\\3&3\end{bmatrix} =\frac12\begin{bmatrix}10&8\\8&10\end{bmatrix} =\begin{bmatrix}5&4\\4&5\end{bmatrix}. $$

The characteristic equation is \((5-\lambda)^2-16=0\), with eigenvalues \(9\) and \(1\). Solving the corresponding equations gives unit eigenvectors \(\mathbf{v}_1=(1,1)^{\top}/\sqrt{2}\) and \(\mathbf{v}_2=(1,-1)^{\top}/\sqrt{2}\): the first satisfies \(\begin{bmatrix}5&4\\4&5\end{bmatrix}\mathbf{v}_1=9\mathbf{v}_1\), and the second satisfies \(\begin{bmatrix}5&4\\4&5\end{bmatrix}\mathbf{v}_2=\mathbf{v}_2\). Thus \(\sigma_1=3\) and \(\sigma_2=1\).

Compute the images using the entries of \(\mathbf{A}\):

$$ \mathbf{A}\mathbf{v}_1 =\frac12\begin{bmatrix}-1+1\\3+3\end{bmatrix} =\begin{bmatrix}0\\3\end{bmatrix}, \qquad \mathbf{A}\mathbf{v}_2 =\frac12\begin{bmatrix}-1-1\\3-3\end{bmatrix} =\begin{bmatrix}-1\\0\end{bmatrix}. $$

After division by the corresponding singular values, \(\mathbf{u}_1=(0,1)^{\top}\) and \(\mathbf{u}_2=(-1,0)^{\top}\). The full SVD is

$$ \mathbf{U}=\begin{bmatrix}0&-1\\1&0\end{bmatrix}, \qquad \boldsymbol{\Sigma}=\begin{bmatrix}3&0\\0&1\end{bmatrix}, \qquad \mathbf{V}^{\top}=\frac{1}{\sqrt{2}}\begin{bmatrix}1&1\\1&-1\end{bmatrix}. $$

Check. The product \(\mathbf{U}\boldsymbol{\Sigma}\) is \(\begin{bmatrix}0&-1\\3&0\end{bmatrix}\). Therefore

$$ \mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{\top} =\frac{1}{\sqrt{2}}\begin{bmatrix}-1&1\\3&3\end{bmatrix} =\mathbf{A}. $$

Both \(\mathbf{U}\) and \(\mathbf{V}\) have orthonormal columns: their columns have length \(1\) and dot product \(0\). This example shows why one must calculate the left vectors from \(\mathbf{A}\mathbf{v}_i/\sigma_i\); they need not equal the right vectors.

A Short Example with Coordinate Directions

Worked Example: A Matrix that Swaps the Output Axes

Find an SVD of \(\mathbf{B}=\begin{bmatrix}0&2\\3&0\end{bmatrix}\). Its Gram matrix and eigenpairs are

$$ \mathbf{B}^{\top}\mathbf{B} =\begin{bmatrix}9&0\\0&4\end{bmatrix}, \qquad \lambda_1=9,\ \mathbf{v}_1=\begin{bmatrix}1\\0\end{bmatrix}, \qquad \lambda_2=4,\ \mathbf{v}_2=\begin{bmatrix}0\\1\end{bmatrix}. $$

These right vectors are already unit vectors, and the singular values are \(\sigma_1=3\), \(\sigma_2=2\). Their images are \(\mathbf{B}\mathbf{v}_1=(0,3)^{\top}\) and \(\mathbf{B}\mathbf{v}_2=(2,0)^{\top}\), so the normalized left vectors are \(\mathbf{u}_1=(0,1)^{\top}\) and \(\mathbf{u}_2=(1,0)^{\top}\). Thus \(\mathbf{U}=\begin{bmatrix}0&1\\1&0\end{bmatrix}\), \(\boldsymbol{\Sigma}=\begin{bmatrix}3&0\\0&2\end{bmatrix}\), and \(\mathbf{V}^{\top}=\mathbf{I}_2\). Check: \(\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{\top}=\begin{bmatrix}0&2\\3&0\end{bmatrix}=\mathbf{B}\), and both orthogonal factors have orthonormal columns.

Common Errors and a Reliable Check

Do not confuse eigenvalues with singular values. For the first example, the eigenvalues of \(\mathbf{A}\) itself are \(3\) and \(-1\), but its singular values are \(3\) and \(1\). The singular values come from the square roots of the eigenvalues of \(\mathbf{A}^{\top}\mathbf{A}\), not from the eigenvalues of \(\mathbf{A}\). Using \(-1\) as a diagonal entry of \(\boldsymbol{\Sigma}\) would violate the definition that singular values are nonnegative.

A wrong calculation: in that example, taking \(\mathbf{u}_2=\mathbf{v}_2=(1,-1)^{\top}/\sqrt{2}\) because the matrix is symmetric would give \(\mathbf{A}\mathbf{v}_2=(1,-1)^{\top}/\sqrt{2}\). Direct multiplication instead gives \(\mathbf{A}\mathbf{v}_2=(-1,1)^{\top}/\sqrt{2}\). The correction is to calculate \(\mathbf{u}_2=\mathbf{A}\mathbf{v}_2/\sigma_2=(-1,1)^{\top}/\sqrt{2}\). This sign change is necessary for \(\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^{\top}\) to reproduce \(\mathbf{A}\).

For any proposed full SVD, check three things: the diagonal entries of \(\boldsymbol{\Sigma}\) are nonnegative and decreasing; the columns of \(\mathbf{U}\) and \(\mathbf{V}\) are orthonormal; and direct multiplication gives \(\mathbf{A}\). When constructing the factors from the Gram matrix, also check \(\mathbf{A}^{\top}\mathbf{A}\mathbf{v}_i=\lambda_i\mathbf{v}_i\) and \(\mathbf{A}\mathbf{v}_i=\sigma_i\mathbf{u}_i\). These checks catch incorrect eigenvectors, mismatched ordering, and lost signs.

Check Your Understanding

For each calculation, keep eigenvalue order and singular-value order consistent, and verify proposed factors by multiplication.

  1. For \(\mathbf{A}=\begin{bmatrix}2&0\\0&1\end{bmatrix}\), find \(\mathbf{A}^{\top}\mathbf{A}\), its eigenvalues, and an SVD.
  2. For \(\mathbf{A}=\begin{bmatrix}1&2\\2&1\end{bmatrix}\), explain why the second left singular vector is not the second right singular vector.
  3. For \(\mathbf{G}=\begin{bmatrix}6&2\\2&3\end{bmatrix}\), use the two-by-two eigenvalue formula to find its eigenvalues.
  4. State why \(\mathbf{A}\mathbf{v}_i/\sigma_i\) is defined for a nonsingular \(\mathbf{A}\) when \(\mathbf{v}_i\) is an eigenvector of \(\mathbf{A}^{\top}\mathbf{A}\).
  5. Given proposed factors \(\mathbf{U},\boldsymbol{\Sigma},\mathbf{V}\), list the three checks that establish they form the claimed full SVD.

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon