4.5.40 · D4Linear Algebra (Full)

Exercises — Singular Value Decomposition (SVD) — full derivation

2,809 words13 min readBack to topic

Level 1 — Recognition

L1.1 — Shapes of the three factors

is . Write the exact dimensions of , , and in the SVD .

Recall Solution

acts on the output space , so is . acts on the input space , so is . must map so the product is — so is . Answer: is , is , is .

L1.2 — Reading singular values off a spectrum

The eigenvalues of are . List the singular values of in the correct (non-increasing) order, and state the rank .

Recall Solution

Singular values are where are eigenvalues of (never of ). . Ordered: . Rank = number of strictly positive singular values .

L1.3 — Which vectors span the null space?

Given for a matrix with right singular vectors , which form an orthonormal basis for the null space of ?

Recall Solution

The null space of is . From the derivation, , so exactly when . Here , so span the null space.


Level 2 — Application

L2.1 — Full SVD of a diagonal-ish matrix

Find an SVD of .

Recall Solution

Step A — form (our safe gateway): Step B — eigenvalues: already diagonal, so , giving (ordered largest first). Step C — right singular vectors (eigenvectors of ): (for ), (for ). So . Step D — left singular vectors via (this locks in the sign): So Check: ✓ Notice the minus sign got absorbed into — singular values stay positive.

L2.2 — A pure stretch (already symmetric PSD)

Find the SVD of . Then reorder so singular values are non-increasing.

Recall Solution

, eigenvalues , so . The largest singular value is , matching the axis, so we must reorder so points along : , giving . Check: . ✓

L2.3 — Singular values of a row

Find the singular value(s) of .

Recall Solution

Here . Form (the route is ): Eigenvalues solve , so or . , and (but is , so it only holds one diagonal entry: ). Sanity check: for a single row, the only singular value equals the length of that row: . ✓


Level 3 — Analysis

L3.1 — Rank-1, non-square

Find a full SVD of ().

Recall Solution

Step A: Step B — eigenvalues: , so . Thus , and rank (the rows/columns are proportional). Step C — right singular vectors: : solve , normalised . : , so . Step D — left singular vectors: Check . ✓ Extend to an orthonormal basis of (e.g. via Gram-Schmidt Process): .

Figure — Singular Value Decomposition (SVD) — full derivation

L3.2 — The four fundamental subspaces from an SVD

Using the SVD from L3.1, write down orthonormal bases for the column space, row space, null space, and left null space of .

Recall Solution

With rank , split the singular vectors at index (see Four Fundamental Subspaces):

  • Column space () .
  • Left null space () .
  • Row space () .
  • Null space () . Notice column space ⟂ left null space in , and row space ⟂ null space in — SVD hands you the orthogonal splitting for free.

L3.3 — Frobenius norm from singular values

Verify for the L3.1 matrix that , where (the "Frobenius" length of a matrix, treating it as a long vector of its entries).

Recall Solution

Direct sum of squares: . Singular-value side: . Equal. ✓ Why this always holds: and are rotations/reflections, which never change lengths, so the total squared "size" of is stored entirely in , i.e. in the .


Level 4 — Synthesis

L4.1 — Best rank-1 approximation

For (from L3.1), write the best rank-1 approximation and confirm it recovers exactly. Explain why.

Recall Solution

The Eckart–Young theorem says the best rank- approximation (in Frobenius norm) is . Here : Why exact? already has rank (), so its rank-1 approximation loses nothing. The approximation error equals .

L4.2 — Pseudoinverse via SVD

Build the pseudoinverse of the L3.1 matrix, where inverts each nonzero and transposes the shape.

Recall Solution

is . Invert nonzero entries and transpose to : Then . Multiply: has first row . Multiplying: Check : since is the "undo where possible" map, applying , then , then returns . (Verified numerically in the checks below.)

L4.3 — Connect to PCA

A data matrix (rows = samples, columns = features, already mean-centred) has singular values . Explain what the right singular vectors and the values mean in Principal Component Analysis (PCA), and how relates to variance.

Recall Solution

The covariance-like matrix is (up to a factor ). Its eigenvectors are exactly the — the principal component directions. Its eigenvalues are . So:

  • = the -th principal axis (the direction of the -th most spread in the data).
  • = the variance of the data projected onto .
  • The fraction of total variance captured by the first components is . This is why SVD of the data matrix is PCA — no covariance matrix needs to be formed explicitly (and it is numerically safer not to).

Level 5 — Mastery

L5.1 — Prove and share singular values

Show that and have exactly the same nonzero singular values.

Recall Solution

Start from . Transpose both sides (using and ): This is a valid SVD of : and are orthogonal, and is the (transposed-shape) diagonal matrix carrying the same diagonal entries . Because singular values are uniquely determined by the matrix, the nonzero diagonal entries of — which equal those of — are the singular values of . Hence and share the same nonzero singular values. (The roles of left/right singular vectors simply swap.)

L5.2 — Largest singular value = operator norm

Prove that : the top singular value is the largest stretch can apply to any unit vector.

Recall Solution

Write any unit vector in the -basis: with (since the are orthonormal, ). Apply using : The are orthonormal, so Since for all : So for every unit , and the bound is hit by (then , rest , giving ). Therefore .

Figure — Singular Value Decomposition (SVD) — full derivation

L5.3 — Symmetric matrices: singular values vs eigenvalues

Let be symmetric with eigenvalues (possibly negative). Prove that the singular values of are , and pin down exactly when .

Recall Solution

By the Spectral Theorem, with orthogonal and . Compute (since ): using . So has eigenvalues . Singular values: . When do they coincide? exactly when for all — i.e. when is positive semi-definite. If any eigenvalue is negative, its singular value flips sign and the corresponding singular vector absorbs a (into , as we saw in L2.1).

L5.4 — Determinant from singular values

For a square , prove , and explain the geometric meaning.

Recall Solution

Take determinants of . Determinant is multiplicative: . orthogonal (rotations give , reflections ). (product of the diagonal). Taking absolute values kills the : Geometry: is the factor by which scales volumes. Rotations/reflections () preserve volume; only the stretches change it. So the volume scaling is the product of the stretches — exactly . If any , the volume collapses and .


[!recall]- Self-test summary

Which matrix do we always eigen-decompose first, and why is it safe?
— symmetric and positive semi-definite, so the Spectral Theorem gives an orthonormal eigenbasis with real, non-negative eigenvalues.
Given eigenvalues of , what are the singular values and rank?
; rank .
What is equal to, in terms of stretching?
, the largest stretch of any unit vector.
For symmetric with eigenvalue , what is the singular value?
.
Formula for (square ) via singular values?
.