Skip to content
Glacius
Linear algebraConcept reference

Singular value decomposition

A supplied real SVD writes a matrix action as input coordinates, nonnegative axial scaling, then output coordinates.

On this page 9 sections
  1. Overview
  2. Singular value decomposition, or SVD, describes what a matrix does to vectors
  3. U and V are orthogonal: they preserve lengths and angles, and may rotate or reflect
  4. Sometimes a problem gives the output basis columns instead of an action rule
  5. A closer look
  6. Key takeaway
  7. Further questions
  8. Sources & further reading
  9. Concept connections

01Singular value decomposition, or SVD, describes what a matrix does to vectors#

Singular value decomposition, or SVD, describes what a matrix does to vectors. A matrix may mix coordinates so its individual entries hide which directions it stretches or loses. SVD separates that action into a change of coordinates, a stretch along perpendicular axes, and a change to output coordinates.

Imagine a two-input sensor whose outputs mix both measurements. SVD finds perpendicular input directions that the sensor handles separately. Each has a matching output direction and a nonnegative stretch factor. A large factor means a strong response along that direction; a zero factor means that direction disappears.

The factorization is A=UΣVTA=U\Sigma V^T. The columns of VV are input directions; VTV^T measures a vector along them. The diagonal entries of Σ\Sigma are the singular values, written σi\sigma_i. The columns of UU are output directions. Here the factors are supplied: you will follow their action, rather than calculate a factorization from scratch.

Matrix products act on a vector from the right. First calculate c=VTxc=V^Tx, then d=Σcd=\Sigma c, then y=Udy=Ud. These are three different coordinate lists. Writing each one down prevents a common mistake: treating the scaled internal coordinates dd as the final output yy.

In the example ahead, VT(a,b)=(b,a)V^T(a,b)=(b,-a) means “put the second input first, then negate the first.” For x=(1,2)x=(1,2), substitute a=1,b=2a=1,b=2, giving c=(2,1)c=(2,-1). The letters a,ba,b are placeholders; use the newest pair at every stage.

Start A=UΣVTA=U\Sigma V^T with VTV^T. It gives right-singular coordinates. For x=(1,2)x=(1,2) and VT(a,b)=(b,a)V^T(a,b)=(b,-a), these are (2,1)(2,-1).

SVD stages for this example: input (1,2), right coordinates (2,−1), scaled coordinates (6,−1), output (1,6). V transpose and U preserve lengths; Sigma stretches the first coordinate by 3. All four panels use the same 13 pixels per coordinate unit.SVD stages for this example: input (1,2), right coordinates (2,−1), scaled coordinates (6,−1), output (1,6). V transpose and U preserve lengths; Sigma stretches the first coordinate by 3. All four panels use the same 13 pixels per coordinate unit.
Figure 1SVD stages for this example: input (1,2), right coordinates (2,−1), scaled coordinates (6,−1), output (1,6). V transpose and U preserve lengths; Sigma stretches the first coordinate by 3. All four panels use the same 13 pixels per coordinate unit.
Link to this figure ↗Download SVGDownload PNG

Continue with right coordinates (2,1)(2,-1). Scales (3,1)(3,1) give (6,1)(6,-1). Then U(a,b)=(b,a)U(a,b)=(-b,a) turns those into output (1,6)(1,6).

Ax=(1,6)Ax=(1,6)

Follow the complete example again: x=(1,2)x=(1,2) becomes c=(2,1)c=(2,-1). Scaling by (3,1)(3,1) gives d=(3×2,1×(1))=(6,1)d=(3\times2,1\times(-1))=(6,-1). Finally U(a,b)=(b,a)U(a,b)=(-b,a) gives y=((1),6)=(1,6)y=(-(-1),6)=(1,6). Each factor consumes the previous result, never the original input again.

Check your reasoning

