Linear Algebra — Lecture 10

Lecture 10: The Spectral Theorem and the Singular Value Decomposition

Shuhong Gao  ·  Clemson University

These notes are interactive: click a section title to open it, click any dotted term to unfold its exact definition or statement in place, click ▸ Proof to expand a proof, and try the exercises — answers are checked instantly.

10.1  Symmetric matrices, the spectral theorem, and quadratic forms

💡 Intuition

Lecture 8 met two obstacles to diagonalizing a matrix: eigenvalues that are not real, and eigenspaces that are too small. For a symmetric matrix neither happens, and more is true: the eigenvectors can be chosen orthonormal, so that A=QDQTA = QDQ^{T} with QQ an orthogonal matrix. This is the spectral theorem. Geometrically, a symmetric matrix stretches space along nn mutually perpendicular directions, by the factors λ1,…,λn\lambda_1, \dots, \lambda_n. The same directions answer an optimization question: on the unit sphere, the quadratic form 𝐱TA𝐱\mathbf{x}^{T}A\mathbf{x} is largest in the direction of an eigenvector for the largest eigenvalue and smallest in the direction of one for the smallest. In Section 10.2 this is applied to the symmetric matrix ATAA^{T}A of an arbitrary matrix AA, which produces the singular value decomposition.

Definition 10.1 (Symmetric matrix)

A square matrix AA is symmetric if AT=AA^{T} = A, that is, aij=ajia_{ij} = a_{ji} for all i,ji, j: the entries are mirrored across the diagonal.

Example 10.2 (Where symmetric matrices come from)
  1. For every m×nm \times n matrix AA, the matrices ATAA^{T}A (n×nn \times n) and AATAA^{T} (m×mm \times m) are symmetric: by the transpose rule (BC)T=CTBT(BC)^{T} = C^{T}B^{T} (Theorem 4.17), (ATA)T=AT(AT)T=ATA(A^{T}A)^{T} = A^{T}(A^{T})^{T} = A^{T}A, and likewise for AATAA^{T}. By Lemma 9.15, the entries of ATAA^{T}A are the inner products of the columns of AA.
  2. The matrix of an orthogonal projection is symmetric (part (f) of Theorem 9.34).
  3. The matrices (5222)\begin{pmatrix} 5 & 2 \\ 2 & 2 \end{pmatrix} and (211121112)\begin{pmatrix} 2 & 1 & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 2 \end{pmatrix} are symmetric; the rotation (01−10)\begin{pmatrix} 0 & 1 \\ -1 & 0 \end{pmatrix} of Example 8.26, which has no real eigenvalue, is not.
Lemma 10.3 (Symmetric matrices move across the inner product)

An n×nn \times n matrix AA is symmetric if and only if (A𝐱)⋅𝐲=𝐱⋅(A𝐲)for all 𝐱,𝐲∈ℝn.(A\mathbf{x}) \cdot \mathbf{y} = \mathbf{x} \cdot (A\mathbf{y}) \qquad\text{for all } \mathbf{x}, \mathbf{y} \in \mathbb{R}^n .

Proposition 10.4 (Eigenvectors of a symmetric matrix are orthogonal)

Let AA be symmetric, and let A𝐱=λ𝐱A\mathbf{x} = \lambda\mathbf{x} and A𝐲=μ𝐲A\mathbf{y} = \mu\mathbf{y} with λ≠μ\lambda \neq \mu. Then 𝐱⋅𝐲=0\mathbf{x} \cdot \mathbf{y} = 0.

Lemma 10.5 (A symmetric matrix has real eigenvalues)

Every root of the characteristic polynomial of a symmetric matrix AA is a real number. In particular, AA has at least one (real) eigenvalue, and its characteristic polynomial is a product of real linear factors.

Definition 10.6 (Orthogonally diagonalizable)

A square matrix AA is orthogonally diagonalizable if A=QDQTA = QDQ^{T} for an orthogonal matrix QQ and a diagonal matrix DD; such a factorization is called an orthogonal decomposition of AA. Since QT=Q−1Q^{T} = Q^{-1} for an orthogonal matrix, this is a diagonalization A=PDP−1A = PDP^{-1} as in Theorem 8.30 in which the columns of P=QP = Q are orthonormal: they form an orthonormal basis of ℝn\mathbb{R}^n consisting of eigenvectors of AA.

Remark 10.7 (Block matrices)

The proof of the spectral theorem multiplies matrices that are cut into blocks. If an n×nn \times n matrix is written as (a𝐛T𝐜M)\begin{pmatrix} a & \mathbf{b}^{T} \\ \mathbf{c} & M \end{pmatrix}, with a number aa, vectors 𝐛,𝐜∈ℝn−1\mathbf{b}, \mathbf{c} \in \mathbb{R}^{n-1} and an (n−1)×(n−1)(n-1) \times (n-1) matrix MM, then products are computed block by block, exactly as for 2×22 \times 2 matrices, as long as the sizes match; for instance, (10T0N)(a𝐛T𝐜M)(10T0N′)=(a𝐛TN𝐜NM)(10T0N′)=(a𝐛TN′N𝐜NMN′):\begin{aligned} &\begin{pmatrix} 1 & \mathbf{0}^{T} \\ \mathbf{0} & N \end{pmatrix} \begin{pmatrix} a & \mathbf{b}^{T} \\ \mathbf{c} & M \end{pmatrix} \begin{pmatrix} 1 & \mathbf{0}^{T} \\ \mathbf{0} & N' \end{pmatrix} \\ &\qquad = \begin{pmatrix} a & \mathbf{b}^{T} \\ N\mathbf{c} & NM \end{pmatrix} \begin{pmatrix} 1 & \mathbf{0}^{T} \\ \mathbf{0} & N' \end{pmatrix} = \begin{pmatrix} a & \mathbf{b}^{T}N' \\ N\mathbf{c} & NMN' \end{pmatrix}: \end{aligned} first the left two factors are multiplied, then the result is multiplied by the factor on the right. This follows from the row–column description of the product (Proposition 4.12): each entry of a product is a sum over one index, and grouping that sum into the first index and the remaining ones gives the block formula.

Theorem 10.8 (The spectral theorem)

Suppose that AA is a real symmetric n×nn \times n matrix. Then AA is orthogonally diagonalizable: A=QDQT,Q=(𝐪1⋯𝐪n) orthogonal,D=diag(λ1,…,λn).A = QDQ^{T}, \qquad Q = (\mathbf{q}_1\ \cdots\ \mathbf{q}_n) \text{ orthogonal}, \qquad D = \operatorname{diag}(\lambda_1, \dots, \lambda_n) .(10.1) Here the λi\lambda_i are the eigenvalues of AA (all real), A𝐪i=λi𝐪iA\mathbf{q}_i = \lambda_i\mathbf{q}_i, and 𝐪1,…,𝐪n\mathbf{q}_1, \dots, \mathbf{q}_n is an orthonormal basis of ℝn\mathbb{R}^n consisting of eigenvectors of AA.

Corollary 10.9 (Spectral decomposition)

Let AA be symmetric, with orthonormal eigenvectors 𝐪1,…,𝐪n\mathbf{q}_1, \dots, \mathbf{q}_n and eigenvalues λ1,…,λn\lambda_1, \dots, \lambda_n as in (10.1). Then A=λ1𝐪1𝐪1T+λ2𝐪2𝐪2T+⋯+λn𝐪n𝐪nT,A = \lambda_1\,\mathbf{q}_1\mathbf{q}_1^{T} + \lambda_2\,\mathbf{q}_2\mathbf{q}_2^{T} + \cdots + \lambda_n\,\mathbf{q}_n\mathbf{q}_n^{T} ,(10.2) where 𝐪i𝐪iT\mathbf{q}_i\mathbf{q}_i^{T} is a symmetric matrix of rank one, the matrix of the orthogonal projection onto the line Span(𝐪i)\operatorname{Span}(\mathbf{q}_i). Also 𝐪1𝐪1T+⋯+𝐪n𝐪nT=QQT=In\mathbf{q}_1\mathbf{q}_1^{T} + \cdots + \mathbf{q}_n\mathbf{q}_n^{T} = QQ^{T} = I_n.

Remark 10.10 (How to diagonalize a symmetric matrix orthogonally)

