If I have a $1\times 2$ matrix $A$, a $2\times 2$ matrix $B$, and a $2\times 2$ matrix $C$, and am asked to calculate ABC, is there a specific order in which I have to carry out the multiplication?
Would I be correct in assuming I have to calculate $AB$ first to get a $1\times 2$ matrix, and then multiply that result by the $2\times 2$ matrix $C$?
Or can you also calculate $BC$ first and then multiply that result by $A$?
$\endgroup$ 12 Answers
$\begingroup$Matrix multiplication is associative, so you can do it in whichever order you like. You can prove it by writing the matrix multiply in summation notation each way and seeing they match.
$\endgroup$ $\begingroup$Matrix multiplication is associative, i.e. $(AB)C=A(BC)$ for every three matrices where multiplication makes sense (i.e. the sizes are right).
For the record, the proof goes something like this: if $A=(A_{ij})_{1\le i \le m, 1\le j \le n}$ ($m\times n$ matrix), $B=(B_{jk})_{1\le j \le n,1\le k \le p}$ ($n\times p$ matrix) and $C=(C_{kl})_{1\le k \le p,1\le l \le q}$ ($p\times q$ matrix), then both $(AB)C$ and $A(BC)$ will be $m\times q$ matrices. For all $1\le i\le m, 1\le l\le q$ we have:
$$((AB)C)_{il}=\sum_{k=1}^{p}(AB)_{ik}C_{kl}=\sum_{k=1}^{p}\left(\sum_{j=1}^{n}A_{ij}B_{jk}\right)C_{kl}=\sum_{k=1}^{p}\left(\sum_{j=1}^{n}(A_{ij}B_{jk})C_{kl}\right)=\sum_{k=1}^{p}\left(\sum_{j=1}^{n}A_{ij}(B_{jk}C_{kl})\right)=\sum_{j=1}^{n}\left(\sum_{k=1}^{p}A_{ij}(B_{jk}C_{kl})\right)=\sum_{j=1}^{n}A_{ij}\left(\sum_{k=1}^{p}B_{jk}C_{kl}\right)=\sum_{j=1}^{n}A_{ij}(BC)_{jl}=(A(BC))_{il}$$
That means that the matrices $(AB)C$ and $A(BC)$ have all their components pairwise equal, thus $(AB)C=A(BC)$.
$\endgroup$