0:00:05.140,0:00:08.210 In this second of the videos on[br]matrix multiplication, we're 0:00:08.210,0:00:11.280 going to delve a little bit more[br]deeply into matrix 0:00:11.280,0:00:14.350 multiplication and look at some[br]of the properties and the 0:00:14.350,0:00:17.113 conditions under which different[br]sorts of multiplication can be 0:00:17.113,0:00:20.490 carried out. Let's start by[br]looking at looking at a specific 0:00:20.490,0:00:23.560 example in this example. Here[br]I've written down to matrices 0:00:23.560,0:00:28.791 M&N. And let's look at the sizes[br]of these matrices. The first 0:00:28.791,0:00:33.392 matrix M. Is a three row[br]three column matrix, so 0:00:33.392,0:00:34.848 it's three by three. 0:00:37.710,0:00:42.070 And the second matrix N is 3[br]rows, two columns. 0:00:42.900,0:00:44.250 So it's a 3 by 2. 0:00:46.920,0:00:49.152 And we notice that these[br]numbers are the same. 0:00:50.920,0:00:54.261 The number of columns in the[br]first is the same as the number 0:00:54.261,0:00:57.088 of rows in the second, so we can[br]perform this matrix 0:00:57.088,0:01:00.172 multiplication and the size of[br]the answer will be a three by 0:01:00.172,0:01:03.513 two matrix. So right at the[br]start we know the size of the 0:01:03.513,0:01:06.597 answer. It's going to have three[br]rows and two columns just like 0:01:06.597,0:01:09.788 this one had. So the shape[br]of the answer is. 0:01:10.910,0:01:13.396 Like we have here and we're[br]looking for these 6 numbers. 0:01:13.980,0:01:14.760 In the product. 0:01:16.510,0:01:17.818 Let's try and work it out. 0:01:18.780,0:01:23.239 To find the number that's in the[br]first row, first column. We work 0:01:23.239,0:01:27.698 with the first row of the first[br]matrix and the first column of 0:01:27.698,0:01:28.727 the Second Matrix. 0:01:29.510,0:01:33.570 What we want is 3[br]* 1 which is 3. 0:01:34.580,0:01:41.116 2 * -- 2 which is minus 4 and 1[br]* 3, which is 3. So we've got 3 0:01:41.116,0:01:42.148 ones or three. 0:01:43.730,0:01:50.322 2 * -- 2 is minus 4 and 1[br]* 3 is 3. We multiply the 0:01:50.322,0:01:53.206 paired elements together and[br]add the result. 0:01:56.590,0:02:00.776 When we come to the first row,[br]second column, we work with the 0:02:00.776,0:02:02.708 first row here and the second 0:02:02.708,0:02:08.880 column here. And again, pairing[br]off 3 * -- 2 is minus 6. 0:02:10.400,0:02:12.188 2 * 3. 0:02:13.030,0:02:13.960 Is 6. 0:02:15.470,0:02:18.270 1 * -- 4 is minus 4. 0:02:19.030,0:02:21.613 So in each case, we're[br]multiplying the paired elements 0:02:21.613,0:02:23.048 together and adding the results. 0:02:24.750,0:02:28.936 When we want the element that's[br]going in here, which is in the 0:02:28.936,0:02:32.800 2nd row first column of the[br]answer, we work with the 2nd 0:02:32.800,0:02:36.664 row, first column of the given[br]matrices 4 * 1 is 4. 0:02:38.220,0:02:41.706 Minus 3 * -- 2 is +6. 0:02:43.760,0:02:45.510 2 * 3 is 6. 0:02:47.600,0:02:52.033 And continuing in the same way,[br]the answer that goes in the 2nd 0:02:52.033,0:02:55.443 row, second column comes from[br]taking the 2nd row, second 0:02:55.443,0:02:58.846 column. 4 * -- 2 is minus 8. 0:03:00.090,0:03:03.498 Minus 3 * + 3 is minus 9. 0:03:04.810,0:03:07.400 2 * -- 4 is minus 8. 0:03:09.530,0:03:13.886 And finally on the last row[br]to find the element in the 0:03:13.886,0:03:17.879 first row. Sorry the 3rd row[br]first column will work with 0:03:17.879,0:03:21.146 the 3rd row, First Column, 5[br]ones of five. 0:03:23.170,0:03:25.375 4 * -- 2 is minus 8. 0:03:26.410,0:03:28.120 3 * 3 is 9. 0:03:29.810,0:03:33.562 And similarly to find the last[br]element, it will be 5 * -- 2, 0:03:33.562,0:03:34.634 which is minus 10. 0:03:35.260,0:03:40.746 4 * 3 is 12 and 3 * --[br]4 is minus 12. 0:03:42.360,0:03:46.404 And if we just tidy up what[br]we've got, we'll have 336 0:03:46.404,0:03:48.089 subtract 4, which is 2. 0:03:50.120,0:03:53.216 Minus 6 + 6 zero subtract 4 is 0:03:53.216,0:03:57.269 minus 4. Four and[br]six is 10 and 616. 0:03:58.610,0:04:02.912 Minus 8 -- 9 --[br]8 is minus 25. 0:04:05.450,0:04:07.810 5 subtract 8 + 9. 0:04:08.460,0:04:09.530 6th 0:04:10.680,0:04:13.452 and minus 10 + 12 -- 12 is minus 0:04:13.452,0:04:17.439 10. And this is the result[br]of multiplying these two 0:04:17.439,0:04:18.041 matrices together. 0:04:20.560,0:04:23.368 What about if we try and[br]multiply the two 0:04:23.368,0:04:25.240 matrices together the[br]opposite way round? 0:04:25.240,0:04:27.736 Suppose we try and[br]workout N * M. 0:04:45.730,0:04:50.644 Now, in this case the size of[br]the first matrix here is 3 rows 0:04:50.644,0:04:55.558 and two columns, so that's a[br]three by two and the size of the 0:04:55.558,0:04:59.068 second matrix is 3 by 3, three[br]rows, three columns. 0:04:59.890,0:05:03.102 And what we observe now is[br]that these two numbers here 0:05:03.102,0:05:06.606 are not the same, they are not[br]equal. That means that we 0:05:06.606,0:05:08.942 cannot do the matrix[br]multiplication in the order 0:05:08.942,0:05:11.570 that I've written it down[br]here. That matrix product 0:05:11.570,0:05:15.074 doesn't exist. So this is the[br]first point. I'd like to make 0:05:15.074,0:05:18.286 that even when you can find a[br]matrix product by multiplying 0:05:18.286,0:05:20.914 two matrices together, it[br]matters very much. The order 0:05:20.914,0:05:24.418 in which you write them down.[br]It may be possible to workout 0:05:24.418,0:05:27.630 a product one way, but not[br]another way. Let's look at 0:05:27.630,0:05:28.506 some more examples. 0:05:29.570,0:05:33.123 Suppose we've got two matrices[br]C&D as I've written them down 0:05:33.123,0:05:37.322 here, I'm going to try to work[br]out the product C * D. 0:05:38.120,0:05:41.396 And I'll also try and workout[br]the product D times. See if 0:05:41.396,0:05:42.488 either of these exist. 0:05:43.970,0:05:48.390 But in the first case, we've got[br]a two row three column matrix. 0:05:49.280,0:05:52.210 And in the second example[br]here, within the Second matrix 0:05:52.210,0:05:56.019 here we've got three rows into[br]two columns, so we can in fact 0:05:56.019,0:05:59.242 work this product out because[br]these numbers are the same and 0:05:59.242,0:06:03.051 the result will be a two by[br]two matrix. So the shape of 0:06:03.051,0:06:05.688 the answer will be 2 rows and[br]two columns. 0:06:08.020,0:06:12.610 If we try and do this the other[br]way round, D * C, The first 0:06:12.610,0:06:16.588 matrix Now has got three rows[br]and two columns. It's a three by 0:06:16.588,0:06:20.260 two matrix and the second one's[br]got two rows and three columns. 0:06:20.260,0:06:22.096 It's a two by three matrix. 0:06:22.690,0:06:26.092 So you can. You can see that we[br]can still work it out because 0:06:26.092,0:06:29.251 these two numbers are still the[br]same 2 into the same, but this 0:06:29.251,0:06:32.653 time the result is going to be a[br]three by three matrix, so it's 0:06:32.653,0:06:35.569 going to be a bigger matrix with[br]three rows and three columns. 0:06:38.990,0:06:43.322 We can use the process that we[br]evaluate that we worked on 0:06:43.322,0:06:47.293 before to evaluate the elements[br]in the these matrices. So for 0:06:47.293,0:06:53.069 example, the element that goes[br]in here is 1 * 3 + 2 * 5 added 0:06:53.069,0:06:55.957 to 3 * -- 1, which is 10. 0:06:57.730,0:07:02.295 And you can check for yourself[br]that the remaining elements are 0:07:02.295,0:07:03.955 131 and minus 11. 0:07:04.780,0:07:08.108 So it's possible to workout[br]C * D and the answer is a 0:07:08.108,0:07:09.132 two by two matrix. 0:07:10.430,0:07:14.846 When we do it the other way[br]round, let's take an element 0:07:14.846,0:07:19.262 here. Let's take the elements in[br]the first row, first column and 0:07:19.262,0:07:23.310 we obtain the answer by working[br]with the first row, first 0:07:23.310,0:07:27.726 column. Here, that's three[br]times, one is 3 added to minus 7 0:07:27.726,0:07:32.142 * 4. That's three added to minus[br]28, which is minus 25. 0:07:34.760,0:07:39.713 And you can proceed in the same[br]way to fill out this resulting 0:07:39.713,0:07:44.666 matrix and the numbers. You'll[br]get a -- 25 -- 29 -- 33. 0:07:46.540,0:07:52.620 9. 1521[br]789 0:07:53.990,0:07:58.540 The important point that I want[br]to make here is that when you 0:07:58.540,0:08:00.290 multiply C * D together. 0:08:00.950,0:08:06.350 It may be possible to also find[br]D * C, But the answers that you 0:08:06.350,0:08:09.230 get may have completely[br]different sizes. It's certainly 0:08:09.230,0:08:14.270 not true that CD is the same as[br]DC, so one of the observations 0:08:14.270,0:08:18.950 we take away straight away is[br]that in general CD is not equal 0:08:18.950,0:08:23.270 to DC. Even in situations where[br]both of these products do exist, 0:08:23.270,0:08:25.790 we say that matrix[br]multiplication is not 0:08:25.790,0:08:29.030 commutative. In general, it[br]really doesn't matter the order 0:08:29.030,0:08:31.190 in which you carry out the 0:08:31.190,0:08:34.950 multiplication. Now that we know[br]how to multiply 2 matrices 0:08:34.950,0:08:38.050 together, I'm going to show you[br]an important property of 0:08:38.050,0:08:43.818 identity matrices. Suppose we[br]have a two by two identity 0:08:43.818,0:08:45.456 matrix, that's 1001. 0:08:46.920,0:08:52.250 And suppose we have a second[br]matrix, two 3 -- 4 and seven. 0:08:52.250,0:08:55.940 And suppose I want to multiply[br]these two together. 0:08:58.950,0:09:02.030 The identity matrix is[br]certainly a two by two matrix, 0:09:02.030,0:09:05.726 and this matrix is also a two[br]by two matrix. So because 0:09:05.726,0:09:08.806 these numbers are the same, we[br]can actually workout the 0:09:08.806,0:09:12.810 product and the answer is also[br]a two by two matrix. So the 0:09:12.810,0:09:16.198 answer has this sort of shape[br]with four elements in there. 0:09:18.340,0:09:22.904 To get the first element in the[br]answer, we want to pair 10 with 0:09:22.904,0:09:26.816 2 -- 4, multiply the paired[br]elements together and add so we 0:09:26.816,0:09:30.402 get 1 * 2 is 2 added to 0 * -- 0:09:30.402,0:09:33.184 4. Which is just 1 * 2 is 2. 0:09:35.720,0:09:41.080 To get this element here, we[br]want 1 * 3 which is 3 added to 0 0:09:41.080,0:09:43.090 * 7, which is just three. 0:09:45.430,0:09:49.630 To get the element in here, we[br]want to pair 01 with two and 0:09:49.630,0:09:54.730 minus four, so it's 0 * 2, which[br]is nothing 1 * -- 4 is minus 4, 0:09:54.730,0:09:56.530 so we just get minus 4. 0:09:57.630,0:09:59.436 And finally, the last element is 0:09:59.436,0:10:03.854 0 times. Three, which is nothing[br]1 * 7 is 7, so that's our 0:10:03.854,0:10:07.910 answer. And if you look at the[br]answer you'll see the answer is 0:10:07.910,0:10:11.030 identical to the matrix we[br]started with here. In other 0:10:11.030,0:10:14.150 words, multiplying a matrix by[br]an identity matrix when this 0:10:14.150,0:10:16.646 multiplication is possible[br]leaves an answer which is 0:10:16.646,0:10:20.078 identical to the matrix you[br]started with, and that's a very 0:10:20.078,0:10:21.326 important property of identity 0:10:21.326,0:10:25.940 matrices. The same result occurs[br]if we do the multiplication the 0:10:25.940,0:10:30.860 other way round. If we take two[br]3 -- 4 seven and we multiply it 0:10:30.860,0:10:34.140 by the identity matrix, one[br]nought nought one will find. 0:10:34.140,0:10:38.404 It's also possible, and if you[br]go through the operation 2 * 1 0:10:38.404,0:10:42.340 is 2 three times. Nothing is[br]nothing. The result there is 2. 0:10:43.150,0:10:46.000 Two times nothing[br]is nothing 313. 0:10:47.440,0:10:51.604 Minus 4 * 1 added to 7 times[br]nought is minus 4. 0:10:52.270,0:10:56.131 And minus four times North,[br]which is nothing added to 717 0:10:56.131,0:11:00.694 and you'll see again this answer[br]here is the same as this matrix 0:11:00.694,0:11:04.204 here. So that's very important[br]property to remember when you 0:11:04.204,0:11:08.065 multiply a matrix by an identity[br]matrix, it leaves the original 0:11:08.065,0:11:10.873 matrix unaltered, identical to[br]what it was before. 0:11:11.480,0:11:14.135 The same works even if we[br]haven't got square 0:11:14.135,0:11:16.200 matrices. Suppose we have[br]this identity matrix. 0:11:19.650,0:11:23.178 And we multiply, for example by[br]the Matrix 78. 0:11:24.810,0:11:28.702 Well, this has got one row and[br]two columns. It's a one by two 0:11:28.702,0:11:32.038 matrix. This is got two rows,[br]two columns, so we can perform 0:11:32.038,0:11:35.096 the matrix multiplication and[br]the result is going to be a 0:11:35.096,0:11:38.432 one by two matrix that's the[br]same shape as the one we 0:11:38.432,0:11:38.988 started with. 0:11:40.360,0:11:43.708 And if we carry out the[br]operations, it's 7 * 1, which 0:11:43.708,0:11:46.777 is 7 added to 8 times[br]nothing, which is nothing. So 0:11:46.777,0:11:48.172 the result is just 7th. 0:11:49.200,0:11:54.015 7 times and nothing is nothing[br]and 8 * 1 is 8, so it's just 0:11:54.015,0:11:58.188 eight. And again, this answer 7[br]eight is the same as the matrix 0:11:58.188,0:12:01.719 we started with over here. So[br]that's just to reinforce the 0:12:01.719,0:12:04.608 message that multiplying by an[br]identity matrix leaves the 0:12:04.608,0:12:05.571 original matrix unaltered.