To write a symmetric matrix AA as QDQTQDQ^{T}:

  1. Find the eigenvalues; by Lemma 10.5 all roots of pAp_A are real.
  2. For each eigenvalue find a basis of its eigenspace by row reduction.
  3. Apply Gram–Schmidt within each eigenspace and normalize. Eigenvectors from different eigenspaces are already orthogonal (Proposition 10.4), so only a repeated eigenvalue needs this step.
  4. Put the vectors into QQ and the eigenvalues, in the same order, into DD; check AQ=QDAQ = QD.

Example 10.11 (A 2×22 \times 2 symmetric matrix)

Let A=(5222)A = \begin{pmatrix} 5 & 2 \\ 2 & 2 \end{pmatrix}. Then pA(λ)=λ2−7λ+6=(λ−6)(λ−1)p_A(\lambda) = \lambda^2 - 7\lambda + 6 = (\lambda - 6)(\lambda - 1) (trace 77, determinant 66; Example 8.18). For λ=6\lambda = 6, A−6I2=(−122−4)A - 6I_2 = \begin{pmatrix} -1 & 2 \\ 2 & -4 \end{pmatrix}, with null space spanned by (2,1)T(2,\, 1)^{T}; for λ=1\lambda = 1, A−I2=(4221)A - I_2 = \begin{pmatrix} 4 & 2 \\ 2 & 1 \end{pmatrix}, with null space spanned by (−1,2)T(-1,\, 2)^{T}. The two eigenvectors are orthogonal, as Proposition 10.4 predicts: −2+2=0-2 + 2 = 0. Normalizing, Q=15(2−112),D=(6001),A=QDQT.Q = \frac{1}{\sqrt{5}}\begin{pmatrix} 2 & -1 \\ 1 & 2 \end{pmatrix}, \qquad D = \begin{pmatrix} 6 & 0 \\ 0 & 1 \end{pmatrix}, \qquad A = QDQ^{T} . The spectral decomposition (10.2) is A=6⋅15(4221)+1⋅15(1−2−24)=(24/512/512/56/5)+(1/5−2/5−2/54/5):\begin{aligned} A &= 6 \cdot \frac{1}{5}\begin{pmatrix} 4 & 2 \\ 2 & 1 \end{pmatrix} + 1 \cdot \frac{1}{5}\begin{pmatrix} 1 & -2 \\ -2 & 4 \end{pmatrix} \\ &= \begin{pmatrix} 24/5 & 12/5 \\ 12/5 & 6/5 \end{pmatrix} + \begin{pmatrix} 1/5 & -2/5 \\ -2/5 & 4/5 \end{pmatrix}: \end{aligned} AA stretches the direction (2,1)T(2,\, 1)^{T} by 66 and leaves the perpendicular direction (−1,2)T(-1,\, 2)^{T} unchanged.

Example 10.12 (A repeated eigenvalue)

Let B=(211121112)B = \begin{pmatrix} 2 & 1 & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 2 \end{pmatrix}. Expanding along the first row, pB(λ)=det(2−λ1112−λ1112−λ)=(2−λ)((2−λ)2−1)−((2−λ)−1)+(1−(2−λ))=(2−λ)(1−λ)(3−λ)−2(1−λ)=(1−λ)(λ2−5λ+4)=−(λ−4)(λ−1)2.\begin{aligned} p_B(\lambda) &= \det\begin{pmatrix} 2 - \lambda & 1 & 1 \\ 1 & 2 - \lambda & 1 \\ 1 & 1 & 2 - \lambda \end{pmatrix} \\ &= (2 - \lambda)\left((2 - \lambda)^2 - 1\right) - \left((2 - \lambda) - 1\right) + \left(1 - (2 - \lambda)\right) \\ &= (2 - \lambda)(1 - \lambda)(3 - \lambda) - 2(1 - \lambda) = (1 - \lambda)(\lambda^2 - 5\lambda + 4) \\ &= -(\lambda - 4)(\lambda - 1)^2 . \end{aligned} So the eigenvalues are 44 and 11, the latter of multiplicity 22. For λ=4\lambda = 4, B−4I3=(−2111−2111−2)∼(10−101−1000),B - 4I_3 = \begin{pmatrix} -2 & 1 & 1 \\ 1 & -2 & 1 \\ 1 & 1 & -2 \end{pmatrix} \sim \begin{pmatrix} 1 & 0 & -1 \\ 0 & 1 & -1 \\ 0 & 0 & 0 \end{pmatrix}, so E4=Span((1,1,1)T)E_4 = \operatorname{Span}\bigl((1,\, 1,\, 1)^{T}\bigr). For λ=1\lambda = 1, every row of B−I3B - I_3 is (1,1,1)(1,\ 1,\ 1), so E1E_1 is the plane x1+x2+x3=0x_1 + x_2 + x_3 = 0, with x2,x3x_2, x_3 free; the basic solutions 𝐰1=(−1,1,0)T\mathbf{w}_1 = (-1,\, 1,\, 0)^{T} and 𝐰2=(−1,0,1)T\mathbf{w}_2 = (-1,\, 0,\, 1)^{T} form a basis of E1E_1. This basis is orthogonal to E4E_4, as Proposition 10.4 predicts, but it is not itself orthogonal (𝐰1⋅𝐰2=1\mathbf{w}_1 \cdot \mathbf{w}_2 = 1). Gram–Schmidt inside the eigenspace gives 𝐰2−𝐰2⋅𝐰1𝐰1⋅𝐰1𝐰1=(−101)−12(−110)=12(−1−12),\mathbf{w}_2 - \frac{\mathbf{w}_2 \cdot \mathbf{w}_1}{\mathbf{w}_1 \cdot \mathbf{w}_1}\,\mathbf{w}_1 = \begin{pmatrix} -1 \\ 0 \\ 1 \end{pmatrix} - \frac{1}{2}\begin{pmatrix} -1 \\ 1 \\ 0 \end{pmatrix} = \frac{1}{2}\begin{pmatrix} -1 \\ -1 \\ 2 \end{pmatrix}, still an eigenvector for 11 (a combination of 𝐰1,𝐰2\mathbf{w}_1, \mathbf{w}_2). Normalizing the three vectors gives the columns of QQ: 𝐪1=13(111),𝐪2=12(−110),𝐪3=16(−1−12),\mathbf{q}_1 = \frac{1}{\sqrt{3}}\begin{pmatrix} 1 \\ 1 \\ 1 \end{pmatrix}, \qquad \mathbf{q}_2 = \frac{1}{\sqrt{2}}\begin{pmatrix} -1 \\ 1 \\ 0 \end{pmatrix}, \qquad \mathbf{q}_3 = \frac{1}{\sqrt{6}}\begin{pmatrix} -1 \\ -1 \\ 2 \end{pmatrix}, and with Q=(𝐪1𝐪2𝐪3)Q = (\mathbf{q}_1\ \mathbf{q}_2\ \mathbf{q}_3) and D=diag(4,1,1)D = \operatorname{diag}(4, 1, 1) we have B=QDQTB = QDQ^{T}. Any orthonormal basis of the plane would do for the last two columns: for a repeated eigenvalue QQ is not unique.

Definition 10.13 (Quadratic form)

A quadratic form on ℝn\mathbb{R}^n is a function Q(𝐱)=𝐱TA𝐱=∑i,jaijxixjQ(\mathbf{x}) = \mathbf{x}^{T}A\mathbf{x} = \sum_{i,j} a_{ij}x_ix_j, where AA is a symmetric n×nn \times n matrix, the matrix of the form. Every homogeneous polynomial of degree 22 in x1,…,xnx_1, \dots, x_n is of this kind, with a unique symmetric AA: the coefficient of xi2x_i^2 is aiia_{ii}, and the coefficient of xixjx_ix_j (i≠ji \neq j) is split equally, aij=aji=12(coefficient)a_{ij} = a_{ji} = \frac{1}{2}(\text{coefficient}).

Example 10.14 (The matrix of a quadratic form)

The form Q(𝐱)=5x12+4x1x2+2x22Q(\mathbf{x}) = 5x_1^2 + 4x_1x_2 + 2x_2^2 has the matrix A=(5222)A = \begin{pmatrix} 5 & 2 \\ 2 & 2 \end{pmatrix} of Example 10.11, and 2x12+2x22+2x32+2x1x2+2x1x3+2x2x32x_1^2 + 2x_2^2 + 2x_3^2 + 2x_1x_2 + 2x_1x_3 + 2x_2x_3 has the matrix BB of Example 10.12. The length squared, ∥𝐱∥2=𝐱TIn𝐱\|\mathbf{x}\|^2 = \mathbf{x}^{T}I_n\mathbf{x}, is the form of InI_n.

