Session 32 · Unit 3

Left and Right Inverses; Pseudoinverse


The first review lecture, organized around the question of what "inverse" can mean for an m-by-n matrix of rank r. Full rank gives the true two-sided inverse; full column rank gives a left inverse; full row rank gives a right inverse; and multiplying in the wrong order produces projections. For the general case, the pseudoinverse: A is a perfect, invertible map from row space to column space, and the SVD makes its inverse computable.

Four possibilities for an m×n matrix of rank r

This lecture is the first step of the final review, and Strang organizes it around “the most fundamental picture in linear algebra” — the four subspaces. For an m×nm \times n matrix of rank rr: the row space and null space are orthogonal complements in Rn\mathbb{R}^n (dimensions rr and nrn-r), and the column space and null space of ATA^T are orthogonal complements in Rm\mathbb{R}^m (dimensions rr and mrm-r). “Nobody could forget that picture, right? When you’re my age, even, you’ll remember the row space and the null space.”

The question of the day: what kinds of inverses can AA have? There are four cases, and each one is a statement about the ranks:

  1. Two-sided inverse: r=m=nr = m = n. Square, full rank — the nice case chapter two was all about. One matrix A1A^{-1} produces the identity from either side.
  2. Left inverse: r=n<mr = n < m. Full column rank — independent columns, probably more rows than columns.
  3. Right inverse: r=m<nr = m < n. Full row rank — independent rows, more columns than rows.
  4. Pseudoinverse: rr smaller than both mm and nn. The completely general case, where both null spaces are alive — and it’s those null spaces “that are screwing up inverses.”

A rectangular matrix can never have a two-sided inverse: if mnm \neq n, then either AA or ATA^T has free variables, so one of them has a genuine null space. And “if a matrix takes a vector to zero, well, there’s no way an inverse can, like, bring it back to life.”

Full column rank: the left inverse

Suppose r=nr = n: the nn columns are independent. Then the null space of AA contains only the zero vector, and the row space is all of Rn\mathbb{R}^n. Consequence for equations: Ax=bA\mathbf{x} = \mathbf{b} has zero or one solutions. If a particular solution exists, it is the solution — there’s nothing in the null space to add on. But since the rows are probably not independent, elimination can produce rows where zero must equal something nonzero, so for some right-hand sides there is no solution at all.

Now the key combination of the course: ATAA^T A. If the rank of AA is nn, then ATAA^T A — an n×nn \times n symmetric matrix — also has rank nn. “That’s the beautiful fact.” So ATAA^T A is invertible, and that hands us a one-sided inverse of AA itself:

Why does it work? Put the parentheses in the right place: [(ATA)1AT]A=(ATA)1(ATA)=I\big[(A^T A)^{-1} A^T\big] A = (A^T A)^{-1}(A^T A) = I. This was “the totally crucial case for least squares,” because the central least-squares equation ATAx^=ATbA^T A \hat{\mathbf{x}} = A^T \mathbf{b} has ATAA^T A as its coefficient matrix — and with full column rank, that matrix is invertible and we’re go.

Note what’s good and what’s bad in this case: ATAA^T A is invertible, but AATA A^T is not — the bad product for this case.

Full row rank: the right inverse

Now the mirror image, r=mr = m: the mm rows are independent, the columns are not. The null space of ATA^T contains only zero — no combination of the rows gives the zero row. So elimination never produces a zero row, we never hit the “zero equals one” problem, and Ax=bA\mathbf{x} = \mathbf{b} always has a solution — but too many. There are nn variables and mm pivots, hence nmn - m free variables: infinitely many solutions.

Everything flips. Now AATA A^T is the good, invertible matrix (m×mm \times m, full rank), and the right inverse comes out completely parallel to the left one:

There are other left inverses and other right inverses — these formulas are just “our favorite” ones. (The pseudoinverse will turn out to be the minimal choice, with no extra stuff.)

Put the inverse on the wrong side: a projection

