The singular value decomposition
Every real matrix can be written as
- () is orthogonal; its columns are the left singular vectors,
- () is diagonal with the singular values ,
- () is orthogonal; its columns are the right singular vectors.
The singular values are the square roots of the eigenvalues of (and of ), and the are the eigenvectors of . The value panel checks for the current matrix. The larger a singular value, the more its pair contributes to .
Rotate, scale, rotate
Read from right to left. is orthogonal, so it only turns the plane: the unit circle stays a circle, and land on the axes . stretches the axes by and : the circle becomes an axis-aligned ellipse. turns this ellipse into place. So maps the unit circle to an ellipse with semi-axes and , and
The panels use the usual math orientation, right and up. Singular vectors are only defined up to sign: flipping and together gives the same . Here is always chosen as a pure rotation. When , flips the plane, and then contains a mirror: the small arrow on the circle runs clockwise in the last panel. is the area of the ellipse divided by .
Solving with the pseudo-inverse
Undoing the three steps in reverse order gives the solution: rotate back with , divide by the singular values, rotate with :
When a singular value is tiny, dividing by it blows up every error in along . When it is zero, squashes the plane onto a line, most are not reachable, and the division is impossible. The pseudo-inverse replaces by 0 for all . The result is the least-squares solution, the that minimizes , and among all of those the shortest one. In the last panel, the ring then sits at the point of the line closest to . This works for any shape of , including overdetermined systems with more equations than unknowns.
Rank- approximation
Written as a sum, the SVD builds from rank-1 layers , one per singular value. Keeping only the first of them gives
It is the best approximation of rank : no other matrix of rank is closer to in the sum of squared differences, and that sum is exactly . A grayscale image is an matrix, so it can be stored as columns of and plus singular values, numbers instead of . This is the dimensionality reduction from the lecture: the first singular vectors capture the dominant structure, the last ones mostly fine detail and noise.
Where it comes back
The same decomposition solves the homogeneous problem : among all unit vectors, , the right singular vector of the smallest singular value, makes smallest, and . This is the tool behind total least squares, estimating a homography and calibrating a camera.
Try this
- Choose Rotation: , the circle stays a circle and . Then choose Scaling: now and only the middle step does anything.
- Choose Shear, : its singular values are and , the golden ratio and its inverse. Their product is : a shear keeps the area.
- Choose Mirror: , the last step reads "rotate + mirror" and the small arrow on the ellipse turns clockwise.
- Choose Nearly singular and set . Click a little off the long axis of the ellipse: sends far outside the first panel. Raise above : jumps back to a short vector, and (ring) moves onto the long axis, no longer exactly on .
- Choose Singular: the ellipse collapses to a segment and . Wherever you click , the ring lands at the closest point of the segment's line, and stays on the line through .
- Set : the image consists of copies of one row, each scaled by a different factor. Increase and watch the PSNR rise. Above , exceeds and storing the SVD costs more than the image.
- Compare the images: the test chart, made of axis-aligned blocks, has singular values that drop steeply, so a small already looks sharp. The zone plate's circles need many more.