Skip to content

The singular value decomposition

See every matrix, square or not, as a turn, a stretch along two axes and another turn, with a flip in one of the turns when the matrix flips the plane, and read its rank and subspaces off the pieces.

Helps to know firstSymmetric matrices

Helps to know first
This topic

First, the picture

Every matrix turns a circle into an ellipse. Watch it happen in three moves: a turn, a stretch, and another turn.

A matrix as turn, stretch, turn

A = [3 0; 4 5] sends the unit circle to an ellipse, in three moves.

The unit circle with two perpendicular arrows on it, and a faint ghost of where A sends the circle.

first stretch
6.708
second stretch
2.236
0.00 / 14.80 s
Describe this picture

One panel with the unit circle, a faint grid and two perpendicular arrows on the circle, v1=(1,1)/2\mathbf{v}_1=(1,1)/\sqrt2 and v2=(−1,1)/2\mathbf{v}_2=(-1,1)/\sqrt2. A faint ghost ellipse shows where A=[3045]\mathbf{A}=\begin{bmatrix}3&0\\4&5\end{bmatrix} sends the circle in one step. Over 12 s the circle gets there in three moves of 4 s each. First it turns by −45°, so the two arrows land on the axes. Then the axes are stretched, the first by 6.708 and the second by 2.236, and the circle becomes an upright ellipse. Last the ellipse turns by 71.57° and lands exactly on the ghost. Readouts give the two stretches. One control after the clip: drag either column tip of A\mathbf{A}; the three moves and both stretches are worked out again. When the columns line up, the ellipse flattens to a segment and the second stretch is 0.

A circle becomes an ellipse

Take the matrix A=[3045]\mathbf{A}=\begin{bmatrix}3&0\\4&5\end{bmatrix}. As on A matrix moves the plane, it moves every point of the plane, and the unit circle lands on some curve. For every matrix that curve is an ellipse, or a segment if the matrix flattens the plane.

The picture at the top builds that ellipse in three moves. A turn by −45° (that is, −π/4≈−0.7854-\pi/4\approx-0.7854 rad) brings two special perpendicular arrows onto the axes. A stretch along the axes pulls the circle into an upright ellipse. A second turn, by 71.57°, swings the ellipse into place. Turn, stretch, turn, with a flip in one of the turns when the matrix flips the plane: that is all any matrix does to the plane.

Name the pieces

The two arrows that land on the axes are the right singular vectors, v1\mathbf{v}_1 and v2\mathbf{v}_2. The stretch factors are the singular values, σ1≥σ2≥0\sigma_1\ge\sigma_2\ge0. On this page σ\sigma is a stretch factor, not a standard deviation or the real part of ss. Where each arrow ends up, as a unit vector, is a left singular vector, u1\mathbf{u}_1 or u2\mathbf{u}_2. Together:

Avk=σk uk.\mathbf{A}\mathbf{v}_k=\sigma_k\,\mathbf{u}_k.

Put the vk\mathbf{v}_k as the columns of V\mathbf{V}, the uk\mathbf{u}_k as the columns of U\mathbf{U}, and the σk\sigma_k on the diagonal of Σ\boldsymbol{\Sigma}. Both U\mathbf{U} and V\mathbf{V} have orthonormal columns, as in Orthonormal bases and Gram–Schmidt, so their inverses are their transposes. Then

A=UΣV⊤.\mathbf{A}=\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^\top.

Read it right to left: V⊤\mathbf{V}^\top turns, Σ\boldsymbol{\Sigma} stretches, U\mathbf{U} turns. When the matrix flips the plane, one of the two turns also flips. This is the singular value decomposition, or SVD. These U\mathbf{U} and V\mathbf{V} play the same part as the unitary U\mathbf{U} of the Fourier matrix page and the basis V\mathbf{V} of Independence, basis and dimension: sets of perpendicular directions.

Watch out

