Learn about Inverse Matrix
Part 1
We’ve learned about matrix addition, matrix subtraction, matrix multiplication, so you might be wondering, is there the equivalent of matrix division? And before we get into that, let me introduce some concepts to you and then we’ll see that there is something that maybe isn’t exactly division but it’s analogous to it. So before we introduce that, I’m going to introduce you to the concept of an identity matrix. So an identity matrix is a matrix and I’ll denote that by capital I. When I multiply it times another matrix, I get that other matrix or when I multiply that matrix times the identity matrix, I get the matrix again. And it’s important to realize when we’re going matrix multiplication that direction matters. I’ve actually given you some information here that we can’t just assume when we’re doing regular multiplication that A times B is always equal to B times A.
It’s important when we’re doing matrix multiplication to kind of confirm that it matters what direction you do the multiplication in. This works both ways only for dealing with square matrices. It can work in one direction or another if this matrix is none square but it won’t work in both and you could think about that just in terms of how we learned matrix multiplication why that happens.
But anyway, I’ve defined this matrix and now what does this matrix actually look like? It’s actually pretty simple. If we have a 2×2 matrix, the identity matrix is 1001. If you want 3×3 it’s 100010001. I think you see the pattern. If you want a 4×4. the identity matrix is 1000010000100001. So you can see, all of the identity matrix is for given dimension; I mean we could extend this to an end by end matrix, is you just have ones along this top left the bottom right diagonals and everything else is a zero. So I’ve told you that let’s prove that it actually works.
So let’s take this matrix and multiply it times another matrix. Let’s confirm that that matrix doesn’t change. So if we take 1001, let’s do a general matrix just so you see that this works for all numbers; A, B, D. So what does that equal? So we’re going to multiply this row times this column.1 × A + 0 × C = A. Then that row times this column. 1 × B + 0 × D = B. Then this row times this column; 0 × A + 1 × C = C. And then finally, this row times this column, 0 × B + 1 × D. Well that’s just D. There you have it. And it might be a fun exercise to try it the other way around as well. And actually it’s an even better exercise to try this with a 3×3. And you’ll see it all works out and a good exercise for you to just kind of think about why it works.
And if you think about it, it’s because you’re getting your row information from here and your column information from here. And essentially, anytime you’re multiplying, let’s say this vector times this vector. You’re multiplying the corresponding terms and then adding them. So if you have a 1 and a 0, the zero is going to cancel out anything but the first term in this column vector. So, that’s why you just left with A. And that’s why it’s going to cancel out everything but the first term in this column vector and that’s why you’re left with just B. And similarly, this will cancel out everything but the second term. So, that’s why you’re left with just C there. This times this, you’re just left with C. This times this, you’re just left with D. And that same thing applies when you go to 3×3 or n×n factors. So that’s interesting. You have the identity factor.
So let’s think about it, we know in regular mathematics if I have 1 × a, I get a. And we also know that 1/a × a—this is just regular math, this has nothing to do with matrices—is equal to 1. We call this the inverse of a. And that’s also the same thing as dividing by the number a. So, is there a matrix analogy? Is there a matrix? Or if I tab the matrix A and I multiply it by this matrix and I call that inverse of A, is there a matrix where I’m left with not the number one but I’m left with kind of the 1 equivalent in the matrix world where I’m left with the identity matrix. And it would be extra nice if I can actually switch this multiplication around. So A × A inverse should also be equal to the identity matrix. And if you think about it, if both of these things are true, then they’re actually not only as A inverse the inverse of A but A is also the inverse of A inverse. So, they’re each other’s inverses; that’s all I meant to say. And it turns out, there is such a matrix. It’s called the inverse of A as I’ve said three times already. And I will now show you how to calculate it.
So let’s do that. And we’ll see calculating it for 2×2 is fairly straight forward although, I think it’s a little mysterious as to how people came up with the mechanics of other than the algorithm for it. 3×3, it becomes a little hairy. 4×4 will take you all day. 5×5, you’re almost definitely going to do a careless mistake if you did that the inverse of a 5×5 matrix and that’s better left to a computer.
But anyway, how do we calculate the matrix. So, let’s do that and then we’ll confirm that it really is the inverse. So, if I have a matrix A and that is, let’s just say a, b, c, d and I want to calculate this inverse. And this is going to seem like voodoo. In the future videos, I will give you a little bit more intuition for why this works. I’ll actually show you how this came about. But for now, it’s almost better just to memorize the steps just so you have the confidence that you know that you can calculate the inverse.
It’s equal to 1/—this number times this a × d - b × c. ad - bc and this quantity down here; ad - bc—well actually we’re going to have to learn soon; that’s called the determinant of the matrix A. And we’re going to multiply that and so this is just a number. This is just scalar quantity. We’re going to multiply that by—you switch the A and the D. You switch the top left and the bottom right. So, you’re left with d and a. And you make the bottom left to the top right; you make them negative so -c, -b.
And the determinant and once again this is something that you’re just going to have to take a little bit on faith right now in future videos. I promise to give you more intuition. But it’d actually kind of sophisticated to learn what determinant is and if you’re doing this in your high school class, you kind of just have to know how to calculate it although, I don’t like telling you that.
So, what is this? So this is also called the determinant A. And you might see on an exam; figure out the determinant of A. And estimated by A and kind of absolute value signs and that’s equal to ad - bc. So, another way of saying, this could be 1 over the determinant. So, you could write A inverse is equal to 1 over the determinant of A times d, -b, -c, a.
Let’s supply this to a real problem and you’ll see that it’s actually not so bad. So, let’s say that if I have a matrix. Let’s change letters, just so you know that it doesn’t always have to be an A. Let’s say I have a matrix B and the matrix B is 3. I’m just going to pick random number -4, 2, -5. Let’s calculate B inverse. So B inverse is going to be equal 1 over the determinant of B. What’s the determinant? It’s 3 × -5 - 2 × -4. So 3 × -5 is -15 - 2 × -4. 2 × -4 is -8. We’re going to subtract that, it’s +8. And we’re going to multiply that times what? We switch these two terms. So, it’s -5 and 3. And we just make these two terms negative; -2 and 4. 4 is -4. So, now it becomes 4.
And let’s see if we can simplify this a little bit. So B inverse is equal to as -15 + 8, that’s -7. So this is -1/7. So the determinant of B we can write—B’s determinant is equal to -7, that’s -1/7 × -5, 4, -2, 3, which is equal to—this is just a scalar. These are just numbers. So, we multiply times each of the elements. So, that is equal to minus, minus plus. So, it’s 5/7 - 4/7, positive 2/7 and them -3/7. So, it’s a little hairy. We ended up with fractions in here and things. But let’s confirm that this really is the inverse of the matrix B. Let’s multiply them out.
So let’s confirm that that times this or this times that is really equal to the identity matrix. So, let’s do that. So, B inverse is 5/7 if I haven’t made any careless mistakes; -4/7, 2/7, -3/7, that’s B inverse. So, let me multiply that by B; 3, - 4, 2, -5. Now this is going to be the product matrix. I need some space to do my calculations. So let’s see. First, I’m going to take this row times this column. So 5/7 × 3 is what? 15/7 + -4/7 × 2. So, -4/7 × 2 is—5 × 3 is 15/7 minus—4 × 2 and so, -8/7.
Now, we’re going to multiply this row times this column. So 5 × -4 is -20/7 + -4/7 × -5; that is +20/7. My brain is starting to slow down having to do matrix multiplications with fractions with negative numbers. Well, this is a good exercise for multiple parts of the brain. But anyway, let’s go down to these terms. So now, we’re going multiply this row times this column. So 2/7 × 3 is 6/7 + -3/7 × 2. So, that’s -6/7. One term left, 2/7 × -4 is -8/7. 2/7 × 4 is -8/7 + -3/7 × -5. So, those negatives cancel out and we’re left with +15/7.
And if we simplify, what do we get? 15/7 - 8/7 is 7/7. Well, that’s just 1. This is zero clearly. This is zero 6/7 - 6/7 is zero. And then -8/7 + 15/7, that’s 7/7. That’s 1 again. And there you have it. We have actually managed to inverse this matrix and it was actually harder to prove that was the inverse by multiplying it just because we have to draw all of this fraction and negative number map. But hopefully that satisfies you and you could try it the other way around to confirm that if you multiply it the other way, you’d also get the identity matrix. But anyway, that is how you calculate the inverse of a 2×2 and as we’ll see in the next video; calculating by the inverse of a 3×3 matrix is even more fun. See you soon.
Transcription by:
Scribe4you Transcription Services