Unit 10, lesson 49

Pseudoinverses and Minimum-Norm Solutions

How the singular value decomposition defines the pseudoinverse, why it gives the least-squares solution of minimum norm, and how the null-space component separates choosing a solution from recovering lost information.

  • Video 49
  • Pseudoinverses and Minimum-Norm Solutions

Two measurements read 44 and 33, and they come from three unknown inputs through x1+x3=4x_1 + x_3 = 4 and x2+x3=3x_2 + x_3 = 3. Every input (4−t,3−t,t)(4 - t, 3 - t, t) produces exactly these readings, so the data alone cannot say which input was used. This lesson builds the pseudoinverse from the singular value decomposition and shows that it picks the solution of smallest length, or, when no exact solution exists, the least-squares solution of smallest length. That choice is a stated rule for selecting one representative, and it does not recover the part of the input that the measurements never saw. Tuples such as (4−t,3−t,t)(4 - t, 3 - t, t) stand for column vectors throughout.

Key terms

Pseudoinverse of the diagonal factor

Definition Let Σ\Sigma be an m×nm \times n rectangular diagonal matrix with diagonal entries σ1≥⋯≥σq≥0\sigma_1 \ge \cdots \ge \sigma_q \ge 0, where q=min⁡(m,n)q = \min(m, n), and let rr be the number of positive entries. Its pseudoinverse Σ+\Sigma^{+} is the n×mn \times m rectangular diagonal matrix whose diagonal entries are 1/σ1,…,1/σr1/\sigma_1, \dots, 1/\sigma_r followed by q−rq - r zeros. So the shape is transposed, every positive entry is replaced by its reciprocal, and every zero stays zero. The m×mm \times m product ΣΣ+\Sigma\Sigma^{+} and the n×nn \times n product Σ+Σ\Sigma^{+}\Sigma are both diagonal, with rr leading ones on the diagonal and zeros everywhere else. The rule depends on whether an entry is exactly zero. A small positive entry gets a large reciprocal, and replacing it by zero instead is truncation, a different procedure that needs its own stated criterion.

In plain words Undo every stretch that can be undone, and put zero wherever the map erased a coordinate. An erased coordinate left no trace in the output, so there is nothing to divide back.

Example For the 2×32 \times 3 factor of rank 22,

Σ=[300010],Σ+=[1/300100],\begin{gathered} \Sigma = \begin{bmatrix} \sqrt{3} & 0 & 0 \\ 0 & 1 & 0 \end{bmatrix}, \\[0.4em] \Sigma^{+} = \begin{bmatrix} 1/\sqrt{3} & 0 \\ 0 & 1 \\ 0 & 0 \end{bmatrix}, \end{gathered}

and ΣΣ+=I2\Sigma\Sigma^{+} = I_2 while Σ+Σ=diag⁡(1,1,0)\Sigma^{+}\Sigma = \operatorname{diag}(1, 1, 0). For the rank-one factor with rows (2,0)(2, 0), (0,0)(0, 0) and (0,0)(0, 0), the pseudoinverse has rows (12,0,0)(\tfrac12, 0, 0) and (0,0,0)(0, 0, 0), and ΣΣ+=diag⁡(1,0,0)\Sigma\Sigma^{+} = \operatorname{diag}(1, 0, 0). The invertible matrix diag⁡(1,0.01)\operatorname{diag}(1, 0.01) has pseudoinverse diag⁡(1,100)\operatorname{diag}(1, 100), its ordinary inverse, while diag⁡(1,0)\operatorname{diag}(1, 0) has pseudoinverse diag⁡(1,0)\operatorname{diag}(1, 0).

Pseudoinverse

Definition Let AA be a real m×nm \times n matrix with a singular value decomposition A=UΣV⊤A = U\Sigma V^{\top}. Its pseudoinverse is the n×mn \times m matrix

A+=VΣ+U⊤.A^{+} = V\Sigma^{+}U^{\top}.

