SVD and Vector Mapping

Interactive reproduction of Figure 4.9 from Mathematics for Machine Learning (Deisenroth, Faisal & Ong). The Singular Value Decomposition A = UΣVT decomposes any matrix into three geometric steps: a rotation in the input space (VT), a scaling into the output space (Σ), and a rotation in the output space (U). Here a 3×2 matrix maps ℝ² → ℝ³, shown as four panels following the anti-clockwise structure of Figure 4.8.

Each panel shows the same color-coded grid of points, transformed step by step: original 2D dataVT rotation (2D)ΣVT scaling into 3DUΣVT = A (3D).

Matrix A (3×2)
1 -0.8 0 1 1 0
=
U (3×3, rotation in ℝ³)
-0.79 0 -0.62 0.38 -0.78 -0.49 -0.48 -0.62 0.62
Σ (3×2, scaling)
1.62 0 0 1.0 0 0
VT (2×2, rotation in ℝ²)
-0.78 -0.62 0.62 -0.78

① Original data in ℝ²

Color-coded grid of points x ∈ [-1, 1]²

② VT rotation (still ℝ²)

Right singular vectors align with the coordinate axes

③ ΣVT scaling (ℝ² → ℝ³)

Singular values stretch axes; third dimension appears (σ₃ = 0)

④ UΣVT = A (final mapping in ℝ³)

Left singular vectors rotate the 3D data to the final position

Interactive: Custom 3×2 Matrix

Enter your own 3×2 matrix entries. The SVD is computed in-browser and all four panels update as you type. Try different values to see how the singular values and rotations change.

Quick presets:

Original (ℝ²)

VT rotation (ℝ²)

ΣVT (ℝ³)

UΣVT = A (ℝ³)

Right singular vector v₁ (red)
Right singular vector v₂ (blue)
Left singular vector u₁ (green)
Left singular vector u₂ (amber)

Video Walkthrough

Watch on YouTube

Reference: Deisenroth, M.P., Faisal, A.A., Ong, C.S. Mathematics for Machine Learning, Figure 4.9 (Example 4.12). Cambridge University Press, 2020. Python companion (MML-Companion)

Comments