Singular values are not eigenvalues. This A\mathbf{A} is triangular, so its eigenvalues are 3 and 5. Its singular values are 6.708 and 2.236. The products agree, 3×5=15=6.708×2.2363\times5=15=6.708\times2.236, because both equal ∣det⁡A∣\lvert\det\mathbf{A}\rvert. The sums do not: 8 against 8.944. Eigenvectors are the directions a matrix keeps; singular vectors are the directions it stretches most and least.

Where the singular values come from

Multiply A\mathbf{A} by its own transpose. With A=UΣV⊤\mathbf{A}=\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^\top and U⊤U=I\mathbf{U}^\top\mathbf{U}=\mathbf{I}:

A⊤A=VΣ⊤Σ V⊤.\mathbf{A}^\top\mathbf{A}=\mathbf{V}\boldsymbol{\Sigma}^\top\boldsymbol{\Sigma}\,\mathbf{V}^\top.

That is the spectral form of Symmetric matrices. So the vk\mathbf{v}_k are the eigenvectors of the symmetric matrix A⊤A\mathbf{A}^\top\mathbf{A}, and its eigenvalues are the squares σk2\sigma_k^2. Once you have vk\mathbf{v}_k and σk\sigma_k, the left vectors follow from uk=Avk/σk\mathbf{u}_k=\mathbf{A}\mathbf{v}_k/\sigma_k.

For our matrix:

A⊤A=[25202025].\mathbf{A}^\top\mathbf{A}=\begin{bmatrix}25&20\\20&25\end{bmatrix}.

Its eigenvalues are 45, along (1,1)(1,1), and 5, along (1,−1)(1,-1). So σ1=45=6.708\sigma_1=\sqrt{45}=6.708 and σ2=5=2.236\sigma_2=\sqrt5=2.236. Then Av1=(3,9)/2\mathbf{A}\mathbf{v}_1=(3,9)/\sqrt2, of length 45\sqrt{45}, gives u1=(1,3)/10\mathbf{u}_1=(1,3)/\sqrt{10}, at 71.57°. With v2=(−1,1)/2\mathbf{v}_2=(-1,1)/\sqrt2, Av2=(−3,1)/2\mathbf{A}\mathbf{v}_2=(-3,1)/\sqrt2 gives u2=(−3,1)/10\mathbf{u}_2=(-3,1)/\sqrt{10}. In matrices:

U=110[1−331],V=12[1−111].\begin{aligned} \mathbf{U}&=\frac1{\sqrt{10}}\begin{bmatrix}1&-3\\3&1\end{bmatrix},\\ \mathbf{V}&=\frac1{\sqrt2}\begin{bmatrix}1&-1\\1&1\end{bmatrix}. \end{aligned}

Both are turns. Each singular vector could also be flipped, together with its partner; the choice of signs is a convention.

Two checks need no vectors. The largest stretch of any unit arrow is σ1\sigma_1, so ∥Ax∥≤σ1∥x∥\lVert\mathbf{A}\mathbf{x}\rVert\le\sigma_1\lVert\mathbf{x}\rVert for every x\mathbf{x}. And the squares of all the entries add up to the squares of the singular values. That sum is the Frobenius norm squared, ∥A∥F2\lVert\mathbf{A}\rVert_\mathrm{F}^2: here 9+0+16+25=50=45+59+0+16+25=50=45+5.

Rank and the four subspaces

Now a matrix that flattens the plane:

[1122].\begin{bmatrix}1&1\\2&2\end{bmatrix}.

Its columns are equal, so every output lies on the line of (1,2)(1,2). Here σ1=10=3.162\sigma_1=\sqrt{10}=3.162 and σ2=0\sigma_2=0: the circle collapses to a segment. The singular vectors hand you all four subspaces of The four fundamental subspaces at once:

  • u1=(1,2)/5\mathbf{u}_1=(1,2)/\sqrt5 spans the column space;
  • u2=(2,−1)/5\mathbf{u}_2=(2,-1)/\sqrt5 spans the left null space;
  • v1=(1,1)/2\mathbf{v}_1=(1,1)/\sqrt2 spans the row space;
  • v2=(1,−1)/2\mathbf{v}_2=(1,-1)/\sqrt2 spans the null space, the direction stretched by 0.

