Module 8: SVD
A norm measures the "size" of a mathematical object. For vectors we have the Euclidean norm. For matrices, there are several useful choices, each emphasizing different aspects of size.
The simplest matrix norm: treat the matrix as a long vector and take the Euclidean norm of its entries:
The last equality links it to SVD: the Frobenius norm is the Euclidean norm of the singular values. It's easy to compute and differentiable everywhere.
The spectral norm is the largest factor by which A can stretch any vector:
It equals the largest singular value. Geometrically, it's the semi-major axis of the ellipse that A maps the unit circle to.
∥A∥1 = maximum absolute column sum. ∥A∥∞ = maximum absolute row sum. These are cheaper to compute than the spectral norm but less geometrically meaningful.
All matrix norms satisfy ∥AB∥≤∥A∥⋅∥B∥. This is crucial for bounding errors in matrix computations — errors don't compound faster than the product of norms.
Edit the matrix. The green ellipse shows where A maps the unit circle. The blue dashed circle has radius ‖A‖₂ — the spectral norm. The table shows all four norms updating live.
import numpy as np
A = np.array([[2., 1.], [0.5, 1.5]])
print(np.linalg.norm(A, 'fro')) # Frobenius
print(np.linalg.norm(A, 2)) # Spectral (= largest singular value)
print(np.linalg.norm(A, 1)) # Max column sum
print(np.linalg.norm(A, np.inf)) # Max row sum
# Spectral norm via SVD
s = np.linalg.svd(A, compute_uv=False)
print(s[0]) # same as norm(A, 2)