Skip to main content
© 2026 ePowerAI — free, open courseware. No login required.
CoursesContact
ePOWERAI
CoursesContact
Week 13: The SVD and Complex Matrices
Linear Algebra

Foundations

  1. 01Start Here: Python and the Math the Labs Use
  1. 02Week 1: Vectors and Linear Combinations
  2. 03Week 2: Linear Transformations and Matrices
  3. 04Week 3: Elimination and LU Factorization
  4. 05Week 4: Determinants
  5. 06Week 5: Vector Spaces, Independence, and Basis
  6. 07Week 6: The Four Fundamental Subspaces
  7. 08Week 7: Orthogonality and Projections
  8. 09Week 8: Least Squares and QR
  9. 10Week 9: Eigenvalues and Eigenvectors
  10. 11Week 10: Diagonalization and Markov Matrices
  11. 12Week 11: Differential Equations
  12. 13Week 12: Symmetric and Positive Definite Matrices
  13. 14Week 13: The SVD and Complex Matrices
  14. 15Week 14: PCA, the Fourier Matrix and the FFT
Week 13· Linear Algebra7 min read

Week 13: The SVD and Complex Matrices

Learning Outcomes
  • Define the singular value decomposition A=UΣVTA = U\Sigma V^TA=UΣVT for any matrix
  • Compute singular values from the eigenvalues of ATAA^TAATA
  • Read the SVD as a rotation, a stretch along the axes and a second rotation of the unit sphere
  • Explain why singular values and eigenvalues differ, and why the SVD exists when diagonalization does not
  • Identify Hermitian and unitary matrices and their role for complex matrices
Prerequisites

Background knowledge assumed:

  • Symmetric matrices and the spectral theorem
  • Orthonormal vectors

Recommended: Review Week 12: Symmetric and Positive Definite Matrices and Week 8: Least Squares and QR before starting.

Take A=(200220122)A = \begin{pmatrix} 2 & 0 & 0 \\ 2 & 2 & 0 \\ 1 & 2 & 2 \end{pmatrix}A=​221​022​002​​. It is triangular, so its eigenvalues are the diagonal: 222, 222 and 222. That reads like "A doubles every length". Feed it the unit vector v1=(2,2,1)/3v_1 = (2, 2, 1)/3v1​=(2,2,1)/3 and out comes (4,8,8)/3(4, 8, 8)/3(4,8,8)/3, of length 444. 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.

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 t=3t = 3t=3, after all three moves. Slide ttt back to 000, then forward. From 000 to 111 the sphere turns by VTV^TVT, and every length stays 111. From 111 to 222, Σ\SigmaΣ stretches it along the axes by 444, 222 and 111. From 222 to 333, UUU turns the ellipsoid into place, and the amber arrow that started as v1v_1v1​ ends as Av1=4u1Av_1 = 4u_1Av1​=4u1​.

Every matrix turns, stretches and turns#

Week 10 wrote a square matrix as A=SΛS−1A = S\Lambda S^{-1}A=SΛS−1, but only when it had a full set of independent eigenvectors. This AAA does not. A−2IA - 2IA−2I has rank 222, so the eigenvalue 222 has a single eigenvector direction, and AAA cannot be diagonalized.

The SVDSingular Value Decomposition has no such limits. Every real m×nm \times nm×n matrix factors as

A=UΣVT,A = U\Sigma V^T,A=UΣVT,

with UUU and VVV orthogonal and Σ\SigmaΣ an m×nm \times nm×n diagonal matrix of singular values σ1≥σ2≥⋯≥0\sigma_1 \ge \sigma_2 \ge \cdots \ge 0σ1​≥σ2​≥⋯≥0. Read Ax=U(Σ(VTx))Ax = U(\Sigma(V^Tx))Ax=U(Σ(VTx)) right to left, as the slider does:

  1. VTV^TVT is orthogonal, here a rotation. It moves the right singular vectors viv_ivi​ onto the axes eie_iei​ and keeps the sphere a sphere.
  2. Σ\SigmaΣ multiplies coordinate iii by σi\sigma_iσi​. The sphere becomes an ellipsoid with half-axes σi\sigma_iσi​ along the axes.
  3. UUU rotates that ellipsoid so its axes point along the left singular vectors uiu_iui​.

So Avi=σiuiAv_i = \sigma_i u_iAvi​=σi​ui​: each viv_ivi​ goes to uiu_iui​, scaled by σi\sigma_iσi​. The longest half-axis σ1\sigma_1σ1​ is the largest stretch, ∥A∥2=max⁡∥x∥=1∥Ax∥\|A\|_2 = \max_{\|x\|=1}\|Ax\|∥A∥2​=max∥x∥=1​∥Ax∥. For square AAA, the shortest half-axis σn\sigma_nσn​ is the smallest.

Constructing the SVD in the scene's numbers#

Take lengths squared: ∥Ax∥2=xT(ATA)x\|Ax\|^2 = x^T(A^TA)x∥Ax∥2=xT(ATA)x. The Gram matrix

ATA=(962684244)A^TA = \begin{pmatrix} 9 & 6 & 2 \\ 6 & 8 & 4 \\ 2 & 4 & 4 \end{pmatrix}ATA=​962​684​244​​