Theorem 10.15 (Principal axes)

Let A=QDQTA = QDQ^{T} as in (10.1). In the coordinates 𝐲=QT𝐱\mathbf{y} = Q^{T}\mathbf{x}, that is, 𝐱=Q𝐲\mathbf{x} = Q\mathbf{y}, the quadratic form has no cross terms: 𝐱TA𝐱=λ1y12+λ2y22+⋯+λnyn2,\mathbf{x}^{T}A\mathbf{x} = \lambda_1 y_1^2 + \lambda_2 y_2^2 + \cdots + \lambda_n y_n^2 ,(10.3) and ∥𝐲∥=∥𝐱∥\|\mathbf{y}\| = \|\mathbf{x}\|. The lines Span(𝐪i)\operatorname{Span}(\mathbf{q}_i) are the principal axes of the form.

Definition 10.16 (Definite and indefinite forms)

A symmetric matrix AA, and its quadratic form, are positive definite if 𝐱TA𝐱>0\mathbf{x}^{T}A\mathbf{x} > 0 for every 𝐱≠0\mathbf{x} \neq \mathbf{0}; positive semidefinite if 𝐱TA𝐱≥0\mathbf{x}^{T}A\mathbf{x} \ge 0 for every 𝐱\mathbf{x}; negative definite or semidefinite with the inequalities reversed; and indefinite if 𝐱TA𝐱\mathbf{x}^{T}A\mathbf{x} takes both positive and negative values.

Proposition 10.17 (Definiteness from the eigenvalues)

A symmetric matrix is positive definite if and only if all its eigenvalues are positive, positive semidefinite if and only if all are ≥0\ge 0, and indefinite if and only if it has a positive and a negative eigenvalue.

Example 10.18 (Definite and indefinite)

The form of Example 10.11 is positive definite (eigenvalues 6,16, 1), although it has the cross term 4x1x24x_1x_2. The matrix C=(1331)C = \begin{pmatrix} 1 & 3 \\ 3 & 1 \end{pmatrix} has eigenvalues 44 and −2-2, so x12+6x1x2+x22x_1^2 + 6x_1x_2 + x_2^2 is indefinite: it equals 88 at (1,1)(1,\, 1) and −4-4 at (1,−1)(1,\, -1), even though both diagonal entries of CC are positive.

Theorem 10.19 (Maximum and minimum of a quadratic form)

Let AA be symmetric with eigenvalues λ1≥λ2≥⋯≥λn\lambda_1 \ge \lambda_2 \ge \cdots \ge \lambda_n and orthonormal eigenvectors 𝐪1,…,𝐪n\mathbf{q}_1, \dots, \mathbf{q}_n. Then for every 𝐱∈ℝn\mathbf{x} \in \mathbb{R}^n λn∥𝐱∥2≤𝐱TA𝐱≤λ1∥𝐱∥2.\lambda_n\,\|\mathbf{x}\|^2 \;\le\; \mathbf{x}^{T}A\mathbf{x} \;\le\; \lambda_1\,\|\mathbf{x}\|^2 .(10.4) Consequently, on the unit sphere ∥𝐱∥=1\|\mathbf{x}\| = 1, the maximum of 𝐱TA𝐱\mathbf{x}^{T}A\mathbf{x} is λ1\lambda_1, attained at 𝐱=𝐪1\mathbf{x} = \mathbf{q}_1, and the minimum is λn\lambda_n, attained at 𝐱=𝐪n\mathbf{x} = \mathbf{q}_n. A unit vector attains the maximum if and only if it is an eigenvector for λ1\lambda_1 (and likewise for the minimum).

Example 10.20 (Extremes on the unit circle)

For Q(𝐱)=5x12+4x1x2+2x22Q(\mathbf{x}) = 5x_1^2 + 4x_1x_2 + 2x_2^2 (Example 10.14), Theorem 10.15 with the orthogonal matrix of Example 10.11 gives Q(𝐱)=6y12+y22Q(\mathbf{x}) = 6y_1^2 + y_2^2, and Theorem 10.19 says: subject to x12+x22=1x_1^2 + x_2^2 = 1, the largest value of QQ is 66, at ±15(2,1)\pm\frac{1}{\sqrt{5}}(2,\, 1), and the smallest is 11, at ±15(−1,2)\pm\frac{1}{\sqrt{5}}(-1,\, 2). The figure after this example shows why: the level curves Q=cQ = c are ellipses 6y12+y22=c6y_1^2 + y_2^2 = c with semi-axes c/6\sqrt{c/6} along 𝐪1\mathbf{q}_1 and c\sqrt{c} along 𝐪2\mathbf{q}_2, and the unit circle meets them only for 1≤c≤61 \le c \le 6.

2026-11-09T22:32:44.258201 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/
The level curves Q(𝐱)=1,2,4,6Q(\mathbf{x}) = 1, 2, 4, 6 of Q(𝐱)=5x12+4x1x2+2x22Q(\mathbf{x}) = 5x_1^2 + 4x_1x_2 + 2x_2^2 are ellipses with the principal axes Span(𝐪1)\operatorname{Span}(\mathbf{q}_1) and Span(𝐪2)\operatorname{Span}(\mathbf{q}_2). The unit circle (dashed) touches the level curve Q=6Q = 6 at ±𝐪1\pm\mathbf{q}_1, where QQ is largest on the circle, and Q=1Q = 1 at ±𝐪2\pm\mathbf{q}_2, where it is smallest.
Example 10.21 (Extremes in three variables)

For Q(𝐱)=2x12+2x22+2x32+2x1x2+2x1x3+2x2x3,Q(\mathbf{x}) = 2x_1^2 + 2x_2^2 + 2x_3^2 + 2x_1x_2 + 2x_1x_3 + 2x_2x_3 , with the matrix BB of Example 10.12, the maximum on the unit sphere is 44, attained only at ±13(1,1,1)\pm\frac{1}{\sqrt{3}}(1,\, 1,\, 1), and the minimum is 11, attained at every unit vector of the plane x1+x2+x3=0x_1 + x_2 + x_3 = 0, because the eigenvalue 11 has a two-dimensional eigenspace. Indeed Q(𝐱)=∥𝐱∥2+(x1+x2+x3)2Q(\mathbf{x}) = \|\mathbf{x}\|^2 + (x_1 + x_2 + x_3)^2.

Exercise 10.1 auto-check

What is the largest value of 3x12+2x1x2+3x223x_1^2 + 2x_1x_2 + 3x_2^2 subject to x12+x22=1x_1^2 + x_2^2 = 1?

Answer:
Exercise 10.2 auto-check

Which matrix is positive definite?

Exercise 10.3 auto-check

Which statement about an n×nn \times n matrix AA is true?

10.2  The singular value decomposition (SVD)

💡 Intuition

Most matrices are not symmetric, not even square. Still, every m×nm \times n matrix AA maps some orthonormal basis 𝐯1,…,𝐯n\mathbf{v}_1, \dots, \mathbf{v}_n of ℝn\mathbb{R}^n to mutually orthogonal vectors A𝐯1,…,A𝐯nA\mathbf{v}_1, \dots, A\mathbf{v}_n of ℝm\mathbb{R}^m. To find them, note that ∥A𝐱∥2=𝐱T(ATA)𝐱\|A\mathbf{x}\|^2 = \mathbf{x}^{T}(A^{T}A)\mathbf{x} is a quadratic form with the symmetric matrix ATAA^{T}A, and use the spectral theorem. Writing A𝐯i=σi𝐮iA\mathbf{v}_i = \sigma_i\mathbf{u}_i with unit vectors 𝐮i\mathbf{u}_i gives A=UΣVTA = U\Sigma V^{T}: a rotation (or reflection) VTV^{T}, then a stretch along the coordinate axes by the singular values σi\sigma_i, then another rotation UU. The figure in this section shows the picture in the plane: the unit circle goes to an ellipse with semi-axes σ1𝐮1\sigma_1\mathbf{u}_1 and σ2𝐮2\sigma_2\mathbf{u}_2.

Lemma 10.22 (The matrix ATAA^{T}A)