It does not depend on which SVD is used, because for every b\mathbf{b} the vector A+bA^{+}\mathbf{b} is the unique least-squares solution of Ax=bA\mathbf{x} = \mathbf{b} of smallest norm, as the last card shows. If AA has rank r≥1r \ge 1, only the first rr columns of UU and VV meet nonzero entries of Σ+\Sigma^{+}, so a compact SVD A=UrΣrVr⊤A = U_r\Sigma_r V_r^{\top} already gives A+=VrΣr−1Ur⊤A^{+} = V_r\Sigma_r^{-1}U_r^{\top}. The two products of A+A^{+} with AA are

AA+=U ΣΣ+ U⊤,A+A=V Σ+Σ V⊤.\begin{aligned} AA^{+} &= U\,\Sigma\Sigma^{+}\,U^{\top}, \\[0.4em] A^{+}A &= V\,\Sigma^{+}\Sigma\,V^{\top}. \end{aligned}

Since ΣΣ+\Sigma\Sigma^{+} keeps exactly the coordinates along u1,…,ur\mathbf{u}_1, \dots, \mathbf{u}_r and Σ+Σ\Sigma^{+}\Sigma exactly those along v1,…,vr\mathbf{v}_1, \dots, \mathbf{v}_r, the first product is the orthogonal projection of Rm\mathbb{R}^m onto Col⁡A\operatorname{Col} A and the second is the orthogonal projection of Rn\mathbb{R}^n onto Row⁡A\operatorname{Row} A. The first equals ImI_m only when r=mr = m, and the second equals InI_n only when r=nr = n. When AA is square and invertible, A+=A−1A^{+} = A^{-1}. When AA has full row rank mm, A+=A⊤(AA⊤)−1A^{+} = A^{\top}(AA^{\top})^{-1}, and when AA has full column rank nn, A+=(A⊤A)−1A⊤A^{+} = (A^{\top}A)^{-1}A^{\top}. These two formulas need their rank conditions, since otherwise the matrix to be inverted is singular. Transposing an SVD shows that (A⊤)+=(A+)⊤(A^{\top})^{+} = (A^{+})^{\top}.

In plain words The pseudoinverse reads an output along the left singular directions, divides each reachable coordinate by its stretch, drops the coordinates the map cannot reach, sets every erased input coordinate to zero, and rebuilds an input. It inverts the map on the directions the map can see and makes a definite choice about the rest.

Example The matrix

A=[101011]A = \begin{bmatrix} 1 & 0 & 1 \\ 0 & 1 & 1 \end{bmatrix}

has full row rank, and AA⊤AA^{\top} has rows (2,1)(2, 1) and (1,2)(1, 2) and determinant 33. So

A+=A⊤(AA⊤)−1=13[100111][2−1−12]=13[2−1−1211].\begin{aligned} A^{+} &= A^{\top}(AA^{\top})^{-1} \\[0.4em] &= \frac{1}{3}\begin{bmatrix} 1 & 0 \\ 0 & 1 \\ 1 & 1 \end{bmatrix}\begin{bmatrix} 2 & -1 \\ -1 & 2 \end{bmatrix} \\[0.4em] &= \frac{1}{3}\begin{bmatrix} 2 & -1 \\ -1 & 2 \\ 1 & 1 \end{bmatrix}. \end{aligned}

The same matrix comes from VΣ+U⊤V\Sigma^{+}U^{\top} with the SVD of AA that has singular values 3\sqrt{3} and 11. Since Col⁡A=R2\operatorname{Col} A = \mathbb{R}^2, the product AA+AA^{+} is I2I_2, whereas

A+A=13[2−11−121112]=I−13nn⊤\begin{aligned} A^{+}A &= \frac{1}{3}\begin{bmatrix} 2 & -1 & 1 \\ -1 & 2 & 1 \\ 1 & 1 & 2 \end{bmatrix} \\[0.4em] &= I - \frac{1}{3}\mathbf{n}\mathbf{n}^{\top} \end{aligned}

