Matrix Multiplication is Associative

Theorem
Matrix multiplication (conventional) is associative.

Proof

 * Let $\mathbf A = \left[{a}\right]_{m n}, \mathbf B = \left[{b}\right]_{n p}, \mathbf C = \left[{c}\right]_{p q}$ be matrices over a ring $\left({R, +, \circ}\right)$.

From inspection of the subscripts, we can see that both $\left({\mathbf A \mathbf B}\right) \mathbf C$ and $\mathbf A \left({\mathbf B \mathbf C}\right)$ are defined:

$\mathbf A$ has $n$ columns and $\mathbf B$ has $n$ rows, while $\mathbf B$ has $p$ columns and $\mathbf C$ has $p$ rows.


 * Consider $\left({\mathbf A \mathbf B}\right) \mathbf C$.

Let $\mathbf R = \left[{r}\right]_{m p} = \mathbf A \mathbf B, \mathbf S = \left[{s}\right]_{m q} = \left({\mathbf A \mathbf B}\right) \mathbf C$.

Then:

Thus:
 * $\displaystyle s_{i j} = \sum_{k=1}^p \sum_{l=1}^n a_{i l} \circ b_{l k} \circ c_{k j}$


 * Now consider $\mathbf A \left({\mathbf B \mathbf C}\right)$.

This time, let $\mathbf R = \left[{r}\right]_{n q} = \mathbf B \mathbf C, \mathbf S = \left[{s}\right]_{m q} = \mathbf A \left({\mathbf B \mathbf C}\right)$.

Then:

Thus:
 * $\displaystyle s_{i j} = \sum_{l=1}^n a_{i l} \circ \sum_{k=1}^p b_{l k} \circ c_{k j}$


 * As addition is commutative, we can see that $s_{i j}$ is the same in both cases.

Show that $\displaystyle \sum_{k=1}^p \sum_{l=1}^n a_{i l} \circ b_{l k} \circ c_{k j} = \sum_{l=1}^n a_{i l} \circ \sum_{k=1}^p b_{l k} \circ c_{k j}$.

Hence $\left({\mathbf A \mathbf B}\right) \mathbf C = \mathbf A \left({\mathbf B \mathbf C}\right)$.