Let AA be m×nm \times n. Then ATAA^{T}A is symmetric, and all of its eigenvalues are real and nonnegative.

Definition 10.23 (Singular values)

Let AA be m×nm \times n, and let λ1≥λ2≥⋯≥λn≥0\lambda_1 \ge \lambda_2 \ge \cdots \ge \lambda_n \ge 0 be the eigenvalues of ATAA^{T}A. The singular values of AA are σi=λi\sigma_i = \sqrt{\lambda_i}, i=1,…,ni = 1, \dots, n, listed in decreasing order σ1≥σ2≥⋯≥σn≥0\sigma_1 \ge \sigma_2 \ge \cdots \ge \sigma_n \ge 0 (the λi\lambda_i are real and nonnegative by Lemma 10.22). If 𝐯i\mathbf{v}_i is a unit eigenvector of ATAA^{T}A for λi\lambda_i, then σi=∥A𝐯i∥\sigma_i = \|A\mathbf{v}_i\|, as in the proof of Lemma 10.22: the singular values are the lengths of the images of these eigenvectors. Exactly r=rankAr = \operatorname{rank} A of them are positive. Indeed, by the spectral theorem ATA=VDVTA^{T}A = VDV^{T} with D=diag(λ1,…,λn)D = \operatorname{diag}(\lambda_1, \dots, \lambda_n), so rank(ATA)=rankD\operatorname{rank}(A^{T}A) = \operatorname{rank} D is the number of nonzero λi\lambda_i (Theorem 7.37), and rank(ATA)=rankA\operatorname{rank}(A^{T}A) = \operatorname{rank} A by Remark 9.51.

Theorem 10.24 (The singular value decomposition (SVD))

Let AA be an m×nm \times n matrix of rank rr, with positive singular values σ1≥⋯≥σr>0\sigma_1 \ge \cdots \ge \sigma_r > 0. Then there exist orthogonal matrices U=(𝐮1⋯𝐮m)∈ℝm×mU = (\mathbf{u}_1\ \cdots\ \mathbf{u}_m) \in \mathbb{R}^{m \times m} and V=(𝐯1⋯𝐯n)∈ℝn×nV = (\mathbf{v}_1\ \cdots\ \mathbf{v}_n) \in \mathbb{R}^{n \times n}, and a matrix Σ=(Dr000)∈ℝm×n\Sigma = \begin{pmatrix} D_r & 0 \\ 0 & 0 \end{pmatrix} \in \mathbb{R}^{m \times n} with Dr=diag(σ1,…,σr)D_r = \operatorname{diag}(\sigma_1, \dots, \sigma_r), so that A=UΣVT.A = U\Sigma V^{T} .(10.5)

Remark 10.25 (Singular vectors)

Let A=UΣVTA = U\Sigma V^{T} be as in Theorem 10.24.

  1. Since VV is orthogonal, (10.5) is equivalent to AV=UΣAV = U\Sigma, which says column by column A𝐯i=σi𝐮i(1≤i≤r),A𝐯i=0(r<i≤n).A\mathbf{v}_i = \sigma_i\mathbf{u}_i \quad (1 \le i \le r), \qquad A\mathbf{v}_i = \mathbf{0} \quad (r < i \le n).(10.6)
  2. Since UU is orthogonal, (10.5) gives UTA=ΣVTU^{T}A = \Sigma V^{T}, which says row by row 𝐮iTA=σi𝐯iT(1≤i≤r),𝐮iTA=0T(r<i≤m),\mathbf{u}_i^{T}A = \sigma_i\mathbf{v}_i^{T} \quad (1 \le i \le r), \qquad \mathbf{u}_i^{T}A = \mathbf{0}^{T} \quad (r < i \le m), hence, transposing, AT𝐮i=σi𝐯i(1≤i≤r),AT𝐮i=0(r<i≤m).A^{T}\mathbf{u}_i = \sigma_i\mathbf{v}_i \quad (1 \le i \le r), \qquad A^{T}\mathbf{u}_i = \mathbf{0} \quad (r < i \le m).
  3. The columns 𝐯i\mathbf{v}_i are orthonormal eigenvectors of ATAA^{T}A, the right singular vectors. The columns 𝐮i\mathbf{u}_i are normalized (indeed orthonormal) eigenvectors of AATAA^{T}, the left singular vectors: by (a) and (b), AAT𝐮i=σiA𝐯i=σi2𝐮iAA^{T}\mathbf{u}_i = \sigma_iA\mathbf{v}_i = \sigma_i^2\mathbf{u}_i for i≤ri \le r and AAT𝐮i=0AA^{T}\mathbf{u}_i = \mathbf{0} for i>ri > r. Also 𝐮i=A𝐯i/σi\mathbf{u}_i = A\mathbf{v}_i / \sigma_i for i≤ri \le r. Any factorization (10.5) with U,VU, V orthogonal and Σ\Sigma of this shape is called a singular value decomposition (SVD) of AA.
  4. Transposing (10.5) gives AT=VΣTUTA^{T} = V\Sigma^{T}U^{T}, an SVD of ATA^{T}; so AA and ATA^{T} have the same positive singular values, and by (c) the positive eigenvalues of AATAA^{T} are σ12,…,σr2\sigma_1^2, \dots, \sigma_r^2, with eigenvectors 𝐮1,…,𝐮r\mathbf{u}_1, \dots, \mathbf{u}_r. To find the singular values one may therefore use the smaller of ATAA^{T}A and AATAA^{T}.

Corollary 10.26 (The SVD as a sum of rank-one matrices)

In the notation of Theorem 10.24, A=σ1𝐮1𝐯1T+σ2𝐮2𝐯2T+⋯+σr𝐮r𝐯rT=UrDrVrT,A = \sigma_1\mathbf{u}_1\mathbf{v}_1^{T} + \sigma_2\mathbf{u}_2\mathbf{v}_2^{T} + \cdots + \sigma_r\mathbf{u}_r\mathbf{v}_r^{T} = U_rD_rV_r^{T},(10.7) where Ur=(𝐮1⋯𝐮r)U_r = (\mathbf{u}_1\ \cdots\ \mathbf{u}_r) and Vr=(𝐯1⋯𝐯r)V_r = (\mathbf{v}_1\ \cdots\ \mathbf{v}_r). This compact SVD uses only the rr positive singular values; each 𝐮i𝐯iT\mathbf{u}_i\mathbf{v}_i^{T} is a matrix of rank 11.

Proposition 10.27 (What the SVD tells us)

Let A=UΣVTA = U\Sigma V^{T} be an SVD of an m×nm \times n matrix of rank rr.

  1. rankA\operatorname{rank} A is the number of positive singular values.
  2. The singular vectors give orthonormal bases of the four subspaces of AA: Col(A)=Span(𝐮1,…,𝐮r),Nul(AT)=Span(𝐮r+1,…,𝐮m),Row(A)=Span(𝐯1,…,𝐯r),Nul(A)=Span(𝐯r+1,…,𝐯n).\begin{aligned} \operatorname{Col}(A) &= \operatorname{Span}(\mathbf{u}_1, \dots, \mathbf{u}_r), \\ \operatorname{Nul}(A^{T}) &= \operatorname{Span}(\mathbf{u}_{r+1}, \dots, \mathbf{u}_m), \\ \operatorname{Row}(A) &= \operatorname{Span}(\mathbf{v}_1, \dots, \mathbf{v}_r), \\ \operatorname{Nul}(A) &= \operatorname{Span}(\mathbf{v}_{r+1}, \dots, \mathbf{v}_n). \end{aligned}
  3. max∥𝐱∥=1∥A𝐱∥=σ1\max_{\|\mathbf{x}\| = 1}\|A\mathbf{x}\| = \sigma_1, attained at 𝐱=𝐯1\mathbf{x} = \mathbf{v}_1.
  4. If AA is square (m=nm = n), then |detA|=σ1σ2⋯σn|\det A| = \sigma_1\sigma_2\cdots\sigma_n.

Remark 10.28 (The geometry of the SVD)

