Skip to main content
© 2026 ePowerAI — instrumented learning, no login required.
CoursesContact
ePOWERAI
CoursesContact
Week 13: The SVD and Complex Matrices
Linear Algebra
01Start Here: Python and the Math the Labs Use
02Week 1: Vectors and Linear Combinations
03Week 2: Linear Transformations and Matrices
04Week 3: Elimination and LU Factorization
05Week 4: Determinants
06Week 5: Vector Spaces, Independence, and Basis
07Week 6: The Four Fundamental Subspaces
08Week 7: Orthogonality and Projections
09Week 8: Least Squares and QR
10Week 9: Eigenvalues and Eigenvectors
11Week 10: Diagonalization and Markov Matrices
12Week 11: Differential Equations
13Week 12: Symmetric and Positive Definite Matrices
14Week 13: The SVD and Complex Matrices
15Week 14: The Fourier Matrix, FFT, and PCA
Week 13· Linear Algebra10 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
  • Explain how the SVD generalizes eigendecomposition to non-square matrices
  • 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.

Why We Need the SVD#

Week 10 diagonalized a square matrix as A=SΛS−1A = S\Lambda S^{-1}A=SΛS−1 when AAA had a full set of independent eigenvectors. Week 12 upgraded that story for symmetric AAA: eigenvalues are real and SSS can be chosen orthogonal, so A=QΛQTA = Q\Lambda Q^TA=QΛQT. Both tools are powerful — and both are picky about the matrix they accept.

Eigendecomposition requires AAA to be square and diagonalizable. Many matrices that show up in data and geometry fail one or both tests:

  • A data matrix of mmm samples and nnn features is m×nm \times nm×n, often with m≠nm \neq nm=n — eigenvalues are not even defined.
  • A square but defective matrix (not enough independent eigenvectors) cannot be written SΛS−1S\Lambda S^{-1}SΛS−1.
  • Even when diagonalization exists, the eigenvector matrix SSS need not be orthogonal, so the change of basis can stretch and shear rather than pure rotate.

The SVDSingular Value Decomposition (singular value decomposition) removes those restrictions. For every real m×nm \times nm×n matrix AAA — square or rectangular, full rank or rank-deficient — there exist orthogonal matrices UUU and VVV and a rectangular “diagonal” matrix Σ\SigmaΣ of nonnegative numbers such that

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

No eigenvalue computation on AAA itself is required. The construction uses only the spectral theorem on the symmetric Gram matrices ATAA^TAATA and AATAA^TAAT, which always work. That is why the SVD is the workhorse factorization of applied linear algebra: least squares, low-rank approximation, PCA, and pseudoinverses all build on it. PCA and representation learning pick it up directly in Generative Models Week 11: Representation Learning with Generative Models, and covariance structure through the SVD appears in Probability & Statistics Week 6: Multivariate Gaussians.


Constructing the SVD#

Start from any real m×nm \times nm×n matrix AAA. Form the Gram matrix

ATA∈Rn×n.A^TA \in \mathbb{R}^{n \times n}.ATA∈Rn×n.

This matrix is always symmetric ((ATA)T=ATA(A^TA)^T = A^TA(ATA)T=ATA) and positive semidefinite (xT(ATA)x=∥Ax∥2≥0x^T(A^TA)x = \|Ax\|^2 \ge 0xT(ATA)x=∥Ax∥2≥0). By the spectral theorem from Week 12 it has an orthonormal basis of eigenvectors v1,…,vnv_1,\ldots,v_nv1​,…,vn​ and nonnegative eigenvalues λ1≥λ2≥⋯≥λn≥0\lambda_1 \ge \lambda_2 \ge \cdots \ge \lambda_n \ge 0λ1​≥λ2​≥⋯≥λn​≥0:

ATA=VΛVT,VTV=I,Λ=diag⁡(λ1,…,λn).A^TA = V\Lambda V^T, \qquad V^TV = I, \qquad \Lambda = \operatorname{diag}(\lambda_1,\ldots,\lambda_n).ATA=VΛVT,VTV=I,Λ=diag(λ1​,…,λn​).