Before leaving the one-sided cases, Strang asks the question you should ask: the left inverse gives II when it multiplies from the left — but what if we multiply in the other order? Compute

AAleft1=A(ATA)1ATA\, A^{-1}_{\text{left}} = A (A^T A)^{-1} A^T

Everybody in the room ought to recognize that matrix: it’s PP, the projection onto the column space. “It’s trying to be the identity matrix, right? A projection matrix tries to be the identity matrix, but you’ve given it an impossible job.” It is the identity where it can be — on the column space — and zero elsewhere.

Same story on the other side. Put the right inverse on the left:

Aright1A=AT(AAT)1AA^{-1}_{\text{right}}\, A = A^T (A A^T)^{-1} A

That’s another projection — the same shape of formula with AA and ATA^T reversed — this time the projection onto the row space. Again it’s trying to be the identity, “but there’s only so much the matrix can do.”

The pseudoinverse: A is perfect from row space to column space

Now the general case: rank rr smaller than both mm and nn. What’s a reasonable inverse? Look at the picture. Take a vector x\mathbf{x} in the row space and multiply by AA. Where is AxA\mathbf{x}? Always in the column space — AxA\mathbf{x} is a combination of the columns. Almost every vector in Rn\mathbb{R}^n has a row space component and a null space component, and AA kills the null space component. But restrict attention to the row space alone, and something remarkable happens: the map from row space to column space is one-to-one. We’ve got a chance, because both spaces have the same dimension rr.

Strang calls the proof “a perfect question on a final exam,” because it’s exactly what chapters three and four teach. Suppose the conclusion failed: Ax=AyA\mathbf{x} = A\mathbf{y}, which is the same as A(xy)=0A(\mathbf{x} - \mathbf{y}) = \mathbf{0}. Then xy\mathbf{x} - \mathbf{y} is in the null space. But x\mathbf{x} and y\mathbf{y} are both in the row space, and the row space is a vector space, so xy\mathbf{x} - \mathbf{y} is also in the row space. A vector in both the null space and the row space — orthogonal complements — must be the zero vector. So x=y\mathbf{x} = \mathbf{y}: start from two different vectors, get two different vectors.

Why does anyone need this? Statisticians “discovered, oh boy, this is the thing that we needed all our lives.” They live on least squares — linear regression — and least squares only works when AA has full column rank. But experiments get repeated; measurements fail to be independent; and then ATAA^T A goes singular and the whole machine breaks. The pseudoinverse “just arrived at the right moment, and it’s the right quantity.”

Computing A⁺ from the SVD

How do you actually find A+A^+? Start from the Singular Value Decomposition,

A=UΣVTA = U \Sigma V^T

with UU and VV orthogonal and Σ\Sigma diagonal. The diagonal matrix Σ\Sigma is “the best example, the simplest example we could ever have of our general setup”: m×nm \times n, rank rr, with σ1,,σr\sigma_1, \ldots, \sigma_r on the diagonal and zeroes everywhere else.

Now assemble A+A^+ from the factors. In A=UΣVTA = U\Sigma V^T, the orthogonal matrices are perfectly invertible — the inverse of VTV^T is VV, the inverse of UU is UTU^T. All the trouble, all the null space, lives in Σ\Sigma, and we just found its pseudoinverse. So:

A+=VΣ+UTA^+ = V\, \Sigma^+\, U^T

The beauty of the SVD here is that “it puts all the problems into this diagonal matrix where it’s clear what to do.” One could pad Σ+\Sigma^+ with extra entries that multiply the zero blocks and change nothing essential, but the good pseudoinverse is the one with no extra stuff — the minimal matrix that gives the best result, ΣΣ+\Sigma\Sigma^+ equal to rr ones.

One administrative note Strang makes twice: the pseudoinverse lives at the end of chapter seven and won’t appear on the final. But everything it’s built from — rank, free variables, the four subspaces, projections, orthogonality of row space and null space — “is all what the course was about, chapters one, two, three, four.”

Problems

Work these before revealing the solutions — the lecture’s formulas and the four-subspace picture are all you need.

