Well, after the last video, hopefully we’re a little familiar with how you add matrices. So now let’s learn how to multiply matrices. And keep in mind, these are human created definitions for matrix multiplication. We could have come up with completely different ways to multiply it but I encourage you to learn this way because it will help you in math class and we’ll see later that there’s actually a lot of applications that come out of this type of matrix multiplication. So, let me think of two matrices. I’ll do two by two matrices and let’s multiply them.
Let’s say—let me pick some random numbers, 2 - 3 7 and 5 and I am going to multiply that matrix or that table of numbers times—let’s see 10 - 8. Let me pick a good number here. 12 and then -2.
So now, there might be a strong temptation and you know in some ways, it’s not even an illegitimate temptation to do the same thing with multiplication that we did with addition to just multiply the corresponding terms. So you might be subjected to say, “Oh well this first term right here, the one, one term or in the first row and first column is just going to be 2 × 10. And this term is going to be - 3 × - 8 and so forth. And that’s how we added matrices. So it’s maybe a natural extension to multiply matrices the same way.
And that is kind of—that’s legitimate. One could define it that way but that’s not the way it is the real world. And the rain in the real world unfortunately is more complex. But if you look at a bunch of examples, I think you’ll get it and you’ll learn that it’s actually fairly straightforward. So how do we do it?
So this first term—this first term that’s in the first row and it’s first column. It’s equal to—essentially this first rows vectors—this first row vector times this column vector. And what do I mean by that? Right? So it’s getting—it’s row information from the first matrices row and it’s getting its column information from the second matrices column. So, how do I do that?
If you’re familiar with dot product, it’s essentially the dot product of these two matrices or without saying that fancy, it’s just this; it’s 2 × 10. So 2—let me write it small. 2 × 10 + -3 × 12. That’s all. I am going to run out of space. And so what’s the second term over here? Well, we’re still in the first row of the product vector but now we’re in the second column and we get our column information from here.
So let’s—let me pick a good color. So this is slightly different. Shade of purple. So now, this is going to be—I’ll do that in another color. 2 × -8. Let me just write out the number. 2 × -8 is -16, right? 2 × -8 + -3 × -2. What’s -3 × -2? That is +6, right? So that’s in row one, column two. It’s -16 + 6. And then let’s come down here.
So now, we’re going in the second row. So now we’re going to use. We’re getting our row information from the first matrix. And I know this is confusing and I feel bad for you right now but we’re going to do a bunch of examples and I think it will make sense.
So this term; the bottom left term is going to be this row times this column. So it’s going to be 7 × 10. So 70 +—7 × 10+ 5 × 12—+60. 5 × 12. And then the bottom right term is going to be 7 × -8 which is what? -56. 7 × -8 + 5 × -2. So that’s -10.
So the final product is going to be 2 × 10 is 20 -36. So it’s -16. -16 +6. That’s 10. 90—was that what I said—no, no because this is 70. 70 +60, that’s a 130. And then -56, right? That’s what—-56 - 10. So -66.
So there you have it. We just multiply this matrix times this matrix. Let me do another example and I think it will start. And actually I am going to squeeze it on this side so that we can write this side out a little bit more neatly.
So let’s take the matrix—I don’t know—one, two three, four times the matrix—I don’t know—five, six, seven, eight. Now we have much more space to work with. So this should come out neater. Okay but I am going to do the same thing.
So let’s first—so to get this term right here, the top left term, we’re going to take—or the one that has row one, column one, we’re going to take the row one information—sorry. Edit, undo. We’re going to take the row one information from here and the column one information from here.
So you can kind of view it as this row of vector times this column vector. So it results 1 × 5 + 2 × 7, right. There you go. And so this term, it will be this row vector times this column vector. Let me do that in a different color. So, it will be 1 2 ×—it will be 1 × 6 + 2 × 8. So let me write that down. So it’s 1 × 6 + 2 × 8. Now we go down to the second row and we got a row information from the first vector.
So let me circle it with this color. And it is 3 × 5 + 4 × 7. So it’s 3 × 5 + 4 × 7. And then we’re in the bottom right. So we’re in the bottom row in second column. Second row, second column, so we get a row information from here and our column information from here. So it’s 3 × 6 + 4 × 8. And if we simplify, you see this is 5 +—well actually let me just remind you where all the numbers came from.
So we have that green color, right? This one and this two, that’s this one and this two. This one and this two, right. And notice these were in the first row. They’re in the first row here. And this five and this seven; well that’s this five; this seven and this five and this seven. So interesting.
In the first—this wasn’t the column one in second matrix and this isn’t column one in the product matrix. And similarly, this six and the eight; that’s this six, this eight and then it’s used here. This six and this eight. And then finally this three and four in the brown, so that’s this three, this four, this three and this four.
And then we can of course simplify them. This was 1 × 5 + 2 × 7. So that’s 5 +14. So this is 19. This is 1 × 6 + 2 × 8. So that’s 6 + 16, so that’s 22. This is 3 × 5 + 4 × 7. So 15 + 28 is 38, 43 if my math is correct. And then we have 3 × 6 + 4 × 8. So that’s 18 + 4 × 8, 18 + 32, that’s 50.
So now let me ask you. So—you know the product matrix—just write it neatly as 19, 22, 43 and 50. So now let me ask you a question. When we did matrix addition, we learned that if I had two matrices, it didn’t matter what order we added them in. So, if we said a + b and these are matrices. That’s why I’m making them all—this is the same thing as b + a base on how we define matrix addition; b + a.
So now let me ask you a question. Is multiplying two matrices, is a b—that’s just means we’re multiplying a and b. Is that the same thing as b a? Does it matter? Does the order of the matrix multiplication matter? And so I’ll tell you right now, it actually matters a tremendous amount and actually there are certain matrices that you can add in one direction that you can’t add in the other. No that you can’t—that you can multiply in one way but you can’t multiply in the other order. And—well I’ll show you that in an example.
But just to show that this isn’t even equal for most matrices, I encourage you to multiply these two matrices in the other order and actually, let me do that. I can—let me do that really fast just to prove the point to you. So let me delete all of this top part. Let me see. Let me delete all of it. And actually I can delete this.
So hopefully you—you know. When I multiply this matrix times this matrix, I got this. So let me switch the order and I’ll do it fairly fast just so—so as to not bore you. So let me switch the order of the matrix multiplication. And this is good. This is another example.
So, I am going to multiply this matrix, 5 6 7 8 × this matrix and I just switch the order. And we’re testing to see whether order matters. 1 2 3 4. Let’s do it and I won’t do all the colors and everything. I’ll just do it systematically—I think you just have to see a lot of examples here.
So this first term gets its row information from the first matrix column information from the second matrix. So it’s 5 × 1 + 6 × 3. Let me just write—actually edit. I am going to skip a step here. Edit, undo. Okay so it’s 5 × 1. So it’s 5 + 6 × 3 + 18. what’s the second term here? It’s going to be 5 × 2 + 6 × 4. So 5 × 2 is 10. + 6 × 4. 6 × 4 is 24, right? Now we just took this row times this column right here.
Okay, now we’re down here. So when we’re doing this row, this element right here. The bottom left is going to use this row in this column. So this is 7 × 1 = 7 +—7 × 1 8 × 3. 8 × 3 is 24. And then finally, to get this element, we’re essentially multiplying this row times this column. So it’s 7 × 2. 7 × 2 is 14 + 7 × 2 + 8 × 4 +32. So this is equal to 5 + 18 and it’s what? 23, 34. Well 7 + 24 is 31. 31, 46.
So notice, if we call this—if we call—let’s say that this is matrix a. This is matrix and this is matrix b, right? In the last example, we showed that a × b = 19, 22, 43, 50. Now we just showed that—well, if you reverse the order, b × a is actually this—completely different matrix. So the order in which you multiply matrices completely matters.
So I’m actually—I’m running out of time. In the next video, I am going to talk a little bit more about the types of matrix. Well one, we know that order matters and in the next video, I’ll show that—what type of matrices can be multiplied by each other when we added or subtracted matrices, we just said, “Well, they have to have the same direction” because you’re adding or subtracting corresponding terms. But as you see with multiplication, it’s a little bit different. And we’ll do that in the next video. See you soon.
Transcription by:
Scribe4you Transcription Services