SVD: VT(a,b)=(b,a)V^T(a,b)=(b,-a); Σ(a,b)=(2a,b)\Sigma(a,b)=(2a,b); U(a,b)=(a,b)U(a,b)=(a,-b). Input (2,3)(2,3). Output?

  1. A(3,4)(-3,-4)
  2. B(6,2)(6,2)
  3. C(3,2)(3,2)
Show answer and explanation
(6,2)(6,2)

c=(3,2)c=(3,-2); output (6,2)(6,2).

02U and V are orthogonal: they preserve lengths and angles, and may rotate or reflect#

UU and VV are orthogonal: they preserve lengths and angles, and may rotate or reflect. Σ\Sigma scales along coordinate axes; a zero scale erases that coordinate. Apply these actions in their supplied order.

Ax=U(Σ(VTx))Ax=U\bigl(\Sigma(V^Tx)\bigr)
Check your reasoning

SVD: VT(a,b)=(a,b)V^T(a,b)=(-a,b); Σ(a,b)=(4a,b)\Sigma(a,b)=(4a,b); U(a,b)=(b,a)U(a,b)=(b,a). Input (1,2)(1,2). Using UU first gave (8,1)(-8,1). Repair.

  1. A(2,4)(2,-4)
  2. B(8,1)(-8,1)
  3. C(2,1)(2,-1)
Show answer and explanation
(2,4)(2,-4)

First: c=(1,2)c=(-1,2).

03Sometimes a problem gives the output basis columns instead of an action rule#

Sometimes a problem gives the output basis columns instead of an action rule. If UU has columns u1,u2u_1,u_2, then U(d1,d2)=d1u1+d2u2U(d_1,d_2)=d_1u_1+d_2u_2. Multiply each entire column by its matching coefficient, then add matching entries. This is the column-combination view of matrix multiplication you already learned.

For c=(1,2)c=(1,-2) and singular values (4,1)(4,1), first get d=(4,2)d=(4,-2). With u1=(0,1)u_1=(0,1) and u2=(1,0)u_2=(-1,0), the contributions are 4u1=(0,4)4u_1=(0,4) and 2u2=(2,0)-2u_2=(2,0). Adding gives (2,4)(2,4). The pair (4,2)(4,-2) was a pair of weights, not the answer in the original output axes.

Right coordinates can be supplied directly. For c=(1,2)c=(1,-2), scales (4,1)(4,1) give (4,2)(4,-2). With u1=(0,1)u_1=(0,1) and u2=(1,0)u_2=(-1,0), return to output coordinates by combining these basis vectors.

4u12u2=(2,4)4u_1-2u_2=(2,4)
Check your reasoning

Right coordinates (2,1)(2,-1); scales (3,1)(3,1). Left basis: u1=(0,1)u_1=(0,1), u2=(1,0)u_2=(1,0). Output?

  1. A(6,1)(6,-1)
  2. B(1,2)(-1,2)
  3. C(1,6)(-1,6)
Show answer and explanation
(1,6)(-1,6)

d=(6,1)d=(6,-1) give (1,6)(-1,6).

04A closer look#

In a data matrix, this separation lets us describe strong patterns with a few direction pairs. Later lessons keep the largest components to compress a matrix and use input directions to build PCA features. Reading the three factors now makes those methods interpretable instead of turning them into unexplained formulas.

The small problems use square, two-dimensional factors so every step is visible. SVD also works for rectangular matrices: the input and output spaces can have different sizes. A full real factorization of an m×nm\times n matrix uses VTV^T of size n×nn\times n, Σ\Sigma of size m×nm\times n, and UU of size m×mm\times m.

Key takeaway

Read right to left: use V-transpose for input coordinates, Sigma for their scales, and U for output coordinates.

  • Interpret the three transformations in a supplied SVD.

Further questions

How do the singular scales reveal rank?
Each nonzero singular scale preserves one independent direction. Counting them gives the exact rank.

Sources & further reading

  1. [1]
  2. [2]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Singular value decomposition.” Math behind ML. /learn/la-svd