The rank is the number of singular values that are not zero.

A sum of rank-one pieces

Multiply UΣV⊤\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^\top out by columns times rows, as in Matrix multiplication:

A=σ1 u1v1⊤+σ2 u2v2⊤.\mathbf{A}=\sigma_1\,\mathbf{u}_1\mathbf{v}_1^\top+\sigma_2\,\mathbf{u}_2\mathbf{v}_2^\top.

Each piece is a column times a row, a matrix of rank one. For our A\mathbf{A} the pieces are

[1.51.54.54.5]+[1.5−1.5−0.50.5]=[3045].\begin{aligned} &\begin{bmatrix}1.5&1.5\\4.5&4.5\end{bmatrix}+\begin{bmatrix}1.5&-1.5\\-0.5&0.5\end{bmatrix}\\ &\quad=\begin{bmatrix}3&0\\4&5\end{bmatrix}. \end{aligned}

Rebuild from pieces

A as two rank-one pieces, and a 3 × 2 matrix as its three factors.

The first piece, σ_1 u_{1} v_{1}ᵀ with σ_1 = √45: every row a multiple of (1, 1), rank one.

0.00 / 12.00 s
Describe this picture

Two panels of cells, each cell shaded by its number. Above, the two rank-one pieces of A\mathbf{A}, σ1u1v1⊤=[1.51.54.54.5]\sigma_1\mathbf{u}_1\mathbf{v}_1^\top=\begin{bmatrix}1.5&1.5\\4.5&4.5\end{bmatrix} and σ2u2v2⊤=[1.5−1.5−0.50.5]\sigma_2\mathbf{u}_2\mathbf{v}_2^\top=\begin{bmatrix}1.5&-1.5\\-0.5&0.5\end{bmatrix}, appear one after the other, and a third grid fills cell by cell with their sum, [3045]\begin{bmatrix}3&0\\4&5\end{bmatrix}. Below, the 3×23\times2 matrix B=[100111]\mathbf{B}=\begin{bmatrix}1&0\\0&1\\1&1\end{bmatrix} appears, then its three factors: U\mathbf{U} of size 3×33\times3, Σ\boldsymbol{\Sigma} of size 3×23\times2 with 3=1.732\sqrt3=1.732 and 1 on its diagonal, and V⊤\mathbf{V}^\top of size 2×22\times2. There is no control.

The SVD works for any shape. The 3×23\times2 matrix B=[100111]\mathbf{B}=\begin{bmatrix}1&0\\0&1\\1&1\end{bmatrix} of A matrix moves the plane has B⊤B=[2112]\mathbf{B}^\top\mathbf{B}=\begin{bmatrix}2&1\\1&2\end{bmatrix}, with eigenvalues 3 and 1. So σ1=3=1.732\sigma_1=\sqrt3=1.732 and σ2=1\sigma_2=1, with u1=(1,1,2)/6\mathbf{u}_1=(1,1,2)/\sqrt6 and u2=(1,−1,0)/2\mathbf{u}_2=(1,-1,0)/\sqrt2. It turns the flat circle into an ellipse tilted in space.

In signal processing · the Fourier matrix

The DFT as a matrix, in the signal processing course, shows that FHF=NI\mathbf{F}^{\mathsf H}\mathbf{F}=N\mathbf{I}. So F\mathbf{F} stretches every direction by the same amount: all its singular values are N\sqrt N, which is 2 for N=4N=4. The DFT turns a signal and scales it evenly, and loses nothing. Matrix entries count from 1, while DFT indices count from 0.

Worked example