with n=(−1,−1,1)\mathbf{n} = (-1, -1, 1), the projection that removes the component along the kernel direction n\mathbf{n}. For the transpose C=A⊤C = A^{\top} the pseudoinverse is C+=(A+)⊤C^{+} = (A^{+})^{\top}, with rows 13(2,−1,1)\tfrac13(2, -1, 1) and 13(−1,2,1)\tfrac13(-1, 2, 1), and it equals (C⊤C)−1C⊤(C^{\top}C)^{-1}C^{\top} because CC has full column rank.

Null-space component

Definition Let AA be a real m×nm \times n matrix. Because Row⁡A\operatorname{Row} A and Null⁡A\operatorname{Null} A are orthogonal complements in Rn\mathbb{R}^n, every input splits uniquely as x=xrow+xnull\mathbf{x} = \mathbf{x}_{\text{row}} + \mathbf{x}_{\text{null}} with xrow\mathbf{x}_{\text{row}} in Row⁡A\operatorname{Row} A and xnull\mathbf{x}_{\text{null}} in Null⁡A\operatorname{Null} A, namely

xrow=A+Ax,xnull=(I−A+A)x.\begin{aligned} \mathbf{x}_{\text{row}} &= A^{+}A\mathbf{x}, \\[0.4em] \mathbf{x}_{\text{null}} &= (I - A^{+}A)\mathbf{x}. \end{aligned}

The vector xnull\mathbf{x}_{\text{null}} is the null-space component of x\mathbf{x}. It has no effect on the output, Ax=AxrowA\mathbf{x} = A\mathbf{x}_{\text{row}}, and by the Pythagorean theorem ∥x∥2=∥xrow∥2+∥xnull∥2\lVert \mathbf{x} \rVert^2 = \lVert \mathbf{x}_{\text{row}} \rVert^2 + \lVert \mathbf{x}_{\text{null}} \rVert^2. Two inputs give the same output exactly when their difference lies in Null⁡A\operatorname{Null} A, that is, exactly when they have the same row-space component and differ only in their null-space components.

In plain words The null-space component is the part of an input that the measurements cannot see. Any amount of it can be added or removed without changing the output, so the output carries no information about how much of it was present.

Example For the matrix AA above, the inputs (4,3,0)(4, 3, 0) and (2,1,2)(2, 1, 2) both give (4,3)(4, 3), and their difference (2,2,−2)=−2n(2, 2, -2) = -2\mathbf{n} lies in the kernel. Both have the row-space component A+A (4,3,0)=(53,23,73)A^{+}A\,(4, 3, 0) = (\tfrac53, \tfrac23, \tfrac73), and their null-space components are (73,73,−73)=−73n(\tfrac73, \tfrac73, -\tfrac73) = -\tfrac73\mathbf{n} and (13,13,−13)=−13n(\tfrac13, \tfrac13, -\tfrac13) = -\tfrac13\mathbf{n}. For the first input the lengths add up as they should, ∥(4,3,0)∥2=25=263+493\lVert (4, 3, 0) \rVert^2 = 25 = \tfrac{26}{3} + \tfrac{49}{3}. If the true input happens to be (4,3,0)(4, 3, 0), the readings (4,3)(4, 3) carry no trace of its component −73n-\tfrac73\mathbf{n}, and no formula applied to the readings can restore it.

Minimum-norm solution

Definition Let AA be a real m×nm \times n matrix and b\mathbf{b} a vector in Col⁡A\operatorname{Col} A, so that Ax=bA\mathbf{x} = \mathbf{b} is consistent. Among its solutions there is exactly one of smallest Euclidean norm, the minimum-norm solution x+\mathbf{x}^{+}, and

x+=A+b.\mathbf{x}^{+} = A^{+}\mathbf{b}.

It is the unique solution in Row⁡A\operatorname{Row} A, equivalently the unique solution orthogonal to Null⁡A\operatorname{Null} A. Indeed A+bA^{+}\mathbf{b} lies in Row⁡A\operatorname{Row} A, since the columns of VΣ+V\Sigma^{+} lie in the span of v1,…,vr\mathbf{v}_1, \dots, \mathbf{v}_r with r=rank⁡Ar = \operatorname{rank} A, and AA+b=bAA^{+}\mathbf{b} = \mathbf{b}, since AA+AA^{+} projects onto Col⁡A\operatorname{Col} A, which contains b\mathbf{b}. Every solution has the form x++h\mathbf{x}^{+} + \mathbf{h} with h\mathbf{h} in Null⁡A\operatorname{Null} A, and

