This is a picture of the proof, we assume that the elements of the matrix are elements of a ring:
I don't know how the associativity is proved here without using commutativity.
I have changed the notation myself in order to understand the proof better:
$$d_{ji}=(a_{j1}b_{11}+...+a_{jn}b_{n1})c_{1i}+...+(a_{j1}b_{1l}+...+a_{jn}b_{nl})c_{li}$$
is because of distributivity
$$(a_{j1}b_{11}c_{1i}+...+a_{jn}b_{n1}c_{1i})+...+(a_{j1}b_{1l}c_{li}+...+a_{jn}b_{nl}c_{li})$$
which is because of associativity the same as
$$a_{j1}b_{11}c_{1i}+...+a_{jn}b_{n1}c_{1i}+...+a_{j1}b_{1l}c_{li}+...+a_{jn}b_{nl}c_{li}\tag{*}$$
which means I can put the parenthesis where I want.
I want to show that this is equal to: $a_{j1}(b_{11}c_{1i}+...+b_{1l}c_{li})+...+a_{jn}(b_{n1}c_{1i}+...+b_{nl}c_{li})$.
However, because of distributivity and associativity, this is equal to
$$a_{j1}b_{11}c_{1i}+...+a_{j1}b_{1l}c_{li}+...+a_{jn}b_{n1}c_{1i}+...+a_{jn}b_{nl}c_{li}\tag{**}$$
The array $(*)$ has a different order than the array $(**)$. Therefore the commutativity was used but the proof says only associativity and distributivity is used.
Is there a mistake in my reasoning or is commutativity unnecessary?
EDIT
Definiton of matrixmultiplication:
$\endgroup$ 51 Answer
$\begingroup$Let $A = (A_{ij})$, $B = (B_{ij})$ and $C = (C_{ij})$ be matrices with the correct sizes to make all the relevant multiplications well-defined. Just compute $$((AB)C)_{ij} = \sum_k (AB)_{ik}C_{kj} = \sum_k \left(\sum_\ell A_{i\ell}B_{\ell k}\right)C_{kj} = \sum_{k,\ell} A_{i\ell}B_{\ell k}C_{kj}.$$On the other hand, we have $$(A(BC))_{ij} = \sum_\ell A_{i\ell} (BC)_{\ell j} = \sum_{\ell} A_{i\ell}\left(\sum_k B_{\ell k}C_{kj}\right) = \sum_{k,\ell}A_{i\ell}B_{\ell k}C_{kj}.$$The expressions are equal, and so we are done. We are not requiring that the entries of $A$, $B$ and $C$ commute. We are just using the distributive property (to bring all the summations signs out) and associativity between elements. Namely, that $A_{i\ell}(B_{\ell k}C_{kj}) = (A_{i\ell}B_{\ell k})C_{kj}$, and then we add those expressions over $k$ and $\ell$.
$\endgroup$ 6