The singular values of AAA are the square roots of those eigenvalues:

σi=λi≥0.\sigma_i = \sqrt{\lambda_i} \ge 0.σi​=λi​​≥0.

Conventionally we order them σ1≥σ2≥⋯≥σr>0\sigma_1 \ge \sigma_2 \ge \cdots \ge \sigma_r > 0σ1​≥σ2​≥⋯≥σr​>0 (where r=rank⁡(A)r = \operatorname{rank}(A)r=rank(A)), and pack them into an m×nm \times nm×n rectangular diagonal matrix Σ\SigmaΣ: σi\sigma_iσi​ in the diagonal entries, zeros everywhere else.

The columns of VVV are the right singular vectors. The left singular vectors uiu_iui​ come from applying AAA and normalizing. For each positive singular value,

Avi=σiui⇒ui=1σi Avi.A v_i = \sigma_i u_i \qquad\Rightarrow\qquad u_i = \frac{1}{\sigma_i}\, A v_i.Avi​=σi​ui​⇒ui​=σi​1​Avi​.

(Equivalently, the uiu_iui​ are orthonormal eigenvectors of the other Gram matrix AATAA^TAAT.) Extend {u1,…,ur}\{u_1,\ldots,u_r\}{u1​,…,ur​} to a full orthonormal basis of Rm\mathbb{R}^mRm if r<mr < mr<m, and pack the result into the orthogonal matrix UUU. The defining identity is then

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

Why it works. Multiplying A=UΣVTA = U\Sigma V^TA=UΣVT on the right by VVV gives AV=UΣAV = U\SigmaAV=UΣ. Column iii of that equation is exactly Avi=σiuiAv_i = \sigma_i u_iAvi​=σi​ui​. Multiplying A=UΣVTA = U\Sigma V^TA=UΣVT on the left by ATA^TAT recovers ATA=VΣTΣVTA^TA = V\Sigma^T\Sigma V^TATA=VΣTΣVT, so the squared singular values are the eigenvalues of ATAA^TAATA — consistent by construction.

Worked sketch. Let

A=(3045).A = \begin{pmatrix} 3 & 0 \\ 4 & 5 \end{pmatrix}.A=(34​05​).

Then

ATA=(3405)(3045)=(25202025).A^TA = \begin{pmatrix} 3 & 4 \\ 0 & 5 \end{pmatrix}\begin{pmatrix} 3 & 0 \\ 4 & 5 \end{pmatrix} = \begin{pmatrix} 25 & 20 \\ 20 & 25 \end{pmatrix}.ATA=(30​45​)(34​05​)=(2520​2025​).

The trace of ATAA^TAATA is 505050, so σ12+σ22=50\sigma_1^2 + \sigma_2^2 = 50σ12​+σ22​=50. The eigenvalues of ATAA^TAATA are λ=45\lambda = 45λ=45 and λ=5\lambda = 5λ=5 (solve det⁡(ATA−λI)=(25−λ)2−400=0\det(A^TA - \lambda I) = (25-\lambda)^2 - 400 = 0det(ATA−λI)=(25−λ)2−400=0), hence singular values σ1=45=35\sigma_1 = \sqrt{45} = 3\sqrt{5}σ1​=45​=35​ and σ2=5\sigma_2 = \sqrt{5}σ2​=5​. The browser lab below recovers UUU, Σ\SigmaΣ, and VTV^TVT numerically and checks that the product reconstructs AAA.

Connection to rank. The number of positive singular values equals rank⁡(A)\operatorname{rank}(A)rank(A). Zero singular values mark the nullspace directions: Avi=0Av_i = 0Avi​=0 when σi=0\sigma_i = 0σi​=0. Truncating small singular values (setting them to zero) produces the best low-rank approximation of AAA in the Frobenius and spectral norms — the Eckart–Young theorem (Eckart & Young, 1936), which Week 14 uses for PCA.


Geometric Picture#

The factorization A=UΣVTA = U\Sigma V^TA=UΣVT is a composition of three simple maps. For a vector x∈Rnx \in \mathbb{R}^nx∈Rn,

