Classic video on inverting a 3x3 matrix part 1 | Matrices | Precalculus | Khan Academy

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
We will now embark on what is probably my least favorite exercise or computation in mathematics-- and I think you'll see why-- where we will invert a 3 by 3 matrix. And in my mind, the only thing less pleasant than inverting a 3 by 3 matrix is inverting a 4 by 4 matrix. It very quickly becomes obvious to you that it's probably better for a computer to do this. But you need to learn how to do it. And it's a good exercise for me to do. And if I keep doing it my whole life, it'll prevent my brain from degrading. But as you'll see, this is almost an exercise in not making careless mistakes. So let's start with a 3 by 3 matrix and try to take the inverse. So let's say I have matrix a. I think I'm going to need a lot of space here, so I'll try to do this small, without being confusing. Matrix a. Let's say it's 1, 0-- and I'm specifically choosing this matrix because the numbers are reasonably non-hairy-- 0, 2, 1, 1, 1, 1. So the first thing that I do when I take an inverse of a 3 by 3 matrix, I create what I call-- or not what I call, what everyone calls-- a matrix of minors. So let me write that down. Matrix of minors. So what's a minor? Let me draw that out. So it's going to be another 3 by 3 matrix. And what it is, so this element, this top left element, is essentially going to be the determinant. If I were to take my original matrix, and I were to cross out this position's row and column. So for example, this 1, 1 position, row 1, column 1. I cross out row 1 and column 1. What numbers do I have left? I have this 2, 1, 1, 1. I have this right here. So it's the determinant of 2, 1, 1, 1. And actually maybe I'll write that down. So it's the determinant of 2, 1, 1, 1. So I'm gonna run out of space I'm sure. It's going to be 2, 1, 1, 1. The determinant. The absolute value sign says it's the determinant. Remember, all I did is, I said, OK, in position 1,1, let me cross out the column and the row 1,1, and take the determinant of what's left. Or the minor of this matrix. And then I will take the determinant-- so when I go to this position, I'm in row 1, column 2. I'm essentially going to take the determinant. If I were to cross out row 1 and column 2, what do I have left over? I have 0, 1, 1, 1. It might be confusing, but just remember-- I wish I had something I could cover this with. Unfortunately my fingers can't show up on this video. But if you cross this row and this column out, you're just left with this 0, this 1, this 1, and this 1. And you take the determinant of that minor. And we'll keep going. I'm probably going to run out of space here, but I will try my best. And so when you go to this position-- row 1, column 3-- what do you do? Well you cross out row 1, column 3. And then the determinant, or the minor that you have to do, is 0, 2, 1, 1. So the determinant of that two by two matrix. And then you keep doing that, so forth and so on. And I'm going to run out of space. But what I'm going to do is I'm just going to calculate it. I think you understand how to do it. Well you don't understand how to do it, but I think when we calculate it it'll make a little more sense. Let me actually just calculate it out. Because if I were to write these 2 by 2 matrices, I would run out of space. But anyway, let's go back to this position 1, 1. Cross out the first row, first column, I want the determinant of this thing right here. So what's the determinant of this 2 by 2? That's not too hard. It's 2 times 1, minus 1 times 1. So what's 2 times 1, minus 1 times 1? Well it's just 1. Then when we go to row 1, column 2, I want the determinant of 0, 1, 1, 1. So it's 0 times 1, minus 1 times 1. So 0 times 1 is 0, minus 1 times 1 is minus 1. And that's just this determinant right here. I'm just kind of reshowing you how I visualize when I cross out the rows and columns. So it's 0 times 1, minus 1 times 1. And in this position of course, you cross out this row, this column, and 0 times 1 minus 1 times 2. So that's minus 2. Let's keep going. All right. So now, when we're in row 2, column 1, we cross out row 2, cross out column 1. And we're left with this 0, this 1, this 1 and this 1. So it's 0 times 1, which is 0. Minus 1 times 1. So we're at minus 1. Then when we get row 2, column 2, we cross those two out, and we take the matrix of the minor that's left. So that's 1 times 1, minus 1 times 1. So that's 0. Almost. We're halfway done. OK, so then we're in row 2, column 3. So we cross out row 2, column 3. And what we have left is 1 times 1, minus 1 time 0. So that is just 1. Last row. OK, so we're in row 3, column 1. So we cross out row 3, column 1. You're left with 0 times 1 is 0. Minus 2 times 1. So that's minus 2. Then we're in row 3, column 2. So we cross out row 3, column 2. And you have 1 times 1, minus 0 times 1. So that's just 1. Last one. Row 3, column 3. So we cross out row 3, we cross out column 3. And you're just left with 1 times 2, minus 0 times 0. So that is 2. And if I haven't made any careless mistakes, that is our matrix of minors. Now we now have to convert this to what we call the matrix of cofactors. And actually this step is fairly straightforward. So to convert from a matrix of minors to a matrix of cofactors, you just have to remember this pattern. This pattern applies to any 3 by 3 matrix. Plus, minus, plus, minus, plus, minus, plus, minus, plus. And so you can kind of just imagine this as kind of a checkerboard of pluses and minuses. And you apply that to this. So what do I mean by that? Well that means, when you start, it's a checkerboard, and you start with a plus at the top left. And then you just keep alternating plus, minus. So if you applied this to this, you get the matrix of cofactors. Let me write that down. You can imagine this is a bit of a marathon of computation. OK, so the matrix of cofactors is essentially applying this pattern to the matrix of minors. So what do you do? You say this plus 1 times 1 is 1. But now we have a minus. So that's minus times minus 1 is positive 1. Then you have plus times minus 2 is minus 2. Then you have a minus here. Minus times minus 1 is positive 1. Plus times 0 is still 0. Minus times 1 is minus 1. Plus times minus 2 is minus 2. Minus applied to 1 is minus 1. And then plus applied to 2 is just 2. And we have our matrix of cofactors. And we are more than halfway done with inverting this matrix. And I just want to take a note here. What we're doing is kind of just a magic formula. It might seem a little bit like voodoo for you. But I just want you to keep in mind that in future videos, I will show you where this comes from. Although it will be quite hairy to prove it for a 3 by 3. But I'll definitely show it to you for a 2 by 2. And actually, I'll show you other algorithms that might make a little bit more intuitive sense for doing it for a 3 by 3. But I just wanted to show you how to do it this way, so that at least when you see it on your Algebra 2 exam-- because I think they actually teach this in Algebra 2-- you could at least, if the teacher asks you, solve for the matrix of minors or the cofactors or solve for the determinant of the inverse, you can do it. And then we'll worry about getting the intuition, which is not how I normally like to teach things. But this is an exception. But anyway, back to the problem. This is the matrix of cofactors. Now from this, we take the adjoint of matrix a-- or I learned from Wikipedia, the correct term is the adjugate of matrix a. But this is determined the notation is the adjugate of a. And all this is is the transpose of the matrix of cofactors. And I know I'm throwing out a lot of weird terminology here. But the transpose, all that means is that you switch the rows and the columns. So this one right here is in row 1, column 1. But you know, so the rows and columns are the same, so that just stays the same. So actually anything on the diagonal stays the same. Because this is row 2, column 2. This is row 3, column 3. So the diagonals stay the same. And then you switch places. You kind of flip across the diagonal. And what do I mean by that? Well this 1 was in row 1, column 2. So it'll then be moved to row 2, column 1. So this 1 right here will go here. So you can kind of say that it flipped over the diagonal. And similarly, this right here is in row 1, column 3. It's going to be switched to row 3, column 1. So it's going to go here. And you can kind of see that it just flipped over that end. So this minus 2 isn't this one. It's this one over here. And actually, we see that this matrix is symmetric. When you flip it, you actually get the same thing. So maybe it was a bad example. But I want you to understand that the transpose is where-- if something like this number, if it's in a row 1, column 2, then it moves to row 2, column 1. So you're switching the rows and columns. But anyway, we could keep doing that. But essentially you're just flipping over the diagonal. So let's see. So then this number will be flipped to this position, so it goes there. This is in row 2, column 1. So it will go to column 2, row 1, which is that. And then if we go here, that's going to be flipped down here, flipped across the diagonal. So that's minus 1. This is going to be flipped all the way up there. So that's minus 2. And then this will be flipped there. This is minus 1. We are almost done. So this is the adjoint of matrix a. So to get the inverse of a-- and let me actually erase some of this, because we're going to run out of space otherwise. And as you can see, I'll be very impressed if I have not introduced a careless mistake yet. So let me erase all of this. I'm building an appetite just doing this problem. It's so taxing on me. So the inverse of matrix a is equal to 1 over the determinant of a times the adjugate, or adjoint, of matrix a. So we solved for this part. So now let's solve for the determinant. So the determinant of a-- and I kept the matrix of cofactors here for a reason-- the determinant of a is-- if you go across-- you can actually go across any row-- but just for simplicity, just remember it this way. You go across the top row, and you multiply each term times its corresponding cofactor, and you add them. So in this case, it'll be 1 times its corresponding cofactor, which is 1. Plus 0 times its corresponding cofactor, which is 1. Plus 1 times its corresponding cofactor plus minus 2. So this is 1 plus 0 minus 2. It equals minus 1. And thank God it was a relatively straightforward determinant. And if you didn't have this matrix of cofactors, the other way you could think about it-- and this is good because it gives you an intuition of how we even got to the matrix of cofactors-- you could view this as the same thing as 1 times the determinant of its minor. So if you cross out the row and the column, it's this determinant. So it's 2, 1, 1, 1. And remember there was that pattern. You have plus, and then you go minus. So minus 0 times the determinant of its minor. So you cross out that row, that column. So 0, 1, 1, 1. And then we switch again. We go back to plus. Plus 1 times the determinant of its minor. So you cross out that row, that column. You get 0, 2, 1, 1. And you could compute this out. And this is this cofactor. This, with a minor sign, this is just a minor. And then when you apply the minus sign, it becomes this cofactor. And then this is that minor. And since it's a plus sign there, that's that cofactor. But anyway, I just wanted to explain that, and hopefully it hasn't confused you. But we're ready now to solve the inverse of a. We know that the determinant of a is equal to minus 1. We know that the adjugate of a is this number here. So we now can solve for the inverse. And let's do that. Let me erase all of this stuff. Cause actually, after I solve for the inverse, I want to prove to you that it is the inverse-- maybe. If I have enough time. Because I just realized I'm running pretty long. That might be a good exercise for you. OK. So the inverse of a is equal to 1 over the determinant. We figured out the determinant is negative 1 times the adjugate of a. 1, 1, minus 2. 1, 0, minus 1. Minus 2, minus 1, 2. So this is just minus 1, right? So we just apply minus 1 times everything. So we get-- if I haven't made any careless mistakes-- minus 1, minus 1, plus 2, minus 1, 0, 1, 2, 1, minus 2. I think that I have-- let's see, I just did a minus times everything. That looks right. And so that is a inverse. And it only took us 17 minutes. And I will leave you there, because it will probably take me another 5 or 10 minutes to [? seed ?] and prove. But that might be a good exercise for you. To multiply this matrix times this matrix, and make sure that you get the identity matrix. I will see you in the next video.
Info
Channel: Khan Academy
Views: 800,370
Rating: 4.8565536 out of 5
Keywords:
Id: S4n-tQZnU6o
Channel Id: undefined
Length: 16min 44sec (1004 seconds)
Published: Sun Jun 08 2008
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.