is symmetric and positive semidefinite, so Week 12's spectral theorem applies: ATA=VΛVTA^TA = V\Lambda V^TATA=VΛVT with orthonormal viv_ivi​. Its eigenvalues are 161616, 444 and 111. Check two invariants. The trace is 9+8+4=21=16+4+19 + 8 + 4 = 21 = 16 + 4 + 19+8+4=21=16+4+1, and det⁡(ATA)=(det⁡A)2=64=16⋅4⋅1\det(A^TA) = (\det A)^2 = 64 = 16 \cdot 4 \cdot 1det(ATA)=(detA)2=64=16⋅4⋅1. Check one eigenvector:

ATA(221)=(323216)=16(221).A^TA \begin{pmatrix} 2 \\ 2 \\ 1 \end{pmatrix} = \begin{pmatrix} 32 \\ 32 \\ 16 \end{pmatrix} = 16 \begin{pmatrix} 2 \\ 2 \\ 1 \end{pmatrix}.ATA​221​​=​323216​​=16​221​​.

The singular values are the square roots, σ=4,2,1\sigma = 4, 2, 1σ=4,2,1. The left singular vectors come from ui=Avi/σiu_i = Av_i/\sigma_iui​=Avi​/σi​, so u1=(4,8,8)/(3⋅4)=(1,2,2)/3u_1 = (4, 8, 8)/(3 \cdot 4) = (1, 2, 2)/3u1​=(4,8,8)/(3⋅4)=(1,2,2)/3. In general, AV=UΣAV = U\SigmaAV=UΣ column by column, and ATA=VΣTΣVTA^TA = V\Sigma^T\Sigma V^TATA=VΣTΣVT. The uiu_iui​ are also the eigenvectors of AATAA^TAAT.

Singular values are not eigenvalues. The eigenvalues of AAA are 2,2,22, 2, 22,2,2, and the singular values are 4,2,14, 2, 14,2,1. Their products agree in absolute value, since both give the volume factor: ∣det⁡A∣=2⋅2⋅2=4⋅2⋅1=8|\det A| = 2 \cdot 2 \cdot 2 = 4 \cdot 2 \cdot 1 = 8∣detA∣=2⋅2⋅2=4⋅2⋅1=8. An eigenvector is a direction that AAA keeps. On the unit sphere, ∥Ax∥\|Ax\|∥Ax∥ 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 U=V=QU = V = QU=V=Q and Σ=Λ\Sigma = \LambdaΣ=Λ, which is the Week 12 picture.

Rank. The rank is the number of positive σi\sigma_iσi​. Zeroing the smallest ones gives the best low-rank approximation (Eckart–Young), the basis of PCA in Week 14.

Complex matrices#

Over C\mathbb{C}C, each real notion has a counterpart built from the conjugate transpose AH=A‾TA^H = \overline{A}^TAH=AT:

  • Hermitian, AH=AA^H = AAH=A, is the analogue of symmetric. Its eigenvalues are real, and A=UΛUHA = U\Lambda U^HA=UΛUH.
  • Unitary, UHU=IU^HU = IUHU=I, is the analogue of orthogonal. It keeps lengths: ∥Ux∥2=xHUHUx=∥x∥2\|Ux\|^2 = x^HU^HUx = \|x\|^2∥Ux∥2=xHUHUx=∥x∥2.

Every complex m×nm \times nm×n matrix has an SVD A=UΣVHA = U\Sigma V^HA=UΣVH with unitary UUU and VVV and real σi≥0\sigma_i \ge 0σi​≥0. The discrete Fourier matrix, divided by n\sqrt{n}n​, is unitary.


Knowledge Check#

Exercise · Fill in the blank

Set the slider to t = 3. How long is the amber arrow, Av₁?

Question 1 of 3

Set the slider to t = 1. Where do the three marked vectors sit?

Still where they started
On the axes e₁, e₂ and e₃, each of length 1
On the axes, with lengths 4, 2 and 1
On u₁, u₂ and u₃

Browser lab: the stretch of A between 1 and 4#

Compute the SVD of the scene's matrix and measure ∥Ax∥\|Ax\|∥Ax∥ over many unit vectors.

python · runs in browser
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 ui,viu_i, v_iui​,vi​ together, so a printed viv_ivi​ can be the negative of the scene's. The product Avi=σiuiAv_i = \sigma_i u_iAvi​=σi​ui​ still holds. Every sampled stretch falls between the dashed lines at σ3=1\sigma_3 = 1σ3​=1 and σ1=4\sigma_1 = 4σ1​=4. Try A.T @ A: it is symmetric positive semidefinite, so its singular values equal its eigenvalues.

Key takeaways#

Every matrix factors as A=UΣVTA = U\Sigma V^TA=UΣVT: a rotation, a stretch along the axes, and a second rotation. The singular values are the square roots of the eigenvalues of ATAA^TAATA and the half-axes of the image of the unit sphere. In general they are not the eigenvalues of AAA: the scene's AAA has eigenvalues 2,2,22, 2, 22,2,2 and stretches unit vectors from 111 to 444. 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.

← Previous
Week 12: Symmetric and Positive Definite Matrices
Next →
Week 14: PCA, the Fourier Matrix and the FFT
On this page
  • Every matrix turns, stretches and turns
  • Constructing the SVD in the scene's numbers
  • Complex matrices
  • Knowledge Check
  • Browser lab: the stretch of A between 1 and 4
  • Key takeaways
  • Further reading