Ax=U(Σ(VTx)).Ax = U\bigl(\Sigma (V^T x)\bigr).Ax=U(Σ(VTx)).

Read right to left:

  1. VTV^TVT — an orthogonal change of coordinates in the input space (a rotation or reflection). The new coordinates are the components of xxx along the right singular vectors.
  2. Σ\SigmaΣ — axis-aligned stretching (and possible zeroing). Coordinate iii is multiplied by σi\sigma_iσi​; if m≠nm \neq nm=n, some coordinates are padded with zeros or dropped so the dimensions match.
  3. UUU — an orthogonal change of coordinates in the output space: reassemble the stretched components along the left singular vectors.

So every linear map Rn→Rm\mathbb{R}^n \to \mathbb{R}^mRn→Rm is a rotation, followed by stretch along the coordinate axes, followed by another rotation. That is strictly stronger than diagonalization: the orthonormal bases on the two sides — VVV in Rn\mathbb{R}^nRn, UUU in Rm\mathbb{R}^mRm — need not even live in the same dimension.

Unit circle picture. Map the unit circle ∥x∥=1\|x\| = 1∥x∥=1 through AAA. Because VTV^TVT preserves lengths, VTxV^TxVTx still traces the unit circle. Σ\SigmaΣ turns that circle into an axis-aligned ellipse with half-axes σ1,σ2,…\sigma_1,\sigma_2,\ldotsσ1​,σ2​,…. UUU then rotates (or reflects) the ellipse into its final orientation. The longest stretch of the ellipse is σ1=∥A∥2\sigma_1 = \|A\|_2σ1​=∥A∥2​, the operator (spectral) norm of AAA.

The SVD as rotate, stretch, rotate: the unit circle becomes an ellipse

A=UΣVTA = U\Sigma V^TA=UΣVT in three steps: VTV^TVT rotates the unit circle (lengths unchanged), Σ\SigmaΣ stretches it along the coordinate axes into an axis-aligned ellipse, and UUU rotates that ellipse into its final orientation.

When AAA is symmetric and positive semidefinite. The eigenvalues are already nonnegative, so the SVD and the spectral theorem coincide exactly: U=V=QU = V = QU=V=Q and Σ=Λ\Sigma = \LambdaΣ=Λ, so A=QΛQTA = Q\Lambda Q^TA=QΛQT. For a symmetric AAA that is not PSD, the singular values are the absolute values of the eigenvalues (from ATA=QΛ2QTA^TA = Q\Lambda^2Q^TATA=QΛ2QT) and the sign ambiguity is absorbed by UUU and VVV. The SVD is the generalization that keeps working after symmetry and squareness are dropped.


Complex Matrices#

Many applications — Fourier analysis, quantum states, circuit phasors, and next week's discrete Fourier transform — live over C\mathbb{C}C rather than R\mathbb{R}R. The real notions of transpose, symmetry, and orthogonality each have a complex counterpart built from the conjugate transpose

AH=A‾TA^H = \overline{A}^TAH=AT

(also written A∗A^*A∗). Conjugate every entry, then transpose. For real matrices, conjugation does nothing, so AH=ATA^H = A^TAH=AT and the two stories agree.

Hermitian matrices. A square complex matrix AAA is Hermitian when

AH=A.A^H = A.AH=A.

This is the complex analogue of symmetry. Diagonal entries of a Hermitian matrix must be real (aii=aii‾a_{ii} = \overline{a_{ii}}aii​=aii​​), and off-diagonal pairs satisfy aji=aij‾a_{ji} = \overline{a_{ij}}aji​=aij​​. The spectral theorem upgrades cleanly: every Hermitian matrix has real eigenvalues and an orthonormal basis of eigenvectors with respect to the complex inner product ⟨x,y⟩=yHx\langle x, y \rangle = y^H x⟨x,y⟩=yHx. In matrix form

A=UΛUHA = U\Lambda U^HA=UΛUH

with UUU unitary (defined next) and Λ\LambdaΛ real diagonal.

