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