A7 · Lesson 44 · The SVD
Every matrix is a rotation, a stretch and a rotation
A Wi-Fi router with several antennas talks to a laptop with several antennas, and every transmit antenna reaches every receive antenna through its own path: the channel is a matrix . Mixed up like that, the streams interfere. But every matrix, square or not, can be written as a rotation, then a stretch along perpendicular axes, then another rotation. Precode with the first rotation and decode with the last, and the tangled channel becomes a set of separate, non-interfering channels, one per singular value. That decomposition, the SVD, also compresses images, removes noise, and measures how close a matrix is to singular.
- The curve is the unit circle after the matrix : always an ellipse.
- The arrow is the ellipse's long semi-axis, of length . The short semi-axis has length .
- Make nearly singular. What happens to ? Compare with .
Predict
A 2 × 2 matrix has singular values 6 and 0.01. What does it do to the unit circle?
It makes an ellipse with semi-axes 6 and 0.01: nearly a line. The matrix is close to singular, and the tiny says how close. Solving systems with it amplifies errors by , the condition number of lesson 52.
Name it
The decomposition
Every matrix of rank can be written
- () and () are orthogonal: their columns are orthonormal.
- is with the singular values on its diagonal.
- : the right singular vectors go to the left singular vectors , stretched by .
The are the eigenvalues of (and of ), and the are its eigenvectors. Unlike eigenvalues, singular values exist for every matrix, are real and never negative.
Geometry
rotates, stretches along the axes, rotates: the unit sphere becomes an ellipsoid with semi-axes along . For a square matrix, .
Low-rank approximation
Keeping the first terms gives , the best rank- approximation to (Eckart-Young). Its error, measured as the root of the sum of squared entries (the Frobenius norm), is
A photo whose singular values fall quickly can be stored with a few terms: numbers instead of .
MIMO channels
With , transmit and multiply the received signal by : you get plus noise, separate channels with gains . Weak get little power; strong ones carry most of the data. S8 builds on this.
Worked example
Find the singular values of .
Show the solution
- Form .
- Its eigenvalues. They are : 45 and 5.
- Singular values.
- Check.
Answer and .
Worked example
A 512 × 512 image is stored as its rank-20 approximation. How much smaller is it, and when is that a good idea?
Show the solution
- Full storage.
- Rank-20 storage. about 13 times smaller.
- When it works. It's good when are small compared with the first ones, so the discarded part, of size , is a small fraction of the whole.
Answer about 13 times smaller (20 500 numbers against 262 144), and a good idea when the singular values after the 20th are small.
Worked example
Find the singular values of with and .
Show the solution
- Rank. Every column of is a multiple of , so its rank is 1 and it has one nonzero singular value.
- SVD form. Writing it this way puts it in SVD form directly:
- Read off . and .
- The bigger picture. A matrix built from one outer product is one rank-one piece of an SVD. Any matrix is a sum of such pieces, largest first.
Answer and .
Check
What is the larger singular value of ?
Check
A 2 × 2 matrix has = −6 and largest singular value 4. What is ?
Check
What is for ?
Check
A matrix has singular values 10, 3 and 2. What is the relative error of its best rank-1 approximation?
Check
A 256 × 256 image is stored as its rank-10 approximation. What percent of the original numbers does that take?
Check
A is a 6 × 5 NumPy array that's nearly low-rank. Using np.linalg.svd, set Ak to its best rank-2 approximation and rel_err to .
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Singular values.
(a)
What is of ?
(b)
What is for ?
Check
Find the SVD of .
Step 1
What is the trace of ?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Step 2
has rank 1. What is ?
Explain why
Why are the singular values of the square roots of the eigenvalues of ?
From , , because . That's the spectral factorization of the symmetric matrix : its eigenvectors are the columns of and its eigenvalues are the diagonal entries of , which are . Since is positive semidefinite those eigenvalues are never negative, so their square roots are real, and they're the singular values.
Practice
Keep practicing
10 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.