∥x++h∥2=∥x+∥2+∥h∥2,\lVert \mathbf{x}^{+} + \mathbf{h} \rVert^2 = \lVert \mathbf{x}^{+} \rVert^2 + \lVert \mathbf{h} \rVert^2,

so every h≠0\mathbf{h} \ne \mathbf{0} makes the norm strictly larger. When AA has full row rank every b\mathbf{b} is consistent and x+=A⊤(AA⊤)−1b\mathbf{x}^{+} = A^{\top}(AA^{\top})^{-1}\mathbf{b}. The criterion uses Euclidean length in the given coordinates. If the unknowns carry unrelated units, rescaling them can change which solution is selected, so the scaling has to be chosen deliberately.

In plain words The solutions of a consistent system with a nonzero kernel form a flat set parallel to the kernel, a line, a plane or a higher-dimensional flat that misses the origin unless b=0\mathbf{b} = \mathbf{0}. The minimum-norm solution is the point of that set closest to the origin, the foot of the perpendicular, and it is the only solution with no null-space component.

Example For the matrix AA above and b=(4,3)\mathbf{b} = (4, 3),

A+b=13[8−3−4+64+3]=[5/32/37/3].A^{+}\mathbf{b} = \frac{1}{3}\begin{bmatrix} 8 - 3 \\ -4 + 6 \\ 4 + 3 \end{bmatrix} = \begin{bmatrix} 5/3 \\ 2/3 \\ 7/3 \end{bmatrix}.

It solves the system, since 53+73=4\tfrac53 + \tfrac73 = 4 and 23+73=3\tfrac23 + \tfrac73 = 3, and it is the member t=73t = \tfrac73 of the family (4−t,3−t,t)(4 - t, 3 - t, t). Its dot product with the kernel direction n\mathbf{n} is (−5−2+7)/3=0(-5 - 2 + 7)/3 = 0. Along the whole family,

∥(4−t,3−t,t)∥2=3t2−14t+25=3(t−73)2+263,\begin{aligned} \lVert (4 - t, 3 - t, t) \rVert^2 &= 3t^2 - 14t + 25 \\[0.4em] &= 3\left(t - \tfrac{7}{3}\right)^2 + \tfrac{26}{3}, \end{aligned}

so the squared norm is smallest, equal to 263\tfrac{26}{3}, exactly at t=73t = \tfrac73.

Least-squares solution of minimum norm

Definition Let AA be a real m×nm \times n matrix of rank rr and let b\mathbf{b} be any vector in Rm\mathbb{R}^m. Among all least-squares solutions of Ax=bA\mathbf{x} = \mathbf{b} there is exactly one of smallest Euclidean norm, and it is A+bA^{+}\mathbf{b}. To prove it, take an SVD A=UΣV⊤A = U\Sigma V^{\top} and write β=U⊤b\boldsymbol{\beta} = U^{\top}\mathbf{b} and c=V⊤x\mathbf{c} = V^{\top}\mathbf{x}. Orthogonal matrices preserve length, so

∥b−Ax∥2=∑i=1r(βi−σici)2+∑i=r+1mβi2,∥x∥2=∑i=1nci2.\begin{aligned} \lVert \mathbf{b} - A\mathbf{x} \rVert^2 &= \sum_{i=1}^{r} (\beta_i - \sigma_i c_i)^2 \\[0.4em] &\quad + \sum_{i=r+1}^{m} \beta_i^2, \\[0.4em] \lVert \mathbf{x} \rVert^2 &= \sum_{i=1}^{n} c_i^2. \end{aligned}

