Take . It is triangular, so its eigenvalues are the diagonal: , and . That reads like "A doubles every length". Feed it the unit vector and out comes , of length . Eigenvalues measure stretch only along eigenvectors. Singular values measure it in every direction.
The unit sphere goes through A = [[2, 0, 0], [2, 2, 0], [1, 2, 2]] as three moves of its SVD A = UΣVᵀ, with Σ = diag(4, 2, 1). The slider turns the sphere by Vᵀ from t = 0 to 1, stretches it by Σ from 1 to 2, and turns it by U from 2 to 3. Three marked vectors start at v₁, v₂ and v₃. t = 3. The sphere has gone through A = UΣVᵀ. Av₁ = 4u₁, Av₂ = 2u₂ and Av₃ = u₃, with u₁ = (1, 2, 2)/3.
The scene opens at , after all three moves. Slide back to , then forward. From to the sphere turns by , and every length stays . From to , stretches it along the axes by , and . From to , turns the ellipsoid into place, and the amber arrow that started as ends as .
Every matrix turns, stretches and turns#
Week 10 wrote a square matrix as , but only when it had a full set of independent eigenvectors. This does not. has rank , so the eigenvalue has a single eigenvector direction, and cannot be diagonalized.
The SVD has no such limits. Every real matrix factors as
with and orthogonal and an diagonal matrix of singular values . Read right to left, as the slider does:
- is orthogonal, here a rotation. It moves the right singular vectors onto the axes and keeps the sphere a sphere.
- multiplies coordinate by . The sphere becomes an ellipsoid with half-axes along the axes.
- rotates that ellipsoid so its axes point along the left singular vectors .
So : each goes to , scaled by . The longest half-axis is the largest stretch, . For square , the shortest half-axis is the smallest.
Constructing the SVD in the scene's numbers#
Take lengths squared: . The Gram matrix
is symmetric and positive semidefinite, so Week 12's spectral theorem applies: with orthonormal . Its eigenvalues are , and . Check two invariants. The trace is , and . Check one eigenvector:
The singular values are the square roots, . The left singular vectors come from , so . In general, column by column, and . The are also the eigenvectors of .
Singular values are not eigenvalues. The eigenvalues of are , and the singular values are . Their products agree in absolute value, since both give the volume factor: . An eigenvector is a direction that keeps. On the unit sphere, is largest, smallest or stationary at the singular vectors, and their images are perpendicular. The two notions coincide for a symmetric positive semidefinite matrix, where and , which is the Week 12 picture.
Rank. The rank is the number of positive . Zeroing the smallest ones gives the best low-rank approximation (Eckart–Young), the basis of PCA in Week 14.
Complex matrices#
Over , each real notion has a counterpart built from the conjugate transpose :
- Hermitian, , is the analogue of symmetric. Its eigenvalues are real, and .
- Unitary, , is the analogue of orthogonal. It keeps lengths: .
Every complex matrix has an SVD with unitary and and real . The discrete Fourier matrix, divided by , is unitary.
Knowledge Check#
Set the slider to t = 3. How long is the amber arrow, Av₁?
Set the slider to t = 1. Where do the three marked vectors sit?
Browser lab: the stretch of A between 1 and 4#
Compute the SVD of the scene's matrix and measure over many unit vectors.
import numpy as np
import matplotlib.pyplot as plt
A = np.array([[2., 0., 0.],
[2., 2., 0.],
[1., 2., 2.]])
U, S, Vt = np.linalg.svd(A)
print("singular values =", S.round(6))
print("eigenvalues =", np.linalg.eigvals(A).real.round(6))
print("A = U Σ Vᵀ:", np.allclose(U @ np.diag(S) @ Vt, A))
for i in range(3):
v, u = Vt[i], U[:, i]
print(f"v{i+1} = {np.round(3 * v).astype(int)}/3 A v = {S[i]:.0f} u:", np.allclose(A @ v, S[i] * u))
rng = np.random.default_rng(0)
x = rng.normal(size=(3, 20000))
x /= np.linalg.norm(x, axis=0)
stretch = np.linalg.norm(A @ x, axis=0)
print(f"min ‖Ax‖ = {stretch.min():.3f}, max ‖Ax‖ = {stretch.max():.3f}")
plt.hist(stretch, bins=60)
plt.axvline(S[-1], color="k", linestyle="--")
plt.axvline(S[0], color="k", linestyle="--")
plt.xlabel("‖Ax‖ for unit x")
plt.ylabel("count")
plt.show()
The singular values print as [4. 2. 1.] and the eigenvalues as [2. 2. 2.]. NumPy may flip the sign of a pair together, so a printed can be the negative of the scene's. The product still holds. Every sampled stretch falls between the dashed lines at and . Try A.T @ A: it is symmetric positive semidefinite, so its singular values equal its eigenvalues.
Key takeaways#
Every matrix factors as : a rotation, a stretch along the axes, and a second rotation. The singular values are the square roots of the eigenvalues of and the half-axes of the image of the unit sphere. In general they are not the eigenvalues of : the scene's has eigenvalues and stretches unit vectors from to . The SVD exists even where diagonalization fails.
Further reading#
- Gilbert Strang, Introduction to Linear Algebra (6th ed., Wellesley-Cambridge Press, 2023). Chapter 7 develops the SVD, its geometry, and its connection to principal component analysis.
- Lloyd N. Trefethen & David Bau, Numerical Linear Algebra (SIAM, 1997). Lectures 4–5 derive the SVD and prove the low-rank approximation theorem (Eckart–Young).
- Steven L. Brunton & J. Nathan Kutz, Data-Driven Science and Engineering (Cambridge University Press, 2019). Chapter 1 uses the SVD as the workhorse for data-driven low-rank structure.
Reading is free. PDF and ePub unlock with the newsletter. Join once and every lesson opens in this browser.