Read A𝐱=U(Σ(VT𝐱))A\mathbf{x} = U(\Sigma(V^{T}\mathbf{x})) from right to left: VTV^{T} takes the orthonormal basis 𝐯i\mathbf{v}_i to the standard basis without changing lengths or angles (Proposition 9.20); Σ\Sigma stretches the ii-th axis by σi\sigma_i (and drops or adds coordinates when m≠nm \neq n); UU takes the standard basis to the 𝐮i\mathbf{u}_i, again preserving lengths and angles. So, for an invertible n×nn \times n matrix, AA maps the unit sphere onto an ellipsoid with semi-axes σ1𝐮1,…,σn𝐮n\sigma_1\mathbf{u}_1, \dots, \sigma_n\mathbf{u}_n. Part (c) of Proposition 10.27 is the statement that the longest semi-axis has length σ1\sigma_1, and part (d) matches Theorem 5.33: the volume of the ellipsoid is σ1⋯σn\sigma_1\cdots\sigma_n times that of the ball.

2026-11-09T22:32:44.377274 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/
The map 𝐱↦A𝐱\mathbf{x} \mapsto A\mathbf{x} for A=(3045)A = \begin{pmatrix} 3 & 0 \\ 4 & 5 \end{pmatrix} of the next example. The orthonormal vectors 𝐯1,𝐯2\mathbf{v}_1, \mathbf{v}_2 go to the orthogonal vectors σ1𝐮1\sigma_1\mathbf{u}_1, σ2𝐮2\sigma_2\mathbf{u}_2, and the unit circle goes to an ellipse with these semi-axes, σ1=35\sigma_1 = 3\sqrt{5} and σ2=5\sigma_2 = \sqrt{5}.
Example 10.29 (An SVD of a 2×22 \times 2 matrix)

Let A=(3045)A = \begin{pmatrix} 3 & 0 \\ 4 & 5 \end{pmatrix}. Then ATA=(25202025),A^{T}A = \begin{pmatrix} 25 & 20 \\ 20 & 25 \end{pmatrix}, with eigenvalues 4545 and 55 and orthonormal eigenvectors 𝐯1=12(1,1)T\mathbf{v}_1 = \frac{1}{\sqrt{2}}(1,\, 1)^{T}, 𝐯2=12(−1,1)T\mathbf{v}_2 = \frac{1}{\sqrt{2}}(-1,\, 1)^{T}. So σ1=45=35\sigma_1 = \sqrt{45} = 3\sqrt{5} and σ2=5\sigma_2 = \sqrt{5}. By (10.6), 𝐮1=A𝐯1σ1=1352(39)=110(13),𝐮2=A𝐯2σ2=152(−31)=110(−31),\begin{aligned} \mathbf{u}_1 &= \frac{A\mathbf{v}_1}{\sigma_1} = \frac{1}{3\sqrt{5}\sqrt{2}}\begin{pmatrix} 3 \\ 9 \end{pmatrix} = \frac{1}{\sqrt{10}}\begin{pmatrix} 1 \\ 3 \end{pmatrix}, \\ \mathbf{u}_2 &= \frac{A\mathbf{v}_2}{\sigma_2} = \frac{1}{\sqrt{5}\sqrt{2}}\begin{pmatrix} -3 \\ 1 \end{pmatrix} = \frac{1}{\sqrt{10}}\begin{pmatrix} -3 \\ 1 \end{pmatrix}, \end{aligned} which are orthonormal, as the proof of Theorem 10.24 guarantees. Hence A=110(1−331)(35005)12(11−11).A = \frac{1}{\sqrt{10}}\begin{pmatrix} 1 & -3 \\ 3 & 1 \end{pmatrix} \begin{pmatrix} 3\sqrt{5} & 0 \\ 0 & \sqrt{5} \end{pmatrix} \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ -1 & 1 \end{pmatrix}. Check with part (d) of Proposition 10.27: σ1σ2=15=|detA|\sigma_1\sigma_2 = 15 = |\det A|. Note that the singular values are not the eigenvalues of AA, which are 33 and 55.

Example 10.30 (An SVD of a 2×32 \times 3 matrix)

Let M=(32223−2)M = \begin{pmatrix} 3 & 2 & 2 \\ 2 & 3 & -2 \end{pmatrix}, of rank 22. Here MTMM^{T}M is 3×33 \times 3 but MMTMM^{T} is only 2×22 \times 2, so we work with MMTMM^{T}: by part (d) of Remark 10.25 its positive eigenvalues are σ12,σ22\sigma_1^2, \sigma_2^2, with eigenvectors 𝐮1,𝐮2\mathbf{u}_1, \mathbf{u}_2. We have MMT=(178817),MM^{T} = \begin{pmatrix} 17 & 8 \\ 8 & 17 \end{pmatrix}, whose characteristic polynomial is det(MMT−λI2)=(17−λ)2−64=(λ−25)(λ−9),\det\left(MM^{T} - \lambda I_2\right) = (17 - \lambda)^2 - 64 = (\lambda - 25)(\lambda - 9), so σ1=5\sigma_1 = 5 and σ2=3\sigma_2 = 3, and the eigenvectors are 𝐮1=12(11),𝐮2=12(1−1).\mathbf{u}_1 = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix}, \qquad \mathbf{u}_2 = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ -1 \end{pmatrix}. The right singular vectors now follow from part (b) of Remark 10.25: transposing 𝐮iTM=σi𝐯iT\mathbf{u}_i^{T}M = \sigma_i\mathbf{v}_i^{T} gives 𝐯i=MT𝐮i/σi\mathbf{v}_i = M^{T}\mathbf{u}_i/\sigma_i. (This is the construction in the proof of Theorem 10.24 applied to MTM^{T}, whose SVD transposes to one of MM.) So 𝐯1=15⋅12(550)=12(110),𝐯2=13⋅12(1−14)=132(1−14).\mathbf{v}_1 = \frac{1}{5}\cdot\frac{1}{\sqrt{2}}\begin{pmatrix} 5 \\ 5 \\ 0 \end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \\ 0 \end{pmatrix}, \qquad \mathbf{v}_2 = \frac{1}{3}\cdot\frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ -1 \\ 4 \end{pmatrix} = \frac{1}{3\sqrt{2}}\begin{pmatrix} 1 \\ -1 \\ 4 \end{pmatrix}. Finally, 𝐯3\mathbf{v}_3 is a unit vector orthogonal to 𝐯1\mathbf{v}_1 and 𝐯2\mathbf{v}_2; solving x1+x2=0x_1 + x_2 = 0, x1−x2+4x3=0x_1 - x_2 + 4x_3 = 0 gives 𝐯3=13(2−2−1),M𝐯3=0.\mathbf{v}_3 = \frac{1}{3}\begin{pmatrix} 2 \\ -2 \\ -1 \end{pmatrix}, \qquad M\mathbf{v}_3 = \mathbf{0} . Hence M=12(111−1)⏟U(500030)⏟ΣVT,V=(𝐯1𝐯2𝐯3).M = \underbrace{\frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}}_{U} \underbrace{\begin{pmatrix} 5 & 0 & 0 \\ 0 & 3 & 0 \end{pmatrix}}_{\Sigma} V^{T}, \qquad V = (\mathbf{v}_1\ \mathbf{v}_2\ \mathbf{v}_3) . By part (b) of Proposition 10.27, Nul(M)=Span((2,−2,−1)T)\operatorname{Nul}(M) = \operatorname{Span}\bigl((2,\, -2,\, -1)^{T}\bigr). The compact form (10.7) reads M=5𝐮1𝐯1T+3𝐮2𝐯2T=52(110110)+12(1−14−11−4).M = 5\,\mathbf{u}_1\mathbf{v}_1^{T} + 3\,\mathbf{u}_2\mathbf{v}_2^{T} = \frac{5}{2}\begin{pmatrix} 1 & 1 & 0 \\ 1 & 1 & 0 \end{pmatrix} + \frac{1}{2}\begin{pmatrix} 1 & -1 & 4 \\ -1 & 1 & -4 \end{pmatrix}.

Remark 10.31 (Symmetric matrices, and computing the SVD)

If AA is symmetric with A=QDQTA = QDQ^{T}, then ATA=A2=QD2QTA^{T}A = A^2 = QD^2Q^{T}, so the singular values of AA are the absolute values |λi||\lambda_i| of its eigenvalues; for a positive semidefinite AA the spectral decomposition is an SVD. In general, as in the examples, one may compute the smaller of ATAA^{T}A and AATAA^{T}. Computer programs do not form ATAA^{T}A at all, for the reason given in Remark 9.54; they compute the SVD directly by orthogonal transformations, and the SVD is the most reliable way to determine the rank of a matrix whose entries carry rounding errors: count the singular values that are not negligibly small.

