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.

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?

• Is This property true for more than 3 matrices? e.g. ABCD = (AB)(CD) or (A(BC))D or A(B(CD)) ?
• Yes, this property is true for more than 3 matrices!
• There are so much variables, is there any way to keep track of them all?
• Sometimes it helps to use one letter for each matrix, and use subscripts to denote the different entries in each. For example instead of going up to l use a1,a2,a3,a4, for the first matrix, b1,b2,b3,b4 for the next, and c1,c2,c3,c4, for the last. this allows you to better see what matrix each entry came from.
• In the end, you explained that iae = aei, but I still don't understand how? Then, you mention scalar property, which only make me more confuse, how is this related to scalar multiplication?
• Each of the entries within a matrix is a scalar. By now you are assumed to realize that when you multiply (2*3)*4, for instance, you will get the same thing as when you multiply (3*4)*2. The associative and commutative properties of scalar multiplication are well-established and familiar, but you might not have called them that.
• is this the only way to multiply three or more matrices?
• No, kinda. When you see ABC, it is implied that what you are actually doing is this: (AB)C (assuming you follow the rules of PEMDAS). This video shows that the operation ABC is associative, meaning ABC not only implies you are doing (AB)C, but you could also do A(BC). Remember, as long as you multiply the matrices in order, (matrix multiplication isn't commutative) you don't have to worry about parenthesis placement as such presented in this video.
• I get the proof but I struggle to understand it intuitively. My brain doesn't let me generalize the proof for non-square matrices without checking the specific cases.
Any help?
• Matrices represent a certain type of transformations of space. An nxm matrix turns an m-dimensional space into an n-dimensional space, and multiplying matrices corresponds to applying one transformation after another.

Therefore, matrix multiplication is a specific type of function composition. Because function composition is associative, so too is matrix multiplication.
• If there are three matrices namely A,B and C with their order (3*2),(2*4) and (4*1) respectively. Is it possible to apply Associative property i.e. A.(B*C)=(A*B).C in this context.
• Yes, that is correct. The associative property of matrices applies regardless of the dimensions of the matrix.

In the case `A·(B·C)`, first you multiply `B·C`, and end up with a 2⨉1 matrix, and then you multiply `A` by this matrix.

In the case of `(A·B)·C`, first you multiply `A·B` and end up with a 3⨉4 matrix that you can then multiply by `C`.

At the end you will have the same 3⨉1 matrix .
• Does this only work for square matrices?
• Check this and you will see it works as well:

|a| * |c d| * |e|
|b|________|f|
(1 vote)
• Is there a way to generically show it for n*n matrices?
• what if they were not of the same dimensions?
• Addition of matrices of different dimensions is undefined.
(1 vote)
• how would you rewrite an expression using the associative property and then evaluate the expression
(1 vote)
• If your expression was (AB)C you could rewrite it as A(BC). Likewise, if your expression was A(BC), you could rewrite it as (AB)C. The only information communicated by placing parenthesis in the expression is that it tells you which two matrices to multiply first (think PEMDAS).

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.