Unitary matrices. A square complex matrix UUU is unitary when

UHU=IU^H U = IUHU=I

(equivalently U−1=UHU^{-1} = U^HU−1=UH, or UUH=IUU^H = IUUH=I). This is the complex analogue of an orthogonal matrix's QTQ=IQ^TQ = IQTQ=I. Unitary maps preserve the complex Euclidean norm: ∥Ux∥2=xHUHUx=xHx=∥x∥2\|Ux\|^2 = x^H U^H U x = x^H x = \|x\|^2∥Ux∥2=xHUHUx=xHx=∥x∥2 for every xxx. Columns of a unitary matrix form an orthonormal basis of Cn\mathbb{C}^nCn.

SVD over C\mathbb{C}C. The same construction works with conjugate transposes: every complex m×nm \times nm×n matrix factors as A=UΣVHA = U\Sigma V^HA=UΣVH with unitary UUU, VVV and real nonnegative singular values on Σ\SigmaΣ. The squared singular values are the eigenvalues of the Hermitian positive-semidefinite matrix AHAA^HAAHA.

Why this matters next week. The discrete Fourier matrix is unitary up to the standard 1/n1/\sqrt{n}1/n​ normalization — the nnn-th roots of unity sum to zero, so distinct rows are orthogonal. PCA is built directly on the SVD of a data matrix. Both rely on the geometry you just met: orthogonal (or unitary) changes of basis that expose axis-aligned stretches.


Knowledge check#

Exercise · Fill in the blank

For A = [[3,0],[4,5]], compute A^T A and find its trace (sum of diagonal entries) — this equals the sum of the squared singular values.

Question 1 of 4

The SVD writes any m×n matrix A as:

U Σ V^T with U, V orthogonal and Σ diagonal
S Λ S^{-1} with S invertible
L U with L lower triangular
Q R with Q orthogonal

Browser lab: SVD reconstruction#

Compute the SVD with numpy.linalg.svd and verify it reconstructs A.

python · runs in browser
import numpy as np

A = np.array([[3., 0.],
              [4., 5.]])

U, S, Vt = np.linalg.svd(A)

print("U =\n", U)
print("singular values =", S)
print("V^T =\n", Vt)

A_reconstructed = U @ np.diag(S) @ Vt
print("Reconstructed A ≈ original:", np.allclose(A_reconstructed, A))

print("Notice: singular values are [6.708, 2.236] and 'Reconstructed A ≈ original: True'.")

np.linalg.svd returns the factors in “thin” or “full” form depending on options; the default full form for a square AAA gives orthogonal UUU and VTV^TVT with S as a 1-D array of singular values in descending order. Rebuilding Σ=diag⁡(S)\Sigma = \operatorname{diag}(S)Σ=diag(S) and multiplying UΣVTU\Sigma V^TUΣVT recovers AAA up to floating-point roundoff — the check np.allclose should print True. You can also verify σ12+σ22≈50\sigma_1^2 + \sigma_2^2 \approx 50σ12​+σ22​≈50, matching the trace identity from the knowledge check.


Done when#

You can write the SVD A=UΣV⊤A=U\Sigma V^\topA=UΣV⊤, compute singular values as λi(A⊤A)\sqrt{\lambda_i(A^\top A)}λi​(A⊤A)​, and explain how the SVD extends eigendecomposition to non-square and complex matrices. Check it against the browser lab: for A=(3045)A=\begin{pmatrix}3&0\\4&5\end{pmatrix}A=(34​05​) the singular values are 6.708 and 2.236, Reconstructed A ≈ original: True, and σ12+σ22=50\sigma_1^2+\sigma_2^2 = 50σ12​+σ22​=50 equals the trace of A⊤AA^\top AA⊤A.


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.
← Previous
Week 12: Symmetric and Positive Definite Matrices
Next →
Week 14: The Fourier Matrix, FFT, and PCA
On this page
  • Why We Need the SVD
  • Constructing the SVD
  • Geometric Picture
  • Complex Matrices
  • Knowledge check
  • Browser lab: SVD reconstruction
  • Done when
  • Further Reading