1 00:00:07,724 --> 00:00:09,640 CHRISTINE BREINER: Welcome back to recitation. 2 00:00:09,640 --> 00:00:11,390 In this video, I really just want 3 00:00:11,390 --> 00:00:13,930 to practice matrix multiplication, which 4 00:00:13,930 --> 00:00:15,830 is potentially something new for some of you, 5 00:00:15,830 --> 00:00:17,996 and maybe some of you have been doing it for a while 6 00:00:17,996 --> 00:00:19,044 and are very good at it. 7 00:00:19,044 --> 00:00:21,460 But I want to make sure that everyone is feeling confident 8 00:00:21,460 --> 00:00:23,550 in their ability to multiply matrices. 9 00:00:23,550 --> 00:00:26,170 So we have three matrices here. 10 00:00:26,170 --> 00:00:30,650 We have A, B, and C. And what I want you to do 11 00:00:30,650 --> 00:00:33,370 is I want you to compute what makes sense below. 12 00:00:33,370 --> 00:00:37,140 I have four products of matrices below. 13 00:00:37,140 --> 00:00:44,060 a is A times B, b is B times A, c is B times C, 14 00:00:44,060 --> 00:00:46,560 and d is A times C. So I want you 15 00:00:46,560 --> 00:00:49,780 to multiply the matrices that make sense to multiply, 16 00:00:49,780 --> 00:00:53,260 and then the ones that don't, make sure you understand why. 17 00:00:53,260 --> 00:00:54,960 Give yourself a brief explanation 18 00:00:54,960 --> 00:00:57,620 of why you can't multiply them. 19 00:00:57,620 --> 00:00:59,737 So why don't you work on that, pause the video, 20 00:00:59,737 --> 00:01:01,570 and when you feel confident in your answers, 21 00:01:01,570 --> 00:01:04,236 bring the video back up, and you can check them against my work. 22 00:01:11,780 --> 00:01:12,610 OK, welcome back. 23 00:01:12,610 --> 00:01:15,320 Well, we wanted to make sure we felt comfortable multiplying 24 00:01:15,320 --> 00:01:16,310 matrices. 25 00:01:16,310 --> 00:01:19,530 So what we're going to do is look at the four products 26 00:01:19,530 --> 00:01:23,870 I mentioned below, and we're going to see how they do, 27 00:01:23,870 --> 00:01:25,840 whether or not we can actually compute them. 28 00:01:25,840 --> 00:01:28,660 So let's first look at a, which was 29 00:01:28,660 --> 00:01:32,120 A times B. So before I write it down again, 30 00:01:32,120 --> 00:01:38,320 A times B is-- notice A is a 2 by 2 matrix, and B is a 2 31 00:01:38,320 --> 00:01:40,360 by 3 matrix, right? 32 00:01:40,360 --> 00:01:46,870 And so if I write letter a, we know we're taking a 2 33 00:01:46,870 --> 00:01:50,350 by 2 by a 2 by 3. 34 00:01:50,350 --> 00:01:54,570 And so the fact that the interior dimensions agree, 35 00:01:54,570 --> 00:01:56,450 that the number of columns of A is 36 00:01:56,450 --> 00:01:58,130 equal to the number of rows of B, 37 00:01:58,130 --> 00:01:59,700 means that I can multiply them. 38 00:01:59,700 --> 00:02:02,510 So I can multiply them, and my result I expect to get 39 00:02:02,510 --> 00:02:05,460 is, of course, the dimensions we have on the outside. 40 00:02:05,460 --> 00:02:07,940 So I expect to get a 2 by 3 matrix. 41 00:02:07,940 --> 00:02:10,310 So I'm going to rewrite A and B here, 42 00:02:10,310 --> 00:02:12,810 so that I don't have to keep walking back and forth, 43 00:02:12,810 --> 00:02:15,440 and then we'll do the multiplication. 44 00:02:15,440 --> 00:02:26,900 So I have [6, 5; 1, 2] times [2, -1, 3; 1, 0, 4]. 45 00:02:26,900 --> 00:02:27,760 OK. 46 00:02:27,760 --> 00:02:30,880 So I want to perform this multiplication. 47 00:02:30,880 --> 00:02:33,200 Now remember that when you are looking 48 00:02:33,200 --> 00:02:37,110 for a value in your resulting matrix, which I know is 2 by 3, 49 00:02:37,110 --> 00:02:41,780 so I can even make a little space for myself. 50 00:02:41,780 --> 00:02:43,495 I know it's 2 by 3, so I know I'm going 51 00:02:43,495 --> 00:02:45,130 to have to fill in these spots. 52 00:02:45,130 --> 00:02:48,880 When I look at this position, it's row 1, column 1. 53 00:02:48,880 --> 00:02:51,870 That means I take row 1 of the first matrix, 54 00:02:51,870 --> 00:02:53,680 and I'm essentially just dotting it 55 00:02:53,680 --> 00:02:55,380 with column 1 of the second matrix. 56 00:02:55,380 --> 00:02:59,630 So I'm taking row 1 times column 1 in the way it was described, 57 00:02:59,630 --> 00:03:03,910 which is I take 6 times 2, and I add it to 5 times 1. 58 00:03:03,910 --> 00:03:07,810 So row 1, column 1 gives me 6 times 2 is 12, plus 5 times 59 00:03:07,810 --> 00:03:12,380 1 which is 5, so I get 17. 60 00:03:12,380 --> 00:03:14,620 And then if I come in to the next spot, what is this? 61 00:03:14,620 --> 00:03:18,850 And the resulting matrix's position is row 1, column 2. 62 00:03:18,850 --> 00:03:21,000 So now I take row 1 of the first matrix 63 00:03:21,000 --> 00:03:23,550 and column 2 of the second matrix, 64 00:03:23,550 --> 00:03:29,190 and I get 6 times negative 1 is negative 6, plus 0 times 5, 65 00:03:29,190 --> 00:03:32,050 so I get a negative 6 here. 66 00:03:32,050 --> 00:03:34,815 Negative 6 times 0. 67 00:03:34,815 --> 00:03:36,190 Maybe I should show you this way. 68 00:03:36,190 --> 00:03:38,150 Negative 6 times 0. 69 00:03:38,150 --> 00:03:39,170 OK. 70 00:03:39,170 --> 00:03:41,860 And then here I am now in the third spot of the first row, 71 00:03:41,860 --> 00:03:44,060 so I'm in a row 1, column 3. 72 00:03:44,060 --> 00:03:48,370 So that's again, row 1 of the first, column 3 of the second. 73 00:03:48,370 --> 00:03:51,894 So you see a pattern here about where we're getting our things 74 00:03:51,894 --> 00:03:53,060 from that we're multiplying. 75 00:03:53,060 --> 00:03:55,540 For row 1, column 3 of the resulting, 76 00:03:55,540 --> 00:03:58,600 I take row 1 of the first and column 3 of the second. 77 00:03:58,600 --> 00:04:04,580 So 6 times 3 is 18, plus-- 5 times 4 is 20. 78 00:04:04,580 --> 00:04:06,920 So 20 plus 18 is 38. 79 00:04:10,260 --> 00:04:11,284 OK. 80 00:04:11,284 --> 00:04:13,200 Now I have to do the same thing on the bottom. 81 00:04:13,200 --> 00:04:14,339 Right? 82 00:04:14,339 --> 00:04:16,380 So I have now here, the row, notice I'm in row 2, 83 00:04:16,380 --> 00:04:19,470 so I'm always going to use row 2 of this first matrix. 84 00:04:19,470 --> 00:04:21,370 And then what we saw last time is I 85 00:04:21,370 --> 00:04:23,400 used column 1 in the first spot, column 2 86 00:04:23,400 --> 00:04:25,430 in the second spot, column 3 in the third spot. 87 00:04:25,430 --> 00:04:25,930 Right? 88 00:04:25,930 --> 00:04:27,596 That's what happens over and over again. 89 00:04:27,596 --> 00:04:28,440 So what do I do? 90 00:04:28,440 --> 00:04:31,760 I take [1, 2], and I multiply it by [2, 1]. 91 00:04:31,760 --> 00:04:34,570 So I take 1 times 2, plus 2 times 1. 92 00:04:34,570 --> 00:04:40,290 So I get 2 there and 2 there, so I get a 4. 93 00:04:40,290 --> 00:04:43,970 And then the next column: row 2, column 2. 94 00:04:43,970 --> 00:04:47,235 1 times negative 1 is negative 1-- 2 times 0 95 00:04:47,235 --> 00:04:50,420 is 0-- so I get a negative 1. 96 00:04:50,420 --> 00:04:52,010 And then the last column. 97 00:04:52,010 --> 00:04:53,620 1 times 3 is 3. 98 00:04:53,620 --> 00:04:55,200 2 times 4 is 8. 99 00:04:55,200 --> 00:04:59,230 So I get 3 plus 8, so I get 11. 100 00:04:59,230 --> 00:05:02,980 Hopefully I didn't make any stupid summing mistakes there, 101 00:05:02,980 --> 00:05:04,750 but if I did, you probably caught it. 102 00:05:04,750 --> 00:05:07,010 Because I was trying to say what I did as we went. 103 00:05:07,010 --> 00:05:09,191 So that is the answer to a. 104 00:05:09,191 --> 00:05:09,690 OK. 105 00:05:09,690 --> 00:05:12,460 So now let's think about what is b. 106 00:05:12,460 --> 00:05:18,880 b was take B times A, which is just to switch the order. 107 00:05:18,880 --> 00:05:20,690 So let's look at the dimension match-up. 108 00:05:20,690 --> 00:05:23,250 Now we have a 2 by 3 matrix, and I'm 109 00:05:23,250 --> 00:05:25,730 trying to multiply it by a 2 by 2 matrix. 110 00:05:25,730 --> 00:05:27,720 Well, I don't have to do any more work, 111 00:05:27,720 --> 00:05:28,950 because I can't do it. 112 00:05:28,950 --> 00:05:31,880 Because the dimensions of the insides here-- three columns 113 00:05:31,880 --> 00:05:35,880 for B, two rows for A-- means that I can't actually 114 00:05:35,880 --> 00:05:36,920 multiply them. 115 00:05:36,920 --> 00:05:37,420 OK? 116 00:05:37,420 --> 00:05:39,320 So this isn't even defined. 117 00:05:43,910 --> 00:05:45,460 OK, so that was easy. 118 00:05:45,460 --> 00:05:46,470 That was b. 119 00:05:46,470 --> 00:05:47,790 All right. 120 00:05:47,790 --> 00:05:50,950 Letter c-- I'll give myself a lot of room 121 00:05:50,950 --> 00:05:54,805 to do that-- letter c was B times C. 122 00:05:54,805 --> 00:05:56,680 And so I'm going to write down the dimensions 123 00:05:56,680 --> 00:05:59,350 to see if I even need to write down the matrices. 124 00:05:59,350 --> 00:06:04,670 B was two rows by three columns, and C 125 00:06:04,670 --> 00:06:08,170 was three rows by two columns. 126 00:06:08,170 --> 00:06:11,270 So if I look at the dimensions, the 3 and the 3 match up, 127 00:06:11,270 --> 00:06:13,020 so I am going to be able to multiply them, 128 00:06:13,020 --> 00:06:16,910 and my result-- as I mentioned before-- should be a 2 by 2. 129 00:06:16,910 --> 00:06:20,480 So let me write down B and C here, 130 00:06:20,480 --> 00:06:22,290 so we don't have to keep going to the side. 131 00:06:30,110 --> 00:06:30,640 OK. 132 00:06:30,640 --> 00:06:40,370 And then C is 1, 2 negative 1; negative 1, 3, 2. 133 00:06:40,370 --> 00:06:43,930 All right, let me just make sure I didn't transcribe anything 134 00:06:43,930 --> 00:06:45,074 incorrectly. 135 00:06:45,074 --> 00:06:45,990 I think it looks good. 136 00:06:45,990 --> 00:06:47,630 OK. 137 00:06:47,630 --> 00:06:53,920 So row 1 of B. Row 2 of B. Column 1 of C. Column 2 of C. 138 00:06:53,920 --> 00:06:56,060 We're going to be dealing with those, specifically. 139 00:06:56,060 --> 00:06:57,650 So we want to multiply these. 140 00:06:57,650 --> 00:07:01,320 We said our resulting matrix is going to be 2 by 2. 141 00:07:01,320 --> 00:07:03,192 OK. 142 00:07:03,192 --> 00:07:04,900 Because I'm going to have a lot of terms, 143 00:07:04,900 --> 00:07:07,720 I might write them down on this one, and then simplify. 144 00:07:07,720 --> 00:07:10,990 Because I may make a mistake, so to be more careful, 145 00:07:10,990 --> 00:07:13,320 I'll write down all the pieces. 146 00:07:13,320 --> 00:07:16,630 So here I am in row 1, column 1 of the resulting. 147 00:07:16,630 --> 00:07:19,130 So I take row 1 of the first, column 1 of the second, 148 00:07:19,130 --> 00:07:21,360 and what do I get when I multiply? 149 00:07:21,360 --> 00:07:24,180 I get 2 times 1-- that's 2. 150 00:07:24,180 --> 00:07:27,830 Plus negative 1 times 2-- that's negative 2. 151 00:07:27,830 --> 00:07:31,261 Plus 3 times negative 1-- that's negative 3. 152 00:07:31,261 --> 00:07:31,760 Right? 153 00:07:31,760 --> 00:07:34,440 That's all we have to do for the first position. 154 00:07:34,440 --> 00:07:37,420 Then I do, for the second one, it's row 1, column 2. 155 00:07:37,420 --> 00:07:40,289 So I do row 1, column 2. 156 00:07:40,289 --> 00:07:42,080 So I'll try to keep my head out of the way. 157 00:07:42,080 --> 00:07:43,538 I realize I keep stepping in front. 158 00:07:43,538 --> 00:07:45,410 So it's 2 times negative 1. 159 00:07:45,410 --> 00:07:47,540 I get negative 2. 160 00:07:47,540 --> 00:07:51,690 Negative 1 times 3, so I get negative 3. 161 00:07:51,690 --> 00:07:55,800 And 3 times 2 gives me 6. 162 00:07:55,800 --> 00:07:56,960 OK. 163 00:07:56,960 --> 00:07:58,900 And then the bottom two. 164 00:07:58,900 --> 00:08:03,050 I get row 2, column 1 over here, and then 165 00:08:03,050 --> 00:08:06,220 row 2, column 2 over here. 166 00:08:06,220 --> 00:08:10,310 So row 2, column 1 is going to be 1 times 1. 167 00:08:10,310 --> 00:08:13,250 Plus 0 times 2. 168 00:08:13,250 --> 00:08:18,130 Plus 4 times negative 1, so I get negative 4. 169 00:08:18,130 --> 00:08:20,120 And then here. 170 00:08:20,120 --> 00:08:22,240 Row 2, column 2. 171 00:08:22,240 --> 00:08:25,400 I get 1 times negative 1, so I have negative 1. 172 00:08:25,400 --> 00:08:29,230 Plus 0 times 3-- plus 0. 173 00:08:29,230 --> 00:08:32,820 And then 4 times 2 is 8. 174 00:08:32,820 --> 00:08:36,500 So if I simplify these, it looks like in the first spot 175 00:08:36,500 --> 00:08:38,830 I should get a negative 3. 176 00:08:38,830 --> 00:08:42,030 And the second spot, I should get a 1. 177 00:08:42,030 --> 00:08:44,160 This is just for you to check your answer. 178 00:08:44,160 --> 00:08:47,240 And the third spot, I get a negative 3. 179 00:08:47,240 --> 00:08:50,320 And then the fourth spot, I get a 7. 180 00:08:50,320 --> 00:08:54,120 So hopefully I added correctly all throughout. 181 00:08:54,120 --> 00:08:57,490 I think I did, so I think we're good there. 182 00:08:57,490 --> 00:08:59,570 So that is the answer to c. 183 00:08:59,570 --> 00:09:01,860 And again, the reason we can multiply those, 184 00:09:01,860 --> 00:09:05,310 was that the dimensions-- when you wrote them down in order-- 185 00:09:05,310 --> 00:09:07,840 the dimensions to the inside agreed, 186 00:09:07,840 --> 00:09:09,460 and then the outside gives us the size 187 00:09:09,460 --> 00:09:11,140 of the resulting matrix. 188 00:09:11,140 --> 00:09:15,570 So there was one more problem, and that was d. 189 00:09:15,570 --> 00:09:20,960 And I wanted you to take A times C. And A was a 2 by 2. 190 00:09:20,960 --> 00:09:24,710 And C was a 3 by 2. 191 00:09:24,710 --> 00:09:27,360 And so again, we see we can't do it, 192 00:09:27,360 --> 00:09:29,710 because the two interior dimensions 193 00:09:29,710 --> 00:09:33,240 here-- when I write them in that order-- don't agree. 194 00:09:33,240 --> 00:09:33,740 OK. 195 00:09:33,740 --> 00:09:36,010 So d is not defined. 196 00:09:39,746 --> 00:09:43,930 All right, so the basic idea of this whole video 197 00:09:43,930 --> 00:09:47,160 is just to make sure we felt comfortable multiplying 198 00:09:47,160 --> 00:09:47,890 matrices. 199 00:09:47,890 --> 00:09:50,440 We're trying to use some simple examples to understand that. 200 00:09:50,440 --> 00:09:53,730 Understand how we can recognize from the dimensions 201 00:09:53,730 --> 00:09:56,540 whether or not multiplication is even defined, 202 00:09:56,540 --> 00:09:59,550 and then what size the resulting matrix will be. 203 00:09:59,550 --> 00:10:01,550 I do want to point out one thing. 204 00:10:01,550 --> 00:10:04,970 And I want to point out that if we come over to our example 205 00:10:04,970 --> 00:10:08,000 back in the beginning. 206 00:10:08,000 --> 00:10:13,350 We had A*B as our first example and then B*A as our second 207 00:10:13,350 --> 00:10:14,350 example. 208 00:10:14,350 --> 00:10:17,130 And A*B-- well, I think, I got to remember what they were-- 209 00:10:17,130 --> 00:10:21,250 yeah, A*B you could multiply, but B*A you could not. 210 00:10:21,250 --> 00:10:24,340 So I think it has been stressed before, 211 00:10:24,340 --> 00:10:27,190 but I think I should stress it again, that order 212 00:10:27,190 --> 00:10:28,850 matters in multiplication. 213 00:10:28,850 --> 00:10:29,350 OK? 214 00:10:29,350 --> 00:10:30,641 You can't commute these things. 215 00:10:30,641 --> 00:10:33,860 You can't switch the order and get the same result. 216 00:10:33,860 --> 00:10:35,470 So matrix multiplication, you have 217 00:10:35,470 --> 00:10:38,960 to be very careful about keeping things in the same order 218 00:10:38,960 --> 00:10:40,770 as you're multiplying. 219 00:10:40,770 --> 00:10:43,730 OK, I think that is where I will stop.