Topics
Singular Value Decomposition (SVD) factorizes any real/complex matrix (size ) into three matrices representing rotation, scaling, rotation:
- : orthogonal matrix (cols are called left singular vectors)
- : diagonal matrix (non-negative singular values in descending order)
- : orthogonal matrix (rows are called right singular vectors)
Intuitively, rotates (or reflects) the input space into a “principal” coordinate system; scales each coordinate by ; and rotates it to the output space.
Key properties:
- Works for rectangular matrices (unlike eigendecomposition)
- Singular values reveal matrix rank
- Stable numerical computation via iterative methods
from numpy import array, diag
from numpy import diag
from scipy.linalg import svd
A = array([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
# factorize
U, s, V = svd(A)
# reconstruct
Sigma = diag(s)
B = U @ Sigma @ V
print(np.allclose(A, B))
Applications:
- Dimensionality reduction (PCA)
- Data compression (low-rank approximation)
- Solving linear systems (pseudoinverse)
- Recommender systems (collaborative filtering)