If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Simpler 4x4 determinant

Calculating a 4x4 determinant by putting in in upper triangular form first. Created by Sal Khan.

Want to join the conversation?

Video transcript

I have this 4 by 4 matrix, A, here. And let's see if we can figure out its determinant, the determinant of A. And before just doing it the way we've done it in the past, where you go down one of the rows or one of the columns-- and you notice, there's no 0's here, so there's no easy row or easy column to take the determinant by. We could have gone down this row and do all the submatrices, but this becomes pretty involved. You end up doing four 3 by 3 determinants, and then each of those are composed of three 2 by 2 determinants. It becomes a pretty hairy process. Let's see if we can use some of the realizations we've discovered in the last two videos to simplify this process. Well, one of the realizations is that row operations, or if you subtract-- let me write it this way-- if you replace row j with, let's say, row j minus some scale or multiple, times row i, it does not change the determinant of A. We saw that, I think it was two videos ago. So this is a pretty big realization. We can do these type of row operations and it won't change the determinant. The other realization we had was that these upper triangular matrices, you can figure out their determinant. So what does upper triangular look like? Let me just review it. The upper triangular-- everything below the diagonal. So let's say the diagonal has-- let me just draw its terms like that. These are some non-zero terms. Oh, they don't have to be. Then upper triangular, everything below the diagonal is a 0, and everything above the diagonal probably isn't a 0, but you never know. But they're non-zero terms, so all the red stuff here is non-zero, all this stuff in green is 0. And I didn't touch on it in that video, but there is also such a thing as a lower triangular, that you might have guessed how it looks. Everything above the main diagonal is 0, so this is the main diagonal right here, all the way down like that. All of these guys are going to be non-zero. All of that's going to be non-zero, and then the 0's are going to be above the diagonal, like that. We saw in the last video that the determinant of this guy is just equal to the product of the diagonal entries, which is a very simple way of finding a determinant. And you could use the same argument we made in the last video to say that the same is true of the lower triangular matrix, that its determinant is also just the product of those entries. I won't prove it here, but you can use the exact same argument you used in the video that I just did on the upper triangular. So given this, that the determinant of this is just the product of those guys, and that I can perform row operations on this guy and not change the determinant, maybe a simpler way to calculate this determinant is to get this guy into an upper triangular form, and then just multiply the entries down the diagonal. So let's do that. So we want to find the determinant of A. Let me rewrite A right here. It's 1, 2, 2, 1, 1, 1, 2, 4, 2, 2, 7, 5, 2, minus 1, 4, minus 6, 3. Now let's try to get this into upper triangular form. So let's replace the second row with the-- so I'm just going to keep the first row the same. 1, 2, 2, 1. And let's replace the second row with the second row minus the first row. The second row minus the first row is going to be equal to 1 minus 1 is 0. So in this case the constant is just 1. So 1 minus 1 is 0. 2 minus 2 is 0. 4 minus 2 is 2. 2 minus 1 is 1. Now let's replace the third row with the third row minus 2 times the second row. So 2 minus 2 times 1 is 0. 7 minus 2 times 2 is 3. 5 minus 2 times 2 is 1. 2 minus 2 times 1 is 0. Let me get a good color here. I'll do pink. Let's replace the last row with the last row, essentially, plus the first row. You could say minus minus 1 times the first row is the same thing as the last row plus the first row. So minus 1 plus 1 is 0. 4 plus 2 is 6. Minus 6 plus 2 is minus 4. And then 3 plus 1 is 4. So there we have it like that. And this guy has two 0's here, so maybe I want to swap some rows. So let me swap some rows. So if we swap rows, what happens? I'm going to swap the middle two rows just for fun. Well, not just for fun. Because I want a pivot entry right here. I shouldn't say a pivot entry. I want to do it in upper triangular form. So I want a non-zero entry here. This is a 0, so I'm going to move this guy down. So I'm going to keep the top row the same. 1, 2, 2, 1. I'm going to keep the bottom row the same. 0, 0, 6, minus 4, 4. And I'm going to swap these guys right here. So this is going to be 0, 3, 1, 0. And then 0, 0, 2, 1. Now, can I just swap entries like that? Well, I can, but you have to remember that when you swap entries, your resulting determinant is going to be the negative of your original determinant. So if we swap these two guys, the determinant of this is going to be the negative of this determinant. When you swap two rows, you just flip the sign of the determinant. We saw that. That was one of the first videos we did on these, kind of messing with the determinants. Now, what do we want to do here? To get this guy into upper triangular form, it'd be nice to get this to be a 0. So to get that to be a 0, let me keep everything else the same. So I have a 1, 2, 2, 1. I have a 0, 3, 1, 0. The third row is 0, 0, 2, 1. And now this last row, let me replace it with the last row minus 3 times this row. So let me write it like this. I have to carry that negative sign as well. So I'm going to replace this last row with the last row minus 2 times the second row. want to zero it out. So 0 minus 2 times 0 is 0. 6 minus 2 times 3 is 0. Minus 4 minus 2 times 1 is minus 6. And then 4 minus 2 times 0 is just 4. We're almost there. Now we want to zero this guy out, so let's replace this one. So I'm going to keep my top three rows the same again. And let me see if I can write it a little bit neater. So my first row is 1, 2, 2, 1. My second row is 0, 3, 1, 0. Fourth row is 0, 0, 2, 1. And I'm going to take the matrix. I haven't written the fourth row yet. And, of course, the negative of this is going to be determinant of our original matrix, because we had swapped those rows. But let's replace this last row with the last row, plus 3 times the third row. So we get 0 plus 3 times 0 is 0. 0 plus 3 times 0 is 0. Minus 6 plus 3 times 2 is 0. 4 plus 3 times 1 is 7. And just like that, we have a determinant of a matrix in upper triangular form. So this is going to be equal to the product of these guys. We can't forget our negative sign. Let's throw our negative sign out there and put a parentheses just like that. This is going to be the product of that diagonal entry. 1 times 3, times 3, times 2, times 7, which is 6 times 7, which is 42. So the determinant of this matrix is minus 42, which was pretty fast. This was a pretty fast shortcut. And it actually turns out it tends to be computationally more efficient to use these takeaways to put things into upper triangular form first. And then, you know, if you do swaps, you have to remember to make the determinant negative. And then just multiply down the diagonal. And we did that there, and we got the determinant as being minus 42.