Lecture 16 · Week 4· 18:42
Inverse matrices
Invertibility, Gauss–Jordan inversion.
Saved in this browser only. No account needed.
TranscriptThe full text of the lecture. Click any sentence to play the video from there.
Today: undoing a matrix
Welcome back. For numbers, undoing a multiplication is easy. If three x equals six, we multiply both sides by one third, the inverse of three, and we get x equals two. For matrices, we now have the same kind of equation: A x equals b. And in lecture thirteen we saw that a matrix moves the plane. So the question is: can we undo what A does? Here is a shear. It slides every point sideways, by an amount that grows with its height. Clearly, we can slide everything back.
But this projection flattens the whole plane onto a line, and nothing can unflatten it. Today we make this precise. We define the inverse of a matrix, find a formula for two by two matrices, and prove the rules that inverses obey. Then we learn Gauss–Jordan inversion, a method that computes the inverse of any invertible matrix, or tells us that there is none.
Invertible matrices
Here is the definition. Let A be a square matrix, n by n, over a field F. We say that A is invertible if there is an n by n matrix B such that A B equals the identity, and B A equals the identity too. Such a matrix B is called an inverse of A. Both products use the matrix multiplication of lecture fourteen, and both must give I n. Let's test it on the shear. A has rows (one, one) and (zero, one). To undo it, we slide back the other way, so we guess B with rows (one, minus one) and (zero, one).
Column one of A B is A times the first column of B, (one, zero). That takes one copy of the first column of A, which is (one, zero). Column two is A times the vector (minus one, one). That is minus one times the column (one, zero), plus one times the column (one, one). In the first coordinate, minus one plus one is zero. In the second, zero plus one is one. So column two is (zero, one), and A B is the identity. The other order works the same way. B times (one, zero) is the first column of B, which is (one, zero). And B times (one, one) is the vector (one, zero) plus (minus one, one), which is the vector (zero, one). So B A is the identity too, and the shear is invertible.
In pictures: A slides the plane to the right, and B slides it back. In either order, every point ends where it started. Not every matrix can be undone, though. Let's look at one that has no inverse. Now the projection P, with rows (one, zero) and (zero, zero). It sends the vector (zero, one) to the zero vector. Suppose some matrix B had B P equal to the identity.
Then the vector (zero, one) would equal B P times (zero, one). That is B, times P times (zero, one), which is B times the zero vector, which is the zero vector. That is impossible, so P has no inverse. A square matrix that sends a nonzero vector to zero can never be undone.
One inverse, and solving A x = b
Can a matrix have two different inverses? No. Suppose B and C are both inverses of A. Then B equals B times the identity. The identity is A C, so this is B times A C. Matrix multiplication is associative, so we may regroup this as B A, times C. And B A is the identity, so we get C. So the inverse is unique, and we give it a name: A inverse, written as A with a superscript minus one. It is defined by two equations: A times A inverse is I, and A inverse times A is I.
A warning: A inverse is not one over A. There is no division of matrices. The inverse is a matrix in its own right, and we always multiply by it. Now the reason inverses matter. If A is invertible, then for every b, the system A x equals b has exactly one solution, namely x equals A inverse b. It is a solution: A times A inverse b is A A inverse, times b, which is I b, which is b.
And it is the only one. If A x equals b, multiply both sides on the left by A inverse. The left side becomes A inverse A, times x, which is I x, which is x. So x must equal A inverse b. This is exactly how we solved three x equals six: we multiplied by the inverse. But with matrices, the side matters. We multiply on the left, because A x has A on the left.
Two by two inverses
For two by two matrices, there is a formula. Let A have rows (a, b) and (c, d). The number a d minus b c decides everything. If a d minus b c is not zero, then A is invertible, and its inverse is one over a d minus b c, times the matrix with rows (d, minus b) and (minus c, a). In words: swap the two diagonal entries, change the signs of the other two, and divide by a d minus b c. And if a d minus b c is zero, then A is not invertible, just like the projection we saw earlier.
For the proof, call the matrix with rows (d, minus b), and (minus c, and a), by the letter N. We compute A N, one column at a time. The first column is A times the vector (d, minus c). That is d times the column (a, c), minus c times the column (b, d). In the first coordinate, that is a d minus b c. In the second coordinate, it is c d minus c d, which is zero.
The second column is A times the vector (minus b, a). That is minus b times the column (a, c), plus a times the column (b, d). In the first coordinate, minus a b plus a b is zero. In the second coordinate, we get minus b c plus a d. So A N is a d minus b c, times the identity. The same computation in the other order gives the same result for N A. When a d minus b c is not zero, we divide by it, and both products become the identity. Now suppose that a d minus b c is zero. Then A N is the zero matrix.
Suppose, for a contradiction, that A had an inverse. Then N would equal A inverse times A N, which is A inverse times the zero matrix, which is the zero matrix. The entries of N are the entries of A, up to order and sign. So A itself would be the zero matrix. But the zero matrix has no inverse, since zero times any matrix is zero, never the identity. This contradiction shows that A is not invertible. The number a d minus b c is called the determinant of A. We meet it properly in week nine, where it measures how A scales areas.
Let's use the formula on the matrix of lecture one, with rows (two, minus one) and (one, one). Here a d minus b c is two times one, minus minus one times one. That is two plus one, which is three. So A inverse is one third, times the matrix with rows (one, one) and (minus one, two). We swapped the two and the one on the diagonal, and changed the signs of the minus one and the one. Now we solve A x equals the vector (one, five) in one step: x is A inverse times (one, five). By the row rule, the first entry is one third of one plus five, which is two. The second entry is one third of minus one plus ten, which is three.
So x is (two, three), the solution we found in lecture one. And for any other right hand side, the same A inverse solves the system at once. The matrix from lecture twelve, with rows (one, two) and (two, four), has a d minus b c equal to four minus four, which is zero. Its columns lie on one line, and it has no inverse.
Rules for inverses
Inverses follow a few rules. Let A and B be invertible n by n matrices. First, A inverse is invertible, and its inverse is A. The two equations that define A inverse say exactly this, read from the other side. Second, the product A B is invertible, and its inverse is B inverse times A inverse. Notice the order: it is reversed.
To check it, we multiply A B by B inverse A inverse. By associativity, the middle pair, B times B inverse, comes together, and it is the identity. What is left is A times A inverse, which is the identity. The product in the other order works the same way. Think of putting on socks, and then shoes. To undo it, you take off the shoes first, and then the socks. The last step done is the first step undone. Third, the transpose of A is invertible, and its inverse is the transpose of A inverse. By the rule for the transpose of a product, from lecture fifteen, A transpose times A inverse transpose is the transpose of A inverse times A. That is the transpose of the identity, which is the identity. The other order works the same way.
One product is enough
So far, to show that B is the inverse of A, we have checked two products, A B and B A. Matrix multiplication is not commutative, so it seems that we need both. But for square matrices, one is enough. Here is the statement. If A and X are n by n matrices, and A X equals the identity, then X A equals the identity too. So X is the inverse of A. This proof is demanding, so take it slowly, and pause or rewatch it if you need to. It uses the two pivot theorems from lecture twelve.
Step one. The system X y equals zero has only the trivial solution. Indeed, if X y is zero, then y equals I y, which is A X y, which is A times zero, which is zero. By lecture twelve, this means that an echelon form of X has a pivot in every column. X is square, so that makes n pivots in n rows, and each row holds at most one pivot. So every row has a pivot too. By the other theorem of lecture twelve, a pivot in every row means that X z equals b has a solution, for every b.
Step two. Take any vector b, and choose z with X z equal to b. Then X A, times b, is X A X z. Now regroup: A X in the middle is the identity, so this is X z, which is b. So X A sends every vector b to itself, just as the identity does. Taking for b the columns of the identity, each column of X A is the matching column of the identity. So X A is the identity. This may look like a technicality, but it is what makes the next method work. And it is special to square matrices. For matrices that are not square, one product can be an identity while the other is not.
Gauss–Jordan inversion
A word before we start. The next few minutes give the general method and why it works, and at first this may feel long or abstract. It becomes much clearer, and very practical, once we work through an example. So if it does not click yet, keep going, and come back to this part afterwards. Now, how do we find the inverse of a bigger matrix? Write the unknown inverse X by its columns, x one up to x n. The equation A X equals I says, column by column, that A x one equals e one, and so on, up to A x n equals e n. Here e j is the column of the identity with a one in position j. So we must solve n systems, all with the same matrix A. Row reduction treats each column on its own, so we can solve them all at once: we write A with the whole identity beside it, and row reduce.
Here is the method, called Gauss–Jordan inversion. Row reduce the matrix A bar I to reduced row echelon form. If the left block becomes the identity, then the right block is A inverse. If the left block cannot become the identity, then A is not invertible. Why does it work? Suppose the left block becomes I, and call the right block X. Look at one column, e j. The same row operations take A bar e j to I bar x j. Row operations keep the solutions, so A x equals e j has the same solution as I x equals x j, which is x j itself. So A x j equals e j for every j, which says that A X equals I. By the result we just proved, X A is I too. So X is A inverse.
Now suppose that the reduced form of A is not the identity. A square matrix in reduced form, with a pivot in every column, is the identity. So some column has no pivot. That column gives a free variable, so A x equals zero has a nontrivial solution. But for an invertible matrix, A x equals zero has only one solution, namely zero itself. So A is not invertible. Together: A is invertible exactly when its reduced row echelon form is the identity. In lecture seventeen, we will collect many more conditions that are equivalent to invertibility.
Inverting a three by three matrix
Let's invert a three by three matrix. A has first row (one, two, zero), second row (zero, one, one), and third row (one, two, one). We write it with I three beside it. Forward phase. The first column needs a zero in row three, so we replace row three by row three minus row one. Column by column: one minus one is zero, two minus two is zero, and one minus zero is one. After the bar: zero minus one is minus one, zero minus zero is zero, and one minus zero is one.
The left block is now in echelon form, with pivots one, one, and one. Now the backward phase, starting from the last pivot. To clear the one above it in row two, we replace row two by row two minus row three. Zero minus zero is zero, one minus zero is one, and one minus one is zero. After the bar: zero minus minus one is one, one minus zero is one, and zero minus one is minus one. Row one already has a zero in column three. Next comes the pivot in row two. Above it is a two, so we replace row one by row one minus two times row two.
One minus two times zero is one, two minus two times one is zero, and zero minus two times zero is zero. After the bar: one minus two times one is minus one, zero minus two times one is minus two, and zero minus two times minus one is two. The left block is the identity. So A is invertible, and A inverse is the right block, with first row (minus one, minus two, two), second row (one, one, minus one), and third row (minus one, zero, one). Let's check one column. We multiply A by the first column of A inverse, the vector (minus one, one, minus one), with the row rule. First row: minus one, plus two, plus zero, is one. Second row: zero, plus one, minus one, is zero. Third row: minus one, plus two, minus one, is zero. That is e one, as it should be. The other two columns check in the same way.
When there is no inverse
And when the method fails, it fails visibly. Take the matrix with rows (one, two) and (two, four), and write I two beside it. We replace row two by row two minus two times row one. Two minus two is zero, and four minus four is zero. After the bar: zero minus two is minus two, and one minus zero is one. The left block has a row of zeros, so it can never become the identity. The method stops, and tells us that this matrix is not invertible, just as the formula said.
Indeed, the second column has no pivot, so there is a free variable. A times the vector (minus two, one) is minus two times the column (one, two), plus the column (two, four), which is the zero vector. So A flattens the plane onto a line, like the projection at the start of the lecture. One practical remark. To solve a single system A x equals b, it is less work to row reduce A bar b than to compute the inverse first. The inverse pays off when we need many right hand sides, or when we reason about A itself.
Summary
Let's summarise. A square matrix A is invertible when some matrix B gives A B equal to I, and B A equal to I. The inverse is unique, and we write it as A inverse. If A is invertible, then A x equals b has exactly one solution: x equals A inverse b. A two by two matrix is invertible exactly when a d minus b c is not zero. Then we swap, change signs, and divide.
The inverse of a product is the product of the inverses, in reverse order. And for square matrices, one of the two products being the identity is enough. To compute an inverse, row reduce A bar I. If the left block becomes I, the right block is A inverse. Otherwise, A is not invertible. Before the next lecture, read section three point five of the course book, try the problems on sheet four about inverses, and do the lecture check on this lecture's page at Open Semester dot com. Next time, we see that every row operation is itself a multiplication by a matrix, and we gather everything we know into one theorem: the invertible matrix theorem. See you there.
In this lecture
Materials
Check yourself
3 questions, from warm-up to stretch
Work each one out on paper, type your answer and press Check. Stuck? Open a hint; the worked solution is there when you need it.
- Question 1 of 3 Warm-up
Let . Compute , then use Theorem 3.5.6 to find .
Hint 1 of 2
For with : .
Hint 2 of 2
Here , , , . Swap and , change the signs of and , and divide by .
Worked solution
- . It is not zero, so is invertible (Theorem 3.5.6).
- Swap and , change the signs of and , divide by : .
- Check: .
- Question 2 of 3 Core
Let and . Compute , find , and use it to solve .
Hint 1 of 2
If is invertible, then has exactly one solution, (Theorem 3.5.5).
Hint 2 of 2
, so . Multiply this by .
Worked solution
- , so is invertible and (Theorem 3.5.6).
- By Theorem 3.5.5 the only solution is .
- Check: .
- Question 3 of 3 Stretch
Let . For which number is not invertible? Then take and use Gauss–Jordan inversion to find the first row of .
Hint 1 of 2
Row reduce . The matrix is invertible exactly when the left block can become (Theorem 3.5.10), so watch for a row of zeros in the left block.
Hint 2 of 2
, then , turns the third row into . For the pivot is ; now clear the entries above it.
Worked solution
- Start from . and then give the third row .
- If the left block has a row of zeros and can never become , so is not invertible. For every other there are three pivots, and is invertible.
- For the third row is . Backward phase: gives , and gives .
- The left block is , so , and its first row is .
- Check the first column: .
How did it go?