Problem 32.1 Computing a left inverse

The matrix

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

has full column rank (r=n=2r = n = 2, m=3m = 3). Find its left inverse Aleft1=(ATA)1ATA^{-1}_{\text{left}} = (A^TA)^{-1}A^T and verify that Aleft1A=IA^{-1}_{\text{left}}\,A = I.

Show solution

First the good matrix:

ATA=[110011][101101]=[2112],(ATA)1=13[2112]A^T A = \begin{bmatrix} 1 & 1 & 0 \\ 0 & 1 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 \\ 1 & 1 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix}, \qquad (A^TA)^{-1} = \frac{1}{3}\begin{bmatrix} 2 & -1 \\ -1 & 2 \end{bmatrix}

Then

Aleft1=13[2112][110011]=13[211112]A^{-1}_{\text{left}} = \frac{1}{3}\begin{bmatrix} 2 & -1 \\ -1 & 2 \end{bmatrix} \begin{bmatrix} 1 & 1 & 0 \\ 0 & 1 & 1 \end{bmatrix} = \frac{1}{3}\begin{bmatrix} 2 & 1 & -1 \\ -1 & 1 & 2 \end{bmatrix}

Check:

Aleft1A=13[211112][101101]=13[3003]=IA^{-1}_{\text{left}}\,A = \frac{1}{3}\begin{bmatrix} 2 & 1 & -1 \\ -1 & 1 & 2 \end{bmatrix} \begin{bmatrix} 1 & 0 \\ 1 & 1 \\ 0 & 1 \end{bmatrix} = \frac{1}{3}\begin{bmatrix} 3 & 0 \\ 0 & 3 \end{bmatrix} = I

A 2×32 \times 3 matrix times a 3×23 \times 2 matrix giving the 2×22 \times 2 identity — exactly the left-inverse pattern.

Problem 32.2 Right inverse and the wrong-order product

The matrix A=[122]A = \begin{bmatrix} 1 & 2 & 2 \end{bmatrix} has full row rank (r=m=1r = m = 1, n=3n = 3). Find its right inverse Aright1=AT(AAT)1A^{-1}_{\text{right}} = A^T(AA^T)^{-1}, verify AAright1=IA\,A^{-1}_{\text{right}} = I, and identify the matrix Aright1AA^{-1}_{\text{right}}\,A.

Show solution

The good matrix is AAT=1+4+4=9AA^T = 1 + 4 + 4 = 9, so (AAT)1=19(AA^T)^{-1} = \frac{1}{9} and

Aright1=19[122]A^{-1}_{\text{right}} = \frac{1}{9}\begin{bmatrix} 1 \\ 2 \\ 2 \end{bmatrix}

Check: AAright1=19(1+4+4)=1=IA\,A^{-1}_{\text{right}} = \frac{1}{9}(1 + 4 + 4) = 1 = I (the 1×11\times 1 identity).

In the wrong order:

Aright1A=19[122][122]=19[122244244]A^{-1}_{\text{right}}\,A = \frac{1}{9}\begin{bmatrix} 1 \\ 2 \\ 2 \end{bmatrix}\begin{bmatrix} 1 & 2 & 2 \end{bmatrix} = \frac{1}{9}\begin{bmatrix} 1 & 2 & 2 \\ 2 & 4 & 4 \\ 2 & 4 & 4 \end{bmatrix}

This is AT(AAT)1AA^T(AA^T)^{-1}A — the projection onto the row space of AA, the line through (1,2,2)(1, 2, 2) in R3\mathbb{R}^3. It’s symmetric and squares to itself, but it is not the identity: it can’t be, because AA has a two-dimensional null space.

Problem 32.3 The final-exam proof

Let AA be any m×nm \times n matrix, and suppose x\mathbf{x} and y\mathbf{y} are two vectors in the row space of AA with Ax=AyA\mathbf{x} = A\mathbf{y}. Prove that x=y\mathbf{x} = \mathbf{y}. Which two facts about the four subspaces does the proof use?

