If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Associative property of matrix multiplication

Sal shows that matrix multiplication is associative. Mathematically, this means that for any three matrices A, B, and C, (A*B)*C=A*(B*C). Created by Sal Khan.

Want to join the conversation?

Video transcript

Voiceover:What I want to do in this video, is show that matrix multiplication is associative. At least I'll show it for 2 by 2 matrices. And what I do in this video you can extend it to really any dimension of matrices for which of the matrix multiplication is actually defined. So let's look at 3 matrices, so let's say this first matrix is A, B, C, and D and this second matrix is E, F, G, H and then finally this third matrix is I, J, and that's not the imaginary unit I, just letter I, and this isn't E, this is just the letter E. J, K and L, and I want to look at 2 scenarios. So let me actually just copy and paste this, So copy and paste. So I want to look at this scenario where first, I multiply the orange and the yellow matrix. And I multiply that times the purple matrix And then another scenario where first I multiply the yellow and the purple and multiply that times the orange and if these two products based on how I, which ones I do first come out the same then I've just shown that at least for three 2 by 2 matrices, that matrix multiplication is associative. If we already seen that it's not commutative, let's see whether it's associative. And actually I'll give you the punchline, it is. But let's work through it and I encourage you to actually pause the video yourself , and try to work through it with these letters and then see if you got the result that I just said that you should be getting. Alright, so let's multiply these first two. So this product, I'm gonna make it a little bit big. So it's going to be AE + BG, then AF + BH, and then it's going to be CE + DG, and then finally it's gonna be CF + DH. And we're going to multiply it times the matrix the matrix, I, J, K, and L and what does this give us? And I'll just give us some space to do this with. So this will give us, let me give myself an ample amount of space, so it's going to be this stuff, times I, so we could write this as I, actually let me just distribute the I. IAE + IBG + this stuff times K, + KAF + KBH. I'm already gonna run out of space here, so let me clear this, let me just keep going. And then we're gonna multiply this, essentially, we're going to consider this row and this column. First row, second column and so you are going to have JAE + JBG + LAF + LBH so, these matrices are bigger than I expected they would be. And then you're going to have over here you're going to have this times this plus this times this. So ICE + IDG + KCF + KDH and then finally, this times this plus this plus this, or this times that plus this times that. So JCE + JDG + LCF + LDH, alright. Now see if we can power through this one over here. So what is this product going to be? This product if I multiply by these two first. It's going to be EI + FK + EJ, no not plus, this is the next entry, EJ + FL, Then we have GI + HK and then finally we have GJ + HL. Then it's all going to be multiplied times ABCD. A, B, C, and D, and I'm going to need some real estate to do this, so let me do it down here, I'll do it in green. So let me do a little arrow to show, or actually I can just scroll over a little bit, that actually might work out better. So what am I going to get, so A times this, plus B times this, so AEI + AFK + BGI + BHK, then you're going to have this row and this column, So it's AEJ + AFL + BGJ + BHL, close the brackets, now you're going to have C times this plus D times this. So CEI + CFK + DGI + DHK and then finally, home stretch, C times that plus D times this. So CEJ + CFL, and then you're going to have, + DGJ + DHL, now are these two things equivalent? Well let's look at entry by entry. So, IAE, this is equivalent to AEI. Because we know scalar multiplication is commutative, Now IBJ or IBG, you see it there and you see it there, KAF, you see it there and this is the same thing as AFK. And then KBH, this is the same thing as BHK. And you can go entry by entry, actually, let's just do that, I'll do that really fast, so let's do, so ICE is the same thing as CEI. IDG is the same thing as DGI. KCF is the same thing as CFK, KDH is the same thing as DHK, and we go to the second columns, JAE, AEJ, JBG is the same thing as BGJ LAF is the same thing as AFL, And LBH is the same thing as BHL and then finally JCE is the same thing as CEJ JDG is the same thing as DGJ, LEF, LEF, or is that LCF? Let's see, LDH is this right over here, And so this one must be an LCF is the same thing as CFL. Is this one right over here an LCF, let me make sure, Cause that would throw a major monkey wrench into the whole operation, so this entry right over here, is going to be, we get that from multiplying the second row times the second column and we're going to get, we get JCE + JDG and then we have LCF, yeah that's LCF + LDH, and so [you will] see that these two quantities are the same it doesn't matter if I multiply the first two first and then multiply by the third. Or multiply the second and third and then multiply by the first, now once again, this is the associative property, I'm keeping them essentially in the same order. Order matters, but as we see, we can associate these. We can do the first two first or we can do the second two first.