Module 8: SVD
Every matrix does something to space. SVD reveals the exact structure of that something: every matrix is secretly a rotation, then a stretch, then another rotation.
Every matrix A can be written as:
Where:
The diagonal entries σ₁ ≥ σ₂ ≥ ... ≥ 0 of Σ are the singular values. They tell you how much the matrix stretches space in each direction. A singular value of 0 means that direction collapses — that's a rank deficiency.
Eigendecomposition only exists for square matrices and fails when eigenvalues are complex. SVD works for any matrix — rectangular, singular, complex. The singular values are always real and non-negative.
The four panels show the unit circle being transformed step by step. Use the sliders to adjust the two rotation angles and two singular values. Notice: the final shape depends only on σ₁ and σ₂ (the ellipse's size), while U and V control the orientation.
import numpy as np
A = np.array([[2., 1.], [0., 1.5]])
# U: left singular vectors (columns)
# s: singular values (σ₁, σ₂)
# Vh: right singular vectors (rows = Vᵀ)
U, s, Vh = np.linalg.svd(A)
print(s) # [2.35, 1.06] — singular values
print(np.allclose(U @ np.diag(s) @ Vh, A)) # True