Show solution

From Ax=AyA\mathbf{x} = A\mathbf{y} we get A(xy)=0A(\mathbf{x} - \mathbf{y}) = \mathbf{0}, so xy\mathbf{x} - \mathbf{y} lies in the null space of AA.

Since x\mathbf{x} and y\mathbf{y} are both in the row space, and the row space is a subspace (closed under subtraction), xy\mathbf{x} - \mathbf{y} also lies in the row space.

The row space and null space are orthogonal complements in Rn\mathbb{R}^n, so their intersection is the zero vector alone: a vector orthogonal to itself has xy2=0\|\mathbf{x}-\mathbf{y}\|^2 = 0. Therefore xy=0\mathbf{x} - \mathbf{y} = \mathbf{0}, i.e. x=y\mathbf{x} = \mathbf{y}.

The two facts used: subspaces are closed under linear combinations, and the row space is the orthogonal complement of the null space. This is exactly why AA is a one-to-one (invertible) map from row space to column space — the fact that defines the pseudoinverse.

Problem 32.4 Pseudoinverse of a diagonal matrix

Find the pseudoinverse of

Σ=[500000]\Sigma = \begin{bmatrix} 5 & 0 \\ 0 & 0 \\ 0 & 0 \end{bmatrix}

and compute both products ΣΣ+\Sigma\,\Sigma^+ and Σ+Σ\Sigma^+\,\Sigma. What is each product, and what space does each project onto?

Show solution

Here m=3m = 3, n=2n = 2, r=1r = 1. Invert the nonzero singular value and take the transposed shape:

Σ+=[1500000](2×3)\Sigma^+ = \begin{bmatrix} \tfrac{1}{5} & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix} \quad (2 \times 3)

Then

ΣΣ+=[100000000] (3×3),Σ+Σ=[1000] (2×2)\Sigma\,\Sigma^+ = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix} \ (3 \times 3), \qquad \Sigma^+\,\Sigma = \begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix} \ (2 \times 2)

Neither is the identity — each has r=1r = 1 ones and then zeroes. ΣΣ+\Sigma\Sigma^+ is the projection onto the column space of Σ\Sigma (the first coordinate axis in R3\mathbb{R}^3), and Σ+Σ\Sigma^+\Sigma is the projection onto the row space (the first coordinate axis in R2\mathbb{R}^2). That is the best any pseudoinverse can do.

Problem 32.5 Pseudoinverse via the SVD

The rank-one matrix

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

has SVD A=UΣVTA = U\Sigma V^T with σ1=2\sigma_1 = 2 and u1=v1=12(1,1)\mathbf{u}_1 = \mathbf{v}_1 = \frac{1}{\sqrt{2}}(1, 1). Use A+=VΣ+UTA^+ = V\Sigma^+U^T to find A+A^+, and check that AA+AA^+ is the projection onto the column space.

Show solution

Since only one singular value is nonzero, Σ+\Sigma^+ has the single entry 12\frac{1}{2}, and

A+=v11σ1u1T=1212[11]12[11]=14[1111]A^+ = \mathbf{v}_1 \cdot \frac{1}{\sigma_1} \cdot \mathbf{u}_1^T = \frac{1}{2} \cdot \frac{1}{\sqrt{2}}\begin{bmatrix} 1 \\ 1 \end{bmatrix} \cdot \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1 \end{bmatrix} = \frac{1}{4}\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}

So A+=14AA^+ = \frac{1}{4}A. Check the product:

AA+=14[1111][1111]=12[1111]A A^+ = \frac{1}{4}\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix} = \frac{1}{2}\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}

That is exactly u1u1T\mathbf{u}_1\mathbf{u}_1^T, the projection onto the line through (1,1)(1,1) — the column space of AA. (By symmetry A+AA^+A is the same matrix here, projecting onto the row space, which is the same line.) Note AA itself is singular, with no left or right inverse — but its pseudoinverse exists and does the best an inverse can do.