1. The full decomposition. For A=[3045]\mathbf{A}=\begin{bmatrix}3&0\\4&5\end{bmatrix}: A⊤A\mathbf{A}^\top\mathbf{A} has eigenvalues 45 and 5, so σ=6.708\sigma=6.708 and 2.236. AA⊤=[9121241]\mathbf{A}\mathbf{A}^\top=\begin{bmatrix}9&12\\12&41\end{bmatrix} has the same two eigenvalues (trace 50, determinant 225), with eigenvectors (1,3)(1,3) and (−3,1)(-3,1): the left singular vectors. The pieces rebuild A\mathbf{A}, ∥A∥F2=50=45+5\lVert\mathbf{A}\rVert_\mathrm{F}^2=50=45+5, and σ1σ2=15=det⁡A\sigma_1\sigma_2=15=\det\mathbf{A}.

2. Rank one. [1122]=(1,2) (1,1)⊤\begin{bmatrix}1&1\\2&2\end{bmatrix}=(1,2)\,(1,1)^\top, a column times a row: σ1=5⋅2=10\sigma_1=\sqrt5\cdot\sqrt2=\sqrt{10}, σ2=0\sigma_2=0, rank 1.

3. A tall matrix. B\mathbf{B} has σ=3\sigma=\sqrt3 and 1.

4. The Fourier matrix. Every singular value of F\mathbf{F} for N=4N=4 is 2.

Try these before you read the answers.

  • Singular values of 3I3\mathbf{I}? 3 and 3: the circle stays a circle.
  • The longest Ax\mathbf{A}\mathbf{x} for a unit x\mathbf{x}, for the worked A\mathbf{A}? 6.708.
  • A symmetric matrix has eigenvalues 3 and −2-2. Its singular values? 3 and 2: the sign moves into U\mathbf{U} or V\mathbf{V}, which then flips.

Where you’ll meet this

The engine of later pages. Keeping only the large pieces compresses a matrix, in Low-rank approximation. The SVD of a data table finds its main directions, in Principal components. Least-squares routines in software solve through it, in The pseudo-inverse, and the ratio σ1/σ2\sigma_1/\sigma_2 measures how sensitive a system is, in Conditioning.

Recommendations and text. A table of ratings, people by films, is factored by its SVD; the few largest pieces capture tastes. The same is done to tables of words by documents to find topics.

Antenna and microphone arrays. The SVD of an array’s recorded data splits it into a few strong directions, the signals, and many weak ones, the noise.

Reference card

QuantityFormulaNotes
DecompositionA=UΣV⊤\mathbf{A}=\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^\topturn, stretch, turn, with a flip in one turn if the matrix flips the plane; any shape
Singular pairAvk=σkuk\mathbf{A}\mathbf{v}_k=\sigma_k\mathbf{u}_kσ1≥σ2≥⋯≥0\sigma_1\ge\sigma_2\ge\dots\ge0
From A⊤A\mathbf{A}^\top\mathbf{A}eigenvalues σk2\sigma_k^2, eigenvectors vk\mathbf{v}_kAA⊤\mathbf{A}\mathbf{A}^\top gives the uk\mathbf{u}_k
PiecesA=∑kσkukvk⊤\mathbf{A}=\sum_k\sigma_k\mathbf{u}_k\mathbf{v}_k^\topeach piece has rank one
Largest stretch∥Ax∥≤σ1∥x∥\lVert\mathbf{A}\mathbf{x}\rVert\le\sigma_1\lVert\mathbf{x}\rVert
Frobenius norm∥A∥F2=∑kσk2\lVert\mathbf{A}\rVert_\mathrm{F}^2=\sum_k\sigma_k^2sum of squared entries
Determinant∣det⁡A∣=∏kσk\lvert\det\mathbf{A}\rvert=\prod_k\sigma_ksquare matrices
Ranknumber of σk>0\sigma_k>0the zero ones span the null space

Keep reading with a free account.

By creating an account you accept the terms of use.

Sign in

Already have an account? Use the service you signed up with.

Or keep reading: get new lessons by email

Are you 13 or over?

Accounts and email updates are for people aged 13 or over. We keep only your answer, never your date of birth.

End of the lesson

Where to go next.

Phasorium

Account

Sign inKeep your place on any device

Subjects

Site

Look