The second sum does not depend on x\mathbf{x}, and it is empty when r=mr = m. So x\mathbf{x} is a least-squares solution exactly when ci=βi/σic_i = \beta_i / \sigma_i for i=1,…,ri = 1, \dots, r, while cr+1,…,cnc_{r+1}, \dots, c_n are free. Among these the norm is smallest exactly when every free coordinate is 00. That choice is c=Σ+β\mathbf{c} = \Sigma^{+}\boldsymbol{\beta}, which means x=VΣ+U⊤b=A+b\mathbf{x} = V\Sigma^{+}U^{\top}\mathbf{b} = A^{+}\mathbf{b}. If b\mathbf{b} lies in Col⁡A\operatorname{Col} A, the residual is zero and this is the minimum-norm solution of the previous card. If AA has full column rank, so r=nr = n, nothing is free, the least-squares solution is unique, and it equals (A⊤A)−1A⊤b(A^{\top}A)^{-1}A^{\top}\mathbf{b}.

In plain words Least squares pins down the input coordinates along the directions the map stretches, which span the row space, and leaves the null-space coordinates free. The pseudoinverse sets those free coordinates to zero. In effect it projects the data onto the column space and then picks the shortest input that produces the projection.

Example Let C=A⊤C = A^{\top}, which sends (x1,x2)(x_1, x_2) to (x1,x2,x1+x2)(x_1, x_2, x_1 + x_2), and b=(1,1,0)\mathbf{b} = (1, 1, 0). No exact solution exists, since the first two outputs force x1=x2=1x_1 = x_2 = 1 and then the third output would be 22. With the pseudoinverse C+C^{+} found above,

C+b=13[2−1+0−1+2+0]=[1/31/3].C^{+}\mathbf{b} = \frac{1}{3}\begin{bmatrix} 2 - 1 + 0 \\ -1 + 2 + 0 \end{bmatrix} = \begin{bmatrix} 1/3 \\ 1/3 \end{bmatrix}.

The predictions are C (13,13)=(13,13,23)C\,(\tfrac13, \tfrac13) = (\tfrac13, \tfrac13, \tfrac23) and the residual is (23,23,−23)(\tfrac23, \tfrac23, -\tfrac23). The residual is orthogonal to both columns of CC, since 23+0−23=0\tfrac23 + 0 - \tfrac23 = 0 and 0+23−23=00 + \tfrac23 - \tfrac23 = 0, so the predictions are the projection of b\mathbf{b} onto Col⁡C\operatorname{Col} C, and the smallest squared error is 3⋅49=433 \cdot \tfrac49 = \tfrac43. The columns of CC are independent, so this is the only least-squares solution, and the minimum-norm rule has nothing extra to choose here.

Check yourself

  1. Let DD be the 2×32 \times 3 matrix with rows (3,0,0)(3, 0, 0) and (0,0,0)(0, 0, 0), and let b=(6,1)\mathbf{b} = (6, 1). Find D+D^{+}, all least-squares solutions of Dx=bD\mathbf{x} = \mathbf{b}, and the one of minimum norm.
Show the answer

The matrix DD is already rectangular diagonal with entries 3≥03 \ge 0, so it has an SVD with U=I2U = I_2, Σ=D\Sigma = D and V=I3V = I_3, and D+D^{+} is the 3×23 \times 2 matrix with rows (13,0)(\tfrac13, 0), (0,0)(0, 0) and (0,0)(0, 0). Since Dx=(3x1,0)D\mathbf{x} = (3x_1, 0),

∥b−Dx∥2=(6−3x1)2+1,\lVert \mathbf{b} - D\mathbf{x} \rVert^2 = (6 - 3x_1)^2 + 1,

so the least-squares solutions are (2,s,t)(2, s, t) for all ss and tt, with residual (0,1)(0, 1) that no input can remove. The pseudoinverse gives D+b=(2,0,0)D^{+}\mathbf{b} = (2, 0, 0), the member with s=t=0s = t = 0 and the shortest one. The second reading is the component of b\mathbf{b} along e2\mathbf{e}_2, which is orthogonal to Col⁡D\operatorname{Col} D, so it is ignored, and the coordinates x2x_2 and x3x_3 are invisible and set to zero.

  1. The equation x1+2x2+2x3=9x_1 + 2x_2 + 2x_3 = 9 is solved by (9,0,0)(9, 0, 0). Find the null-space component of this solution and the minimum-norm solution.