Exercise 10.4 auto-check

What is the largest singular value of (0230)\begin{pmatrix} 0 & 2 \\ 3 & 0 \end{pmatrix}?

Answer:
Exercise 10.5 auto-check

What is the (only positive) singular value of the 1×21 \times 2 matrix (34)\begin{pmatrix} 3 & 4 \end{pmatrix}?

Answer:
Exercise 10.6 auto-check

A 5×45 \times 4 matrix has singular values 7,2,0,07, 2, 0, 0. What is the dimension of its null space?

Answer:

10.3  The pseudoinverse and least squares

💡 Intuition

Lecture 9 solved least-squares problems when the columns of AA are independent, and left open what to do when they are not (Remark 9.59): then there are infinitely many least-squares solutions, and one wants the shortest. The SVD settles this in one stroke. In the orthonormal coordinates given by VV and UU, the matrix AA becomes the diagonal matrix Σ\Sigma, and for a diagonal matrix the best one can do is obvious: divide by the nonzero σi\sigma_i and set the other unknowns to 00. Translating back gives a matrix A†A^{\dagger}, the pseudoinverse, with A†𝐛A^{\dagger}\mathbf{b} the shortest least-squares solution.

Definition 10.32 (The pseudoinverse)

Let A=UΣVTA = U\Sigma V^{T} be an SVD of the m×nm \times n matrix AA of rank rr. The pseudoinverse (or Moore–Penrose inverse) of AA is the n×mn \times m matrix A†=VΣ†UT=1σ1𝐯1𝐮1T+⋯+1σr𝐯r𝐮rT=VrDr−1UrT,A^{\dagger} = V\Sigma^{\dagger}U^{T} = \frac{1}{\sigma_1}\mathbf{v}_1\mathbf{u}_1^{T} + \cdots + \frac{1}{\sigma_r}\mathbf{v}_r\mathbf{u}_r^{T} = V_rD_r^{-1}U_r^{T},(10.8) where Σ†\Sigma^{\dagger} is the n×mn \times m matrix with 1/σ1,…,1/σr1/\sigma_1, \dots, 1/\sigma_r in the positions (1,1),…,(r,r)(1,1), \dots, (r,r) and zeros elsewhere. (One can show that A†A^{\dagger} does not depend on the choice of the SVD; the next theorem gives a characterization that does not mention UU and VV.)

Theorem 10.33 (The shortest least-squares solution)

Let AA be m×nm \times n and 𝐛∈ℝm\mathbf{b} \in \mathbb{R}^m, and let 𝐱†=A†𝐛\mathbf{x}^{\dagger} = A^{\dagger}\mathbf{b}. Then:

  1. 𝐱†\mathbf{x}^{\dagger} is a least-squares solution of A𝐱=𝐛A\mathbf{x} = \mathbf{b};
  2. 𝐱†∈Row(A)\mathbf{x}^{\dagger} \in \operatorname{Row}(A), and it is the only least-squares solution in Row(A)\operatorname{Row}(A);
  3. every other least-squares solution is longer: if 𝐱̂\hat{\mathbf{x}} is a least-squares solution and 𝐱̂≠𝐱†\hat{\mathbf{x}} \neq \mathbf{x}^{\dagger}, then ∥𝐱̂∥>∥𝐱†∥\|\hat{\mathbf{x}}\| > \|\mathbf{x}^{\dagger}\|.

Proposition 10.34 (Properties of the pseudoinverse)

Let AA be m×nm \times n of rank rr.

  1. AA†=UrUrTAA^{\dagger} = U_rU_r^{T} is the matrix of the orthogonal projection onto Col(A)\operatorname{Col}(A), and A†A=VrVrTA^{\dagger}A = V_rV_r^{T} is the matrix of the orthogonal projection onto Row(A)\operatorname{Row}(A).
  2. If the columns of AA are independent (r=nr = n), then A†=(ATA)−1ATA^{\dagger} = (A^{T}A)^{-1}A^{T}, and A†𝐛A^{\dagger}\mathbf{b} is the 𝐱̂\hat{\mathbf{x}} of Lecture 9.
  3. If the rows of AA are independent (r=mr = m), then A†=AT(AAT)−1A^{\dagger} = A^{T}(AA^{T})^{-1}, and A𝐱=𝐛A\mathbf{x} = \mathbf{b} is consistent for every 𝐛\mathbf{b}, with shortest solution A†𝐛A^{\dagger}\mathbf{b}.
  4. If AA is square and invertible, then A†=A−1A^{\dagger} = A^{-1}.

