Linear Algebra, Live
Strang §7.2 · Bases and matrices in the SVD

Finding singular values from AᵀA

Slide 1 found the long and short directions of the ellipse by guessing. Now we find them with a recipe. Think of a tailor measuring a sleeve: you don't need to guess the longest stretch of a piece of cloth if you have a tape measure that reads it for you. Here the tape measure is the matrix AᵀA. It is symmetric, so lesson 7 says its eigenvectors are perpendicular. Those eigenvectors are exactly the input directions v₁, v₂. Its eigenvalues are the squared stretches σ₁², σ₂². Take square roots and you have the singular values. Then each output direction is u = Av / σ.

Lesson 8 · slide 2Singular values
AᵀA vᵢ = σᵢ² vᵢ    σᵢ = √(i-th eigenvalue of AᵀA)    uᵢ = Avᵢ / σᵢ
Key ideas
  1. Write ΣᵀΣ for the square diagonal matrix with σ₁², σ₂², … on its diagonal (Σᵀ is Σ with rows and columns swapped). Then AᵀA = V(ΣᵀΣ)Vᵀ. So the eigenvectors of AᵀA are the vᵢ and its eigenvalues are σᵢ².
  2. So σᵢ = √(eigenvalue of AᵀA). These eigenvalues are never negative.
  3. The output directions are uᵢ = Avᵢ/σᵢ, automatically perpendicular and of length 1.
  4. Similarly AAᵀ = UΣVᵀVΣᵀUᵀ = U(ΣΣᵀ)Uᵀ, so AAᵀ has eigenvectors uᵢ and the same nonzero eigenvalues σᵢ².

Measure the stretch, then take the root

How much does A stretch a unit vector v? Its squared length is a dot product of Av with itself:

‖Av‖² = (Av)ᵀ(Av) = vᵀ(AᵀA)v

So all the stretching is stored in AᵀA. A small check with slide 1's matrix, for v = 10:

A = 2−211:   Av = 21,   ‖Av‖² = 4 + 1 = 5
AᵀA = 5−3−35:   vᵀ(AᵀA)v = top-left entry = 5 ✓   (because v = 10 picks out row 1, column 1)

AᵀA is symmetric, since (AᵀA)ᵀ = AᵀA. So its eigenvectors are perpendicular (lesson 7). For a unit eigenvector v with eigenvalue λ, vᵀAᵀAv = vᵀ(λv) = λ‖v‖² = λ, and this equals ‖Av‖². So λ is never negative, and √λ is the stretch along v.

Aᵀ times A. Each entry is a row of Aᵀ (a column of A) dotted with a column of A. The answer is symmetric: the −3 appears twice.

Why the eigenvectors of AᵀA are the right v's

If A has an SVD at all, A = UΣVᵀ, then AᵀA must look like this:

A = UΣVᵀ,   so Aᵀ = VΣᵀUᵀ
AᵀA = VΣᵀUᵀUΣVᵀ = V(ΣᵀΣ)Vᵀ,   because UᵀU = I
This is QΛQᵀ from lesson 7 with Q = V and Λ = ΣᵀΣ = diag(σ₁², σ₂², …). (Σ is rectangular when A is, so we write ΣᵀΣ, a square diagonal matrix.)

So the eigenvectors of AᵀA give V, and the roots of its eigenvalues give the σ's. Then uᵢ = Avᵢ/σᵢ for each nonzero σᵢ. (If σᵢ = 0, there is no Avᵢ/σᵢ. In that case, or if A is tall so U needs more columns than there are σ's, add perpendicular unit vectors until U is square, for example by Gram-Schmidt (lesson 5); any such choice works.) For 2 by 2, σ₁σ₂ = |det A|, because turns don't change area.

Why the u's come out perpendicular

Slide 1 promised this. Take two different directions vᵢ and vⱼ. They are perpendicular eigenvectors of AᵀA, and AᵀAvⱼ = σⱼ²vⱼ. So

uᵢ · uⱼ = (Avᵢ) · (Avⱼ) / (σᵢσⱼ) = vᵢᵀAᵀAvⱼ / (σᵢσⱼ) = σⱼ² (vᵢ · vⱼ) / (σᵢσⱼ) = 0,   because vᵢ · vⱼ = 0
With i = j the same steps give uᵢ · uᵢ = σᵢ² · 1 / σᵢ² = 1: each u has length 1

So the u's are perpendicular unit vectors, and U is orthogonal, just like V. This is why the recipe always works: AᵀA is symmetric, so lesson 7 always gives perpendicular v's, and then the u's follow.

The recipe, worked through

A = 2−211 (slide 1),   AᵀA = 5−3−35
trace 10, det 25 − 9 = 16:   λ² − 10λ + 16 = (λ − 8)(λ − 2),   λ = 8 and 2
σ₁ = √8 = 2√2 with v₁ = 1−1/√2,   σ₂ = √2 with v₂ = 11/√2 ✓ (as found by turning v on slide 1)
u₁ = Av₁/σ₁ = 2√20/(2√2) = 10,   u₂ = 0√2/√2 = 01
Check: σ₁σ₂ = 2√2 · √2 = 4 = |det A| = |2 + 2| ✓
From AᵀA to Σ. Subtract each eigenvalue from the diagonal: the matrix becomes singular, and its nullspace gives v = 1−1 for λ = 8 and v = 11 for λ = 2. Then take square roots.

Not the eigenvalues of A

For a symmetric matrix with positive eigenvalues, singular values and eigenvalues match. In general they don't. Take the shear from the code below:

A = 1101:   both eigenvalues are 1
AᵀA = 1112:   trace 3, det 1,   eigenvalues of AᵀA: (3 ± √5)/2 ≈ 2.618 and 0.382
σ₁ = √2.618 ≈ 1.618,   σ₂ = √0.382 ≈ 0.618.   Check: 1.618 · 0.618 ≈ 1 = det A ✓
The shear. v₁ is stretched to length 1.618, v₂ shrinks to 0.618, and they land perpendicular. The eigenvalues (both 1) hide all of this.

Singular values give the largest and smallest stretch overall. Eigenvalues only describe the special directions that stay on their own line.

Keep reading with the full course

Finish lesson 8 and you will be able to: compress an image and keep only what matters.

Still locked here:

  • The rest of this explanation
  • 4 more examples with step-by-step solutions
  • Five extra members-only problems with worked solutions

$20 once, lifetime access. Lessons 1 to 3 stay free.

Examples

Example 1 · A diagonal matrix with a negative entry

A = −3002.

Show solutionHide solution
AᵀA = 9004:   σ₁ = 3, σ₂ = 2
The minus sign goes into U as a mirror: σ's are never negative
Exercise Fix the code so that sigma holds the singular values of the shear A. Edit the code and press Run.
slide_2.py Loading Python…
1
Output · Ctrl+Enter runs
Press Run to execute this slide's code. Ctrl+Enter works too.

Questions and comments

Stuck on something, or found a mistake? Ask here and I'll answer. You sign in with GitHub.

The full course

From Ax = b to PCA, by running it

Lessons 1 to 3 are free. Finish all eight and you will be able to:

You get: all 8 lessons with Python labs · every worked example and solution · 5 extra problems per lesson · your progress tracked · answers to your questions · every future update.

$20 once · lifetime access
Continue to checkout →

Already a member? Log in to the course