Show the answer

The coefficient matrix is the row [122]\begin{bmatrix} 1 & 2 & 2 \end{bmatrix}, whose row space is the line spanned by a=(1,2,2)\mathbf{a} = (1, 2, 2), with ∥a∥2=9\lVert \mathbf{a} \rVert^2 = 9. The row-space component of (9,0,0)(9, 0, 0) is its projection onto that line,

(9,0,0)⋅aa⋅a a=99 a=(1,2,2),\frac{(9, 0, 0) \cdot \mathbf{a}}{\mathbf{a} \cdot \mathbf{a}}\,\mathbf{a} = \frac{9}{9}\,\mathbf{a} = (1, 2, 2),

so the null-space component is (9,0,0)−(1,2,2)=(8,−2,−2)(9, 0, 0) - (1, 2, 2) = (8, -2, -2). It is orthogonal to a\mathbf{a}, since 8−4−4=08 - 4 - 4 = 0. The minimum-norm solution is (1,2,2)(1, 2, 2), which satisfies 1+4+4=91 + 4 + 4 = 9 and has length 33, while (9,0,0)(9, 0, 0) has length 99, and indeed 81=9+7281 = 9 + 72. The full row rank formula agrees, since for the row matrix R=a⊤R = \mathbf{a}^{\top} it gives R⊤(RR⊤)−1⋅9=99 aR^{\top}(RR^{\top})^{-1} \cdot 9 = \tfrac{9}{9}\,\mathbf{a}. A solution that looks simple need not be the shortest one.

  1. Let MM have rows (1,2)(1, 2) and (2,4)(2, 4), and let b=(5,0)\mathbf{b} = (5, 0). Explain why the formula (M⊤M)−1M⊤b(M^{\top}M)^{-1}M^{\top}\mathbf{b} cannot be used, then find all least-squares solutions of Mx=bM\mathbf{x} = \mathbf{b} and the one of minimum norm.
Show the answer

The second column of MM is twice the first, so MM has rank 11 and

M⊤M=[5101020]M^{\top}M = \begin{bmatrix} 5 & 10 \\ 10 & 20 \end{bmatrix}

has determinant 00. The formula needs full column rank, and here there is no inverse. Write w=15(1,2)\mathbf{w} = \tfrac{1}{\sqrt{5}}(1, 2). Then M=5 ww⊤M = 5\,\mathbf{w}\mathbf{w}^{\top} is a compact SVD with σ1=5\sigma_1 = 5 and u1=v1=w\mathbf{u}_1 = \mathbf{v}_1 = \mathbf{w}, and the second singular value is 00. The projection of b\mathbf{b} onto Col⁡M\operatorname{Col} M is (b⋅w) w=(1,2)(\mathbf{b} \cdot \mathbf{w})\,\mathbf{w} = (1, 2), so the least-squares solutions are the solutions of x1+2x2=1x_1 + 2x_2 = 1. The pseudoinverse is

M+=15 ww⊤=125[1224],M^{+} = \frac{1}{5}\,\mathbf{w}\mathbf{w}^{\top} = \frac{1}{25}\begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix},

and M+b=125(5,10)=(15,25)M^{+}\mathbf{b} = \tfrac{1}{25}(5, 10) = (\tfrac15, \tfrac25). It satisfies 15+45=1\tfrac15 + \tfrac45 = 1 and is a multiple of (1,2)(1, 2), so it lies in the row space. Every least-squares solution is (15,25)+s(−2,1)(\tfrac15, \tfrac25) + s(-2, 1), with squared norm 15+5s2\tfrac15 + 5s^2, smallest at s=0s = 0. The residual (5,0)−(1,2)=(4,−2)(5, 0) - (1, 2) = (4, -2) is orthogonal to (1,2)(1, 2), and the smallest squared error is 2020.

How this lesson connects

Where this leads in Linear Algebra II