Skip to content
Glacius
Linear algebraConcept reference

Truncated SVD

A rank-k truncated SVD is the sum of the k leading weighted singular-vector outer products.

On this page 9 sections
  1. Overview
  2. A large matrix can contain patterns that repeat across many entries
  3. Keep large components, not small ones
  4. To keep two components, add both weighted matrices
  5. Explore the visual intuition
  6. Key takeaway
  7. Further questions
  8. Sources & further reading
  9. Concept connections

01A large matrix can contain patterns that repeat across many entries#

A large matrix can contain patterns that repeat across many entries. Truncated SVD stores an approximation using only the strongest patterns. Each retained component has one pattern across rows, one across columns, and a strength. Their outer product fills a whole matrix.

For an image, entries can be brightness values. A few components may reproduce broad structure while omitting detail. For other matrices, entries might be measurements rather than pixels. This lesson reconstructs a matrix from supplied components; computing those components is a separate numerical task.

An SVD writes a matrix as weighted rank-one pieces. A rank-kk truncation keeps the kk largest singular scales and their matched vector pairs. Each retained piece contributes a whole matrix.

Ak=i=1kσiuiviTA_k=\sum_{i=1}^{k}\sigma_i u_i v_i^T

For leading scale 5, u=(0.6,0.8)u=(0.6,0.8) and v=(1,0)v=(1,0), compute every product 5uivj5u_iv_j. The first column is (3,4)(3,4) and the second is zero.

Leading scale 5, unit u=(0.6,0.8), unit v=(1,0). The rank-one outer product has rows (3,0) and (4,0).Leading scale 5, unit u=(0.6,0.8), unit v=(1,0). The rank-one outer product has rows (3,0) and (4,0).
Figure 1Leading scale 5, unit u=(0.6,0.8), unit v=(1,0). The rank-one outer product has rows (3,0) and (4,0).
Link to this figure ↗Download SVGDownload PNG

Build a rank-one term in two steps. For u=(0.6,0.8)u=(0.6,0.8) and v=(1,0)v=(1,0), the outer product has first row (0.6×1,0.6×0)=(0.6,0)(0.6\times1,0.6\times0)=(0.6,0) and second row (0.8,0)(0.8,0). Multiplying every entry by the singular value 5 gives rows (3,0)(3,0) and (4,0)(4,0). Do not multiply only the diagonal.

Check your reasoning

Leading singular scale 55, u=(0,1)u=(0,1), v=(0.8,0.6)v=(0.8,0.6). Other scales are smaller. Give rank-1 approximation rows.

  1. A(0,0)(0,0); (0.8,0.6)(0.8,0.6)
  2. B(0,0)(0,0); (4,3)(4,3)
  3. C(0,4)(0,4); (0,3)(0,3)
Show answer and explanation
(0,0)(0,0); (4,3)(4,3)

Each entry is 5uivj5u_iv_j.

02Keep large components, not small ones#

Keep large components, not small ones. If scales are 6 and 2, the rank-1 truncation keeps 6u1v1T6u_1v_1^T. Keeping the other term is a different matrix, even though it also has rank 1.

Check your reasoning

Scales (4,1)(4,1); u1=(1,0)u_1=(1,0), v1=(0,1)v_1=(0,1); u2=(0,1)u_2=(0,1), v2=(1,0)v_2=(1,0). Claim: keep term 2 for rank 1. Repair rows.

  1. A(0,0)(0,0); (1,0)(1,0)
  2. B(0,1)(0,1); (0,0)(0,0)
  3. C(0,4)(0,4); (0,0)(0,0)
Show answer and explanation
(0,4)(0,4); (0,0)(0,0)

Keep scale 44: 4u1v1T4u_1v_1^T.

03To keep two components, add both weighted matrices#

To keep two components, add both weighted matrices. If unit outer products have rows C1:(1,0);(0,0)C_1:(1,0);(0,0) and C2:(0,0);(0,1)C_2:(0,0);(0,1), scales (5,2)(5,2) give rows (5,0);(0,2)(5,0);(0,2). Keeping every nonzero component recovers the original matrix.

For two components, make two weighted matrices before adding. If C1C_1 has rows (1,0);(0,0)(1,0);(0,0) and C2C_2 has rows (0,0);(0,1)(0,0);(0,1), then 5C15C_1 and 2C22C_2 have rows (5,0);(0,0)(5,0);(0,0) and (0,0);(0,2)(0,0);(0,2). Entrywise addition gives (5,0);(0,2)(5,0);(0,2). Keep each scale paired with its own two vectors.

Check your reasoning

Two leading scales (3,2)(3,2). Unit outer-product rows: C1C_1: (0,1)(0,1); (0,0)(0,0); C2C_2: (0,0)(0,0); (1,0)(-1,0). Keep both: rows?

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

Sum 3C1+2C23C_1+2C_2.

04Explore the visual intuition#

Truncating to the largest singular values gives a best approximation of rank at most kk in Frobenius norm. A small matrix error is useful for compression, but does not guarantee that the lost detail is unimportant for a particular prediction task. The next lesson measures exactly how much squared matrix error was discarded.

Two four-by-four grayscale images on the same brightness scale. The rank-two original has intensities 0.75 and 0.25 in an alternating pattern; keeping only its leading singular component gives uniform 0.5. The singular values are 2 and 1.
This exact synthetic image loses its contrast pattern when only the leading component is kept. Rank 1 retains broad brightness, while discarding a whole structured component.Original Glacius illustration; synthetic data, no external image.
Key takeaway

Keep the largest singular scales and matched vector pairs. Add their weighted outer products entry by entry.

  • Construct a rank-k approximation from supplied singular components.

Further questions

How much matrix information was discarded?
For Frobenius error, square the discarded singular values, sum them, and take the square root. The next lessons separate the matrix norm from this truncation rule.

Sources & further reading

  1. [1]

Reference this concept

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

Glacius. “Truncated SVD.” Math behind ML. /learn/la-truncated-svd