Example 10.35 (Lecture 9's example with dependent columns)

In Remark 9.59, A=(121212)A = \begin{pmatrix} 1 & 2 \\ 1 & 2 \\ 1 & 2 \end{pmatrix} and 𝐛=(1,2,6)T\mathbf{b} = (1,\, 2,\, 6)^{T} had the least-squares solutions x1+2x2=3x_1 + 2x_2 = 3, and the shortest one was found to be (35,65)T(\frac{3}{5},\, \frac{6}{5})^{T}. Here ATA=(36612)A^{T}A = \begin{pmatrix} 3 & 6 \\ 6 & 12 \end{pmatrix} has the eigenvalues 1515 and 00, with 𝐯1=15(1,2)T\mathbf{v}_1 = \frac{1}{\sqrt{5}}(1,\, 2)^{T}; so σ1=15\sigma_1 = \sqrt{15}, 𝐮1=A𝐯1/σ1=13(1,1,1)T\mathbf{u}_1 = A\mathbf{v}_1/\sigma_1 = \frac{1}{\sqrt{3}}(1,\, 1,\, 1)^{T}, and A=15𝐮1𝐯1TA = \sqrt{15}\,\mathbf{u}_1\mathbf{v}_1^{T}. By (10.8), A†=115𝐯1𝐮1T=115(111222),A†𝐛=115(918)=(3/56/5),A^{\dagger} = \frac{1}{\sqrt{15}}\,\mathbf{v}_1\mathbf{u}_1^{T} = \frac{1}{15}\begin{pmatrix} 1 & 1 & 1 \\ 2 & 2 & 2 \end{pmatrix}, \qquad A^{\dagger}\mathbf{b} = \frac{1}{15}\begin{pmatrix} 9 \\ 18 \end{pmatrix} = \begin{pmatrix} 3/5 \\ 6/5 \end{pmatrix}, the same answer, now from a formula. Also AA†=13JAA^{\dagger} = \frac{1}{3}J, where JJ is the 3×33 \times 3 matrix of ones; this is the matrix of the projection onto the line Col(A)=Span((1,1,1)T)\operatorname{Col}(A) = \operatorname{Span}\bigl((1,\, 1,\, 1)^{T}\bigr) (part (a) of Proposition 10.34). It sends 𝐛\mathbf{b} to AA†𝐛=b1+b2+b33(111)=(333)=A𝐱†:AA^{\dagger}\mathbf{b} = \frac{b_1 + b_2 + b_3}{3}\begin{pmatrix} 1 \\ 1 \\ 1 \end{pmatrix} = \begin{pmatrix} 3 \\ 3 \\ 3 \end{pmatrix} = A\mathbf{x}^{\dagger}: each entry of 𝐛=(1,2,6)T\mathbf{b} = (1,\, 2,\, 6)^{T} is replaced by the mean (1+2+6)/3=3(1 + 2 + 6)/3 = 3 of its entries. So the best the columns of AA can do for this 𝐛\mathbf{b} is the constant vector (3,3,3)T(3,\, 3,\, 3)^{T}.

Example 10.36 (A system with more unknowns than equations)

For the matrix MM of Example 10.30 and 𝐛=(7,3)T\mathbf{b} = (7,\, 3)^{T}, the system M𝐱=𝐛M\mathbf{x} = \mathbf{b} is consistent (the rows of MM are independent) with infinitely many solutions, since Nul(M)=Span((2,−2,−1)T)\operatorname{Nul}(M) = \operatorname{Span}\bigl((2,\, -2,\, -1)^{T}\bigr). The shortest one is given by the proof of Theorem 10.33: with c1=𝐮1⋅𝐛=102c_1 = \mathbf{u}_1 \cdot \mathbf{b} = \frac{10}{\sqrt{2}} and c2=𝐮2⋅𝐛=42c_2 = \mathbf{u}_2 \cdot \mathbf{b} = \frac{4}{\sqrt{2}}, 𝐱†=c15𝐯1+c23𝐯2=(110)+29(1−14)=19(1178).\mathbf{x}^{\dagger} = \frac{c_1}{5}\,\mathbf{v}_1 + \frac{c_2}{3}\,\mathbf{v}_2 = \begin{pmatrix} 1 \\ 1 \\ 0 \end{pmatrix} + \frac{2}{9}\begin{pmatrix} 1 \\ -1 \\ 4 \end{pmatrix} = \frac{1}{9}\begin{pmatrix} 11 \\ 7 \\ 8 \end{pmatrix}. Check: M𝐱†=19(33+14+1622+21−16)=(73),M\mathbf{x}^{\dagger} = \frac{1}{9}\begin{pmatrix} 33 + 14 + 16 \\ 22 + 21 - 16 \end{pmatrix} = \begin{pmatrix} 7 \\ 3 \end{pmatrix}, and 𝐱†⋅(2,−2,−1)T=19(22−14−8)=0\mathbf{x}^{\dagger} \cdot (2,\, -2,\, -1)^{T} = \frac{1}{9}(22 - 14 - 8) = 0, so 𝐱†∈Row(M)\mathbf{x}^{\dagger} \in \operatorname{Row}(M). The same matrix comes from part (c) of Proposition 10.34: M†=MT(MMT)−1=145(722710−10),M^{\dagger} = M^{T}(MM^{T})^{-1} = \frac{1}{45}\begin{pmatrix} 7 & 2 \\ 2 & 7 \\ 10 & -10 \end{pmatrix}, M†(73)=145(553540)=19(1178).M^{\dagger}\begin{pmatrix} 7 \\ 3 \end{pmatrix} = \frac{1}{45}\begin{pmatrix} 55 \\ 35 \\ 40 \end{pmatrix} = \frac{1}{9}\begin{pmatrix} 11 \\ 7 \\ 8 \end{pmatrix}. Every other solution 𝐱†+t(2,−2,−1)T\mathbf{x}^{\dagger} + t\,(2,\, -2,\, -1)^{T}, t≠0t \neq 0, has length squared ∥𝐱†∥2+9t2>∥𝐱†∥2=269\|\mathbf{x}^{\dagger}\|^2 + 9t^2 > \|\mathbf{x}^{\dagger}\|^2 = \frac{26}{9}.

Remark 10.37 (Small singular values)

The factors 1/σi1/\sigma_i in (10.8) show the danger of a nearly dependent set of columns: a tiny but nonzero σi\sigma_i, perhaps produced by rounding, multiplies the component 𝐮i⋅𝐛\mathbf{u}_i \cdot \mathbf{b} of the data by a huge number. In practice one therefore treats singular values below a tolerance as 00 (a truncated pseudoinverse); this replaces AA by a nearby matrix of lower rank, which is the subject of Section 10.4.

Exercise 10.7 auto-check

What is the (1,1)(1,1) entry of the pseudoinverse of (1/2000)\begin{pmatrix} 1/2 & 0 \\ 0 & 0 \end{pmatrix}?

Answer:
Exercise 10.8 auto-check

The equation x1+x2=2x_1 + x_2 = 2 has infinitely many solutions. What is the first entry of the shortest one, A†𝐛A^{\dagger}\mathbf{b} with A=(11)A = \begin{pmatrix} 1 & 1 \end{pmatrix} and 𝐛=(2)\mathbf{b} = (2)?

Answer:

10.4  Best approximation by matrices of low rank

💡 Intuition

The compact SVD writes AA as a sum of rr rank-one pieces σi𝐮i𝐯iT\sigma_i\mathbf{u}_i\mathbf{v}_i^{T}, ordered by importance. Keeping only the first kk pieces gives a matrix AkA_k of rank kk that is cheap to store, k(m+n+1)k(m + n + 1) numbers instead of mnmn, and the Eckart–Young theorem says that no matrix of rank kk is closer to AA. This is the mathematics behind image compression, behind the principal components of a data set, and behind the “latent factors” of recommendation systems. To speak of “closer” we first need the size of a matrix.

Definition 10.38 (Two norms of a matrix)

For an m×nm \times n matrix AA:

  1. the Frobenius norm is ∥A∥F=∑i,jaij2\|A\|_F = \sqrt{\sum_{i,j} a_{ij}^2}, the length of AA viewed as a vector of mnmn entries;
  2. the spectral norm (or operator norm) is ∥A∥2=max∥𝐱∥=1∥A𝐱∥\|A\|_2 = \max_{\|\mathbf{x}\| = 1}\|A\mathbf{x}\|, the largest factor by which AA stretches a vector.
The distance between two matrices AA and BB of the same size is ∥A−B∥F\|A - B\|_F or ∥A−B∥2\|A - B\|_2.

Proposition 10.39 (The norms from the singular values)

If AA has singular values σ1≥⋯≥σr>0\sigma_1 \ge \cdots \ge \sigma_r > 0, then ∥A∥2=σ1,∥A∥F2=σ12+σ22+⋯+σr2.\|A\|_2 = \sigma_1, \qquad \|A\|_F^2 = \sigma_1^2 + \sigma_2^2 + \cdots + \sigma_r^2 .

Definition 10.40 (Truncated SVD)

For 0≤k≤r0 \le k \le r let Ak=σ1𝐮1𝐯1T+⋯+σk𝐮k𝐯kT,A_k = \sigma_1\mathbf{u}_1\mathbf{v}_1^{T} + \cdots + \sigma_k\mathbf{u}_k\mathbf{v}_k^{T} ,(10.9) the first kk terms of (10.7). It has rank kk, its SVD is that of AA with σk+1,…,σr\sigma_{k+1}, \dots, \sigma_r replaced by 00, and A−Ak=∑i>kσi𝐮i𝐯iTA - A_k = \sum_{i > k}\sigma_i\mathbf{u}_i\mathbf{v}_i^{T} has the singular values σk+1,…,σr\sigma_{k+1}, \dots, \sigma_r. Storing AkA_k takes the kk numbers σi\sigma_i and the k(m+n)k(m + n) entries of 𝐮i\mathbf{u}_i and 𝐯i\mathbf{v}_i.

Theorem 10.41 (Eckart–Young: best approximation of low rank)

Let AA be m×nm \times n with singular values σ1≥⋯≥σr>0\sigma_1 \ge \cdots \ge \sigma_r > 0, let 0≤k<r0 \le k < r, and let AkA_k be as in (10.9).

  1. ∥A−Ak∥2=σk+1\|A - A_k\|_2 = \sigma_{k+1} and ∥A−Ak∥F2=σk+12+⋯+σr2\|A - A_k\|_F^2 = \sigma_{k+1}^2 + \cdots + \sigma_r^2.
  2. For every m×nm \times n matrix BB of rank at most kk, ∥A−B∥2≥σk+1\|A - B\|_2 \ge \sigma_{k+1}.
  3. For every m×nm \times n matrix BB of rank at most kk, ∥A−B∥F≥∥A−Ak∥F\|A - B\|_F \ge \|A - A_k\|_F.
So AkA_k is a closest matrix of rank at most kk to AA, in both norms.

Example 10.42 (The best rank-one approximation of MM)

For M=(32223−2)M = \begin{pmatrix} 3 & 2 & 2 \\ 2 & 3 & -2 \end{pmatrix} of Example 10.30, with σ1=5\sigma_1 = 5 and σ2=3\sigma_2 = 3, M1=5𝐮1𝐯1T=(5/25/205/25/20),M−M1=(1/2−1/22−1/21/2−2).M_1 = 5\,\mathbf{u}_1\mathbf{v}_1^{T} = \begin{pmatrix} 5/2 & 5/2 & 0 \\ 5/2 & 5/2 & 0 \end{pmatrix}, \qquad M - M_1 = \begin{pmatrix} 1/2 & -1/2 & 2 \\ -1/2 & 1/2 & -2 \end{pmatrix}. By Theorem 10.41, ∥M−M1∥2=∥M−M1∥F=3\|M - M_1\|_2 = \|M - M_1\|_F = 3, and no rank-one matrix is closer to MM. Check with Proposition 10.39: ∥M∥F2=9+4+4+4+9+4=34=52+32,∥M−M1∥F2=14+14+4+14+14+4=9=32.\begin{aligned} \|M\|_F^2 &= 9 + 4 + 4 + 4 + 9 + 4 = 34 = 5^2 + 3^2 , \\ \|M - M_1\|_F^2 &= \tfrac{1}{4} + \tfrac{1}{4} + 4 + \tfrac{1}{4} + \tfrac{1}{4} + 4 = 9 = 3^2 . \end{aligned}

Example 10.43 (Image compression)

A grayscale image is a matrix of brightness values. The figure after this example shows a 64×6464 \times 64 picture and its truncated SVDs. Its singular values decrease quickly: σ1≈36.9\sigma_1 \approx 36.9, σ2≈6.7\sigma_2 \approx 6.7, σ3≈4.0\sigma_3 \approx 4.0, σ4≈2.6\sigma_4 \approx 2.6, and from the eighth on they are below 11. By Theorem 10.41(a) the error of AkA_k is σk+12+⋯+σ642\sqrt{\sigma_{k+1}^2 + \cdots + \sigma_{64}^2}, so a fast decay of the singular values means that a small kk suffices. The rank-11 image σ1𝐮1𝐯1T\sigma_1\mathbf{u}_1\mathbf{v}_1^{T} is a product of a column profile and a row profile, hence the stripes; each further term adds detail.

2026-11-09T22:32:44.533980 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/
A 64×6464 \times 64 grayscale picture (right) and its best approximations AkA_k of rank k=1,3,8k = 1, 3, 8. Below each: the number of stored values, k(64+64+1)k(64 + 64 + 1), and the relative error ∥A−Ak∥F/∥A∥F\|A - A_k\|_F / \|A\|_F. The rank-88 image is already close to the original at a quarter of the storage.
Example 10.44 (The best line through data points)

Let the rows of XX be data points in the plane with mean (0,0)(0, 0): X=(2112−1−2−2−1),XTX=(108810).X = \begin{pmatrix} 2 & 1 \\ 1 & 2 \\ -1 & -2 \\ -2 & -1 \end{pmatrix}, \qquad X^{T}X = \begin{pmatrix} 10 & 8 \\ 8 & 10 \end{pmatrix}. For a line Span(𝐰)\operatorname{Span}(\mathbf{w}) through the origin, with ∥𝐰∥=1\|\mathbf{w}\| = 1, the squared distance from a point 𝐩\mathbf{p} to the line is ∥𝐩∥2−(𝐩⋅𝐰)2\|\mathbf{p}\|^2 - (\mathbf{p} \cdot \mathbf{w})^2 (Pythagoras for the split 𝐩=(𝐩⋅𝐰)𝐰+𝐳\mathbf{p} = (\mathbf{p} \cdot \mathbf{w})\mathbf{w} + \mathbf{z} of Remark 9.13). Summing over the rows of XX, ∑pointsdist(𝐩,line)2=∥X∥F2−∥X𝐰∥2,\sum_{\text{points}} \operatorname{dist}(\mathbf{p}, \text{line})^2 = \|X\|_F^2 - \|X\mathbf{w}\|^2 , since the entries of X𝐰X\mathbf{w} are the numbers 𝐩⋅𝐰\mathbf{p} \cdot \mathbf{w}. This is smallest when ∥X𝐰∥\|X\mathbf{w}\| is largest, that is, for 𝐰=𝐯1\mathbf{w} = \mathbf{v}_1 (Proposition 10.27(c)), and the minimum is ∥X∥F2−σ12=σ22\|X\|_F^2 - \sigma_1^2 = \sigma_2^2. Here XTXX^{T}X has eigenvalues 1818 and 22 with 𝐯1=12(1,1)T\mathbf{v}_1 = \frac{1}{\sqrt{2}}(1,\, 1)^{T}: the best line is y=xy = x, and the sum of the squared perpendicular distances is σ22=2\sigma_2^2 = 2. The least-squares line y=cxy = c\,x of Lecture 9, which measures vertical distances, is different: its normal equation is 10c=810c = 8, so c=0.8c = 0.8, with the sum of squared vertical distances 3.63.6. The direction 𝐯1\mathbf{v}_1 is the first principal component of the data; in statistics this is principal component analysis.

2026-11-09T22:32:44.657835 image/svg+xml Matplotlib v3.10.9, https://matplotlib.org/
Four centered data points. Left: the line Span(𝐯1)\operatorname{Span}(\mathbf{v}_1), y=xy = x, minimizes the sum of the squared perpendicular distances. Right: the least-squares line of Lecture 9, y=0.8xy = 0.8\,x, minimizes the sum of the squared vertical distances.
Exercise 10.9 auto-check

A matrix has singular values 5,3,15, 3, 1. What is ∥A−A1∥F2\|A - A_1\|_F^2, the squared Frobenius error of its best rank-one approximation?

Answer:
Exercise 10.10 auto-check

How many numbers must be stored for the rank-55 approximation A5A_5 of a 100×80100 \times 80 matrix?

Answer:
Exercise 10.11 auto-check

A matrix has singular values 5,3,15, 3, 1. What is min∥A−B∥2\min \|A - B\|_2 over all matrices BB of rank at most 22?

Answer:
Remark 10.45 (Looking back)

The course began with the system A𝐱=𝐛A\mathbf{x} = \mathbf{b} and row reduction, which reveals the rank and the four subspaces of AA. The SVD reveals the same information, but with orthonormal bases and with the singular values measuring how strongly AA acts in each direction. That is why it is the tool of choice whenever the data are inexact: it gives the shortest least-squares solution, the numerical rank, and the best approximations of lower rank.

Index of statements

  1. Definition 10.1 (Symmetric matrix)
  2. Example 10.2 (Where symmetric matrices come from)
  3. Lemma 10.3 (Symmetric matrices move across the inner product)
  4. Proposition 10.4 (Eigenvectors of a symmetric matrix are orthogonal)
  5. Lemma 10.5 (A symmetric matrix has real eigenvalues)
  6. Definition 10.6 (Orthogonally diagonalizable)
  7. Remark 10.7 (Block matrices)
  8. Theorem 10.8 (The spectral theorem)
  9. Corollary 10.9 (Spectral decomposition)
  10. Remark 10.10 (How to diagonalize a symmetric matrix orthogonally)
  11. Example 10.11 (A 2×22 \times 2 symmetric matrix)
  12. Example 10.12 (A repeated eigenvalue)
  13. Definition 10.13 (Quadratic form)
  14. Example 10.14 (The matrix of a quadratic form)
  15. Theorem 10.15 (Principal axes)
  16. Definition 10.16 (Definite and indefinite forms)
  17. Proposition 10.17 (Definiteness from the eigenvalues)
  18. Example 10.18 (Definite and indefinite)
  19. Theorem 10.19 (Maximum and minimum of a quadratic form)
  20. Example 10.20 (Extremes on the unit circle)
  21. Example 10.21 (Extremes in three variables)
  22. Lemma 10.22 (The matrix ATAA^{T}A)
  23. Definition 10.23 (Singular values)
  24. Theorem 10.24 (The singular value decomposition (SVD))
  25. Remark 10.25 (Singular vectors)
  26. Corollary 10.26 (The SVD as a sum of rank-one matrices)
  27. Proposition 10.27 (What the SVD tells us)
  28. Remark 10.28 (The geometry of the SVD)
  29. Example 10.29 (An SVD of a 2×22 \times 2 matrix)
  30. Example 10.30 (An SVD of a 2×32 \times 3 matrix)
  31. Remark 10.31 (Symmetric matrices, and computing the SVD)
  32. Definition 10.32 (The pseudoinverse)
  33. Theorem 10.33 (The shortest least-squares solution)
  34. Proposition 10.34 (Properties of the pseudoinverse)
  35. Example 10.35 (Lecture 9's example with dependent columns)
  36. Example 10.36 (A system with more unknowns than equations)
  37. Remark 10.37 (Small singular values)
  38. Definition 10.38 (Two norms of a matrix)
  39. Proposition 10.39 (The norms from the singular values)
  40. Definition 10.40 (Truncated SVD)
  41. Theorem 10.41 (Eckart–Young: best approximation of low rank)
  42. Example 10.42 (The best rank-one approximation of MM)
  43. Example 10.43 (Image compression)
  44. Example 10.44 (The best line through data points)
  45. Remark 10.45 (Looking back)