WEBVTT 00:00:00.000 --> 00:00:00.800 00:00:00.800 --> 00:00:04.100 I will now show you my preferred way of finding an 00:00:04.100 --> 00:00:05.770 inverse of a 3 by 3 matrix. 00:00:05.770 --> 00:00:07.220 And I actually think it's a lot more fun. 00:00:07.220 --> 00:00:09.150 And you're less likely to make careless mistakes. 00:00:09.150 --> 00:00:11.020 But if I remember correctly from Algebra 2, they didn't 00:00:11.020 --> 00:00:12.760 teach it this way in Algebra 2. 00:00:12.760 --> 00:00:14.900 And that's why I taught the other way initially. 00:00:14.900 --> 00:00:16.170 But let's go through this. 00:00:16.170 --> 00:00:20.140 And in a future video, I will teach you why it works. 00:00:20.140 --> 00:00:21.310 Because that's always important. 00:00:21.310 --> 00:00:23.780 But in linear algebra, this is one of the few subjects where 00:00:23.780 --> 00:00:26.670 I think it's very important learn how to do the operations 00:00:26.670 --> 00:00:28.790 first. And then later, we'll learn the why. 00:00:28.790 --> 00:00:30.430 Because the how is very mechanical. 00:00:30.430 --> 00:00:32.880 And it really just involves some basic arithmetic 00:00:32.880 --> 00:00:34.380 for the most part. 00:00:34.380 --> 00:00:39.070 But the why tends to be quite deep. 00:00:39.070 --> 00:00:41.170 So I'll leave that to later videos. 00:00:41.170 --> 00:00:43.820 And you can often think about the depth of things when you 00:00:43.820 --> 00:00:46.550 have confidence that you at least understand the hows. 00:00:46.550 --> 00:00:49.730 So anyway, let's go back to our original matrix. 00:00:49.730 --> 00:00:51.090 And what was that original matrix that I 00:00:51.090 --> 00:00:52.280 did in the last video? 00:00:52.280 --> 00:01:03.850 It was 1, 0, 1, 0, 2, 1, 1, 1, 1. 00:01:03.850 --> 00:01:07.160 And we wanted to find the inverse of this matrix. 00:01:07.160 --> 00:01:08.910 So this is what we're going to do. 00:01:08.910 --> 00:01:12.710 It's called Gauss-Jordan elimination, to find the 00:01:12.710 --> 00:01:13.720 inverse of the matrix. 00:01:13.720 --> 00:01:15.840 And the way you do it-- and it might seem a little bit like 00:01:15.840 --> 00:01:18.860 magic, it might seem a little bit like voodoo, but I think 00:01:18.860 --> 00:01:20.370 you'll see in future videos that it makes a lot of sense. 00:01:20.370 --> 00:01:22.770 What we do is we augment this matrix. 00:01:22.770 --> 00:01:23.560 What does augment mean? 00:01:23.560 --> 00:01:25.440 It means we just add something to it. 00:01:25.440 --> 00:01:26.830 So I draw a dividing line. 00:01:26.830 --> 00:01:28.486 Some people don't. 00:01:28.486 --> 00:01:31.290 So if I put a dividing line here. 00:01:31.290 --> 00:01:34.080 And what do I put on the other side of the dividing line? 00:01:34.080 --> 00:01:37.640 I put the identity matrix of the same size. 00:01:37.640 --> 00:01:41.140 This is 3 by 3, so I put a 3 by 3 identity matrix. 00:01:41.140 --> 00:01:51.600 So that's 1, 0, 0, 0, 1, 0, 0, 0, 1. 00:01:51.600 --> 00:01:54.870 All right, so what are we going to do? 00:01:54.870 --> 00:01:58.670 What I'm going to do is perform a series of elementary 00:01:58.670 --> 00:01:59.620 row operations. 00:01:59.620 --> 00:02:02.940 And I'm about to tell you what are valid elementary row 00:02:02.940 --> 00:02:04.610 operations on this matrix. 00:02:04.610 --> 00:02:07.440 But whatever I do to any of these rows here, I have to do 00:02:07.440 --> 00:02:09.360 to the corresponding rows here. 00:02:09.360 --> 00:02:12.690 And my goal is essentially to perform a bunch of operations 00:02:12.690 --> 00:02:14.150 on the left hand side. 00:02:14.150 --> 00:02:15.830 And of course, the same operations will be applied to 00:02:15.830 --> 00:02:18.690 the right hand side, so that I eventually end up with the 00:02:18.690 --> 00:02:21.320 identity matrix on the left hand side. 00:02:21.320 --> 00:02:23.310 And then when I have the identity matrix on the left 00:02:23.310 --> 00:02:26.400 hand side, what I have left on the right hand side will be 00:02:26.400 --> 00:02:28.690 the inverse of this original matrix. 00:02:28.690 --> 00:02:32.680 And when this becomes an identity matrix, that's 00:02:32.680 --> 00:02:34.950 actually called reduced row echelon form. 00:02:34.950 --> 00:02:36.320 And I'll talk more about that. 00:02:36.320 --> 00:02:39.200 There's a lot of names and labels in linear algebra. 00:02:39.200 --> 00:02:41.480 But they're really just fairly simple concepts. 00:02:41.480 --> 00:02:44.790 But anyway, let's get started and this should become a 00:02:44.790 --> 00:02:45.180 little clear. 00:02:45.180 --> 00:02:47.290 At least the process will become clear. 00:02:47.290 --> 00:02:49.460 Maybe not why it works. 00:02:49.460 --> 00:02:51.610 So first of all, I said I'm going to perform a bunch of 00:02:51.610 --> 00:02:52.280 operations here. 00:02:52.280 --> 00:02:53.950 What are legitimate operations? 00:02:53.950 --> 00:02:55.720 They're called elementary row operations. 00:02:55.720 --> 00:02:57.920 So there's a couple things I can do. 00:02:57.920 --> 00:03:01.970 I can replace any row with that row 00:03:01.970 --> 00:03:03.680 multiplied by some number. 00:03:03.680 --> 00:03:04.960 So I could do that. 00:03:04.960 --> 00:03:08.260 I can swap any two rows. 00:03:08.260 --> 00:03:10.850 And of course if I swap say the first and second row, I'd 00:03:10.850 --> 00:03:12.450 have to do it here as well. 00:03:12.450 --> 00:03:17.410 And I can add or subtract one row from another row. 00:03:17.410 --> 00:03:20.590 So when I do that-- so for example, I could take this row 00:03:20.590 --> 00:03:23.790 and replace it with this row added to this row. 00:03:23.790 --> 00:03:25.520 And you'll see what I mean in the second. 00:03:25.520 --> 00:03:27.500 And you know, if you combine it, you could you could say, 00:03:27.500 --> 00:03:29.880 well I'm going to multiple this row times negative 1, and 00:03:29.880 --> 00:03:32.580 add it to this row, and replace this row with that. 00:03:32.580 --> 00:03:36.690 So if you start to feel like this is something like what 00:03:36.690 --> 00:03:40.290 you learned when you learned solving systems of linear 00:03:40.290 --> 00:03:42.510 equations, that's no coincidence. 00:03:42.510 --> 00:03:45.990 Because matrices are actually a very good way to represent 00:03:45.990 --> 00:03:48.130 that, and I will show you that soon. 00:03:48.130 --> 00:03:51.430 But anyway, let's do some elementary row operations to 00:03:51.430 --> 00:03:55.100 get this left hand side into reduced row echelon form. 00:03:55.100 --> 00:03:57.780 Which is really just a fancy way of saying, let's turn it 00:03:57.780 --> 00:03:59.610 into the identity matrix. 00:03:59.610 --> 00:04:00.660 So let's see what we want to do. 00:04:00.660 --> 00:04:02.290 We want to have 1's all across here. 00:04:02.290 --> 00:04:03.750 We want these to be 0's. 00:04:03.750 --> 00:04:07.870 Let's see how we can do this efficiently. 00:04:07.870 --> 00:04:10.560 Let me draw the matrix again. 00:04:10.560 --> 00:04:16.350 So let's get a 0 here. 00:04:16.350 --> 00:04:17.445 That would be convenient. 00:04:17.445 --> 00:04:19.769 So I'm going to keep the top two rows the same. 00:04:19.769 --> 00:04:21.209 1, 0, 1. 00:04:21.209 --> 00:04:23.000 I have my dividing line. 00:04:23.000 --> 00:04:24.370 1, 0, 0. 00:04:24.370 --> 00:04:25.450 I didn't do anything there. 00:04:25.450 --> 00:04:27.000 I'm not doing anything to the second row. 00:04:27.000 --> 00:04:28.875 0, 2, 1. 00:04:28.875 --> 00:04:33.460 00:04:33.460 --> 00:04:36.700 0, 1, 0. 00:04:36.700 --> 00:04:40.120 And what I'm going to do, I'm going to replace this row-- 00:04:40.120 --> 00:04:42.260 And just so you know my motivation, my goal 00:04:42.260 --> 00:04:43.490 is to get a 0 here. 00:04:43.490 --> 00:04:46.540 So I'm a little bit closer to having the 00:04:46.540 --> 00:04:48.200 identity matrix here. 00:04:48.200 --> 00:04:50.080 So how do I get a 0 here? 00:04:50.080 --> 00:04:55.750 What I could do is I can replace this row with this row 00:04:55.750 --> 00:04:57.280 minus this row. 00:04:57.280 --> 00:05:00.000 So I can replace the third row with the third row 00:05:00.000 --> 00:05:01.630 minus the first row. 00:05:01.630 --> 00:05:04.040 So what's the third row minus the first row? 00:05:04.040 --> 00:05:07.340 1 minus 1 is 0. 00:05:07.340 --> 00:05:10.670 1 minus 0 is 1. 00:05:10.670 --> 00:05:13.860 1 minus 1 is 0. 00:05:13.860 --> 00:05:16.150 Well I did it on the left hand side, so I have to do it on 00:05:16.150 --> 00:05:16.900 the right hand side. 00:05:16.900 --> 00:05:20.300 I have to replace this with this minus this. 00:05:20.300 --> 00:05:24.010 So 0 minus 1 is minus 1. 00:05:24.010 --> 00:05:26.610 0 minus 0 is 0. 00:05:26.610 --> 00:05:29.810 And 1 minus 0 is 1. 00:05:29.810 --> 00:05:31.270 Fair enough. 00:05:31.270 --> 00:05:32.800 Now what can I do? 00:05:32.800 --> 00:05:37.830 Well this row right here, this third row, it has 0 and 0-- it 00:05:37.830 --> 00:05:40.530 looks a lot like what I want for my second row in the 00:05:40.530 --> 00:05:41.720 identity matrix. 00:05:41.720 --> 00:05:43.470 So why don't I just swap these two rows? 00:05:43.470 --> 00:05:45.360 Why don't I just swap the first and second rows? 00:05:45.360 --> 00:05:46.740 So let's do that. 00:05:46.740 --> 00:05:49.590 I'm going to swap the first and second rows. 00:05:49.590 --> 00:05:50.950 So the first row stays the same. 00:05:50.950 --> 00:05:54.790 1, 0, 1. 00:05:54.790 --> 00:05:57.760 And then the other side stays the same as well. 00:05:57.760 --> 00:06:01.830 And I'm swapping the second and third rows. 00:06:01.830 --> 00:06:05.020 So now my second row is now 0, 1, 0. 00:06:05.020 --> 00:06:06.990 And I have to swap it on the right hand side. 00:06:06.990 --> 00:06:09.520 So it's minus 1, 0, 1. 00:06:09.520 --> 00:06:12.540 I'm just swapping these two. 00:06:12.540 --> 00:06:14.450 So then my third row now becomes what the 00:06:14.450 --> 00:06:15.450 second row was here. 00:06:15.450 --> 00:06:17.920 0, 2, 1. 00:06:17.920 --> 00:06:21.990 And 0, 1, 0. 00:06:21.990 --> 00:06:23.160 Fair enough. 00:06:23.160 --> 00:06:24.770 Now what do I want to do? 00:06:24.770 --> 00:06:26.910 Well it would be nice if I had a 0 right here. 00:06:26.910 --> 00:06:30.070 That would get me that much closer to the identity matrix. 00:06:30.070 --> 00:06:32.260 So how could I get as 0 here? 00:06:32.260 --> 00:06:37.390 Well what if I subtracted 2 times row two from row one? 00:06:37.390 --> 00:06:40.360 Because this would be, 1 times 2 is 2. 00:06:40.360 --> 00:06:44.920 And if I subtracted that from this, I'll get a 0 here. 00:06:44.920 --> 00:06:47.140 So let's do that. 00:06:47.140 --> 00:06:50.250 So the first row has been very lucky. 00:06:50.250 --> 00:06:51.260 It hasn't had to do anything. 00:06:51.260 --> 00:06:52.580 It's just sitting there. 00:06:52.580 --> 00:06:58.670 1, 0, 1, 1, 0, 0. 00:06:58.670 --> 00:07:02.120 And the second row's not changing for now. 00:07:02.120 --> 00:07:05.430 Minus 1, 0, 1. 00:07:05.430 --> 00:07:07.110 Now what did I say I was going to do? 00:07:07.110 --> 00:07:13.240 I'm going to subtract 2 times row two from row three. 00:07:13.240 --> 00:07:18.960 So this is 0 minus 2 times 0 is 0. 00:07:18.960 --> 00:07:23.990 2 minus 2 times 1, well that's 0. 00:07:23.990 --> 00:07:29.150 1 minus 2 times 0 is 1. 00:07:29.150 --> 00:07:38.210 0 minus 2 times negative 1 is-- so let's remember 0 minus 00:07:38.210 --> 00:07:39.880 2 times negative 1. 00:07:39.880 --> 00:07:44.520 So that's 0 minus negative 2, so that's positive 2. 00:07:44.520 --> 00:07:47.970 1 minus 2 times 0. 00:07:47.970 --> 00:07:49.810 Well that's just still 1. 00:07:49.810 --> 00:07:53.240 0 minus 2 times 1. 00:07:53.240 --> 00:07:54.490 So that's minus 2. 00:07:54.490 --> 00:07:57.190 00:07:57.190 --> 00:07:58.130 Have I done that right? 00:07:58.130 --> 00:07:58.810 I just want to make sure. 00:07:58.810 --> 00:08:04.800 0 minus 2 times-- right, 2 times minus 1 is minus 2. 00:08:04.800 --> 00:08:06.910 And I'm subtracting it, so it's plus. 00:08:06.910 --> 00:08:08.150 OK, so I'm close. 00:08:08.150 --> 00:08:11.140 This almost looks like the identity matrix or reduced row 00:08:11.140 --> 00:08:11.680 echelon form. 00:08:11.680 --> 00:08:12.950 Except for this 1 right here. 00:08:12.950 --> 00:08:16.740 So I'm finally going to have to touch the top row. 00:08:16.740 --> 00:08:18.450 And what can I do? 00:08:18.450 --> 00:08:23.170 well how about I replace the top row with the top row minus 00:08:23.170 --> 00:08:24.060 the bottom row? 00:08:24.060 --> 00:08:25.480 Because if I subtract this from that, 00:08:25.480 --> 00:08:26.550 this'll get a 0 there. 00:08:26.550 --> 00:08:27.790 So let's do that. 00:08:27.790 --> 00:08:29.720 So I'm replacing the top row with the top row 00:08:29.720 --> 00:08:31.790 minus the third row. 00:08:31.790 --> 00:08:35.570 So 1 minus 0 is 1. 00:08:35.570 --> 00:08:38.659 0 minus 0 is 0. 00:08:38.659 --> 00:08:41.000 1 minus 1 is 0. 00:08:41.000 --> 00:08:43.559 That was our whole goal. 00:08:43.559 --> 00:08:48.000 And then 1 minus 2 is negative 1. 00:08:48.000 --> 00:08:53.490 0 minus 1 is negative 1. 00:08:53.490 --> 00:08:58.950 0 minus negative 2., well that's positive 2. 00:08:58.950 --> 00:09:02.460 And then the other rows stay the same. 00:09:02.460 --> 00:09:07.590 0, 1, 0, minus 1, 0, 1. 00:09:07.590 --> 00:09:15.550 And then 0, 0, 1, 2, 1, negative 2. 00:09:15.550 --> 00:09:16.640 And there you have it. 00:09:16.640 --> 00:09:18.650 We have performed a series of operations on 00:09:18.650 --> 00:09:19.720 the left hand side. 00:09:19.720 --> 00:09:21.380 And we've performed the same operations on 00:09:21.380 --> 00:09:22.960 the right hand side. 00:09:22.960 --> 00:09:25.670 This became the identity matrix, or 00:09:25.670 --> 00:09:27.410 reduced row echelon form. 00:09:27.410 --> 00:09:30.530 And we did this using Gauss-Jordan elimination. 00:09:30.530 --> 00:09:32.180 And what is this? 00:09:32.180 --> 00:09:36.570 Well this is the inverse of this original matrix. 00:09:36.570 --> 00:09:38.960 This times this will equal the identity matrix. 00:09:38.960 --> 00:09:46.750 So if this is a, than this is a inverse. 00:09:46.750 --> 00:09:47.580 And that's all you have to do. 00:09:47.580 --> 00:09:49.700 And as you could see, this took me half the amount of 00:09:49.700 --> 00:09:53.260 time, and required a lot less hairy mathematics than when I 00:09:53.260 --> 00:09:56.310 did it using the adjoint and the cofactors and the 00:09:56.310 --> 00:09:58.110 determinant. 00:09:58.110 --> 00:09:59.990 And if you think about it, I'll give you a little hint of 00:09:59.990 --> 00:10:01.420 why this worked. 00:10:01.420 --> 00:10:06.910 Every one of these operations I did on the left hand side, 00:10:06.910 --> 00:10:10.570 you could kind of view them as multiplying-- you know, to get 00:10:10.570 --> 00:10:12.370 from here to here, I multiplied. 00:10:12.370 --> 00:10:14.500 You can kind of say that there's a matrix. 00:10:14.500 --> 00:10:16.240 That if I multiplied by that matrix, it would have 00:10:16.240 --> 00:10:17.670 performed this operation. 00:10:17.670 --> 00:10:20.250 And then I would have had to multiply by another matrix to 00:10:20.250 --> 00:10:21.550 do this operation. 00:10:21.550 --> 00:10:24.250 So essentially what we did is we multiplied by a series of 00:10:24.250 --> 00:10:26.440 matrices to get here. 00:10:26.440 --> 00:10:28.500 And if you multiplied all of those, what we call 00:10:28.500 --> 00:10:31.410 elimination matrices, together, you essentially 00:10:31.410 --> 00:10:34.070 multiply this times the inverse. 00:10:34.070 --> 00:10:35.590 So what am I saying? 00:10:35.590 --> 00:10:43.470 So if we have a, to go from here to here, we have to 00:10:43.470 --> 00:10:47.300 multiply a times the elimination matrix. 00:10:47.300 --> 00:10:49.630 And this might be completely confusing for you, so ignore 00:10:49.630 --> 00:10:51.990 it if it is, but it might be insightful. 00:10:51.990 --> 00:10:55.250 So what did we eliminate in this? 00:10:55.250 --> 00:10:58.470 We eliminated 3, 1. 00:10:58.470 --> 00:11:01.120 We multiplied by the elimination matrix 00:11:01.120 --> 00:11:03.670 3, 1, to get here. 00:11:03.670 --> 00:11:05.740 And then, to go from here to here, we've 00:11:05.740 --> 00:11:07.220 multiplied by some matrix. 00:11:07.220 --> 00:11:07.970 And I'll tell you more. 00:11:07.970 --> 00:11:09.160 I'll show you how we can construct 00:11:09.160 --> 00:11:10.940 these elimination matrices. 00:11:10.940 --> 00:11:12.830 We multiply by an elimination matrix. 00:11:12.830 --> 00:11:16.150 Well actually, we had a row swap here. 00:11:16.150 --> 00:11:17.070 I don't know what you want to call that. 00:11:17.070 --> 00:11:21.240 You could call that the swap matrix. 00:11:21.240 --> 00:11:24.730 We swapped row two for three. 00:11:24.730 --> 00:11:28.830 And then here, we multiplied by elimination 00:11:28.830 --> 00:11:31.110 matrix-- what did we do? 00:11:31.110 --> 00:11:34.030 We eliminated this, so this was row three, 00:11:34.030 --> 00:11:36.270 column two, 3, 2. 00:11:36.270 --> 00:11:39.320 And then finally, to get here, we had to multiply by 00:11:39.320 --> 00:11:40.470 elimination matrix. 00:11:40.470 --> 00:11:41.740 We had to eliminate this right here. 00:11:41.740 --> 00:11:44.220 So we eliminated row one, column three. 00:11:44.220 --> 00:11:47.200 00:11:47.200 --> 00:11:49.590 And I want you to know right now that it's not important 00:11:49.590 --> 00:11:51.420 what these matrices are. 00:11:51.420 --> 00:11:53.210 I'll show you how we can construct these matrices. 00:11:53.210 --> 00:11:55.530 But I just want you to have kind of a leap of faith that 00:11:55.530 --> 00:11:58.600 each of these operations could have been done by multiplying 00:11:58.600 --> 00:12:01.040 by some matrix. 00:12:01.040 --> 00:12:03.510 But what we do know is by multiplying by all of these 00:12:03.510 --> 00:12:06.760 matrices, we essentially got the identity matrix. 00:12:06.760 --> 00:12:07.930 Back here. 00:12:07.930 --> 00:12:11.450 So the combination of all of these matrices, when you 00:12:11.450 --> 00:12:13.600 multiply them by each other, this must 00:12:13.600 --> 00:12:15.370 be the inverse matrix. 00:12:15.370 --> 00:12:18.420 If I were to multiply each of these elimination and row swap 00:12:18.420 --> 00:12:22.420 matrices, this must be the inverse matrix of a. 00:12:22.420 --> 00:12:23.680 Because if you multiply all them times 00:12:23.680 --> 00:12:26.130 a, you get the inverse. 00:12:26.130 --> 00:12:28.630 Well what happened? 00:12:28.630 --> 00:12:31.780 If these matrices are collectively the inverse 00:12:31.780 --> 00:12:36.400 matrix, if I do them, if I multiply the identity matrix 00:12:36.400 --> 00:12:40.620 times them-- the elimination matrix, this one times that 00:12:40.620 --> 00:12:41.270 equals that. 00:12:41.270 --> 00:12:42.970 This one times that equals that. 00:12:42.970 --> 00:12:44.510 This one times that equals that. 00:12:44.510 --> 00:12:45.360 And so forth. 00:12:45.360 --> 00:12:48.870 I'm essentially multiplying-- when you combine all of 00:12:48.870 --> 00:12:53.050 these-- a inverse times the identity matrix. 00:12:53.050 --> 00:12:55.520 So if you think about it just very big picture-- and I don't 00:12:55.520 --> 00:12:56.470 want to confuse you. 00:12:56.470 --> 00:12:57.910 It's good enough at this point if you just 00:12:57.910 --> 00:13:00.370 understood what I did. 00:13:00.370 --> 00:13:03.500 But what I'm doing from all of these steps, I'm essentially 00:13:03.500 --> 00:13:07.800 multiplying both sides of this augmented matrix, you could 00:13:07.800 --> 00:13:10.450 call it, by a inverse. 00:13:10.450 --> 00:13:13.080 So I multiplied this by a inverse, to get to the 00:13:13.080 --> 00:13:14.300 identity matrix. 00:13:14.300 --> 00:13:16.740 But of course, if I multiplied the inverse matrix times the 00:13:16.740 --> 00:13:19.130 identity matrix, I'll get the inverse matrix. 00:13:19.130 --> 00:13:20.990 But anyway, I don't want to confuse you. 00:13:20.990 --> 00:13:22.410 Hopefully that'll give you a little intuition. 00:13:22.410 --> 00:13:25.130 I'll do this later with some more concrete examples. 00:13:25.130 --> 00:13:27.850 But hopefully you see that this is a lot less hairy than 00:13:27.850 --> 00:13:30.115 the way we did it with the adjoint and the cofactors and 00:13:30.115 --> 00:13:32.540 the minor matrices and the determinants, et cetera. 00:13:32.540 --> 00:13:35.290 Anyway, I'll see you in the next video.