Prove that Matrix Multiplication is Associative.

65 Views Asked by At

Q: In this exercise we show that matrix multiplication is associative. Suppose that $A$ is an $m*p$ matrix, $B$ is a $p*k$ matrix, and $C$ is a $k*n$ matrix. Show that $A(BC)=(AB)C$.

My solution: . $AB:m*k$ (There are p elements) and $[AB]_{i,j}=\sum_{m=1}^pa_{im}b_{mj}$.

$(AB)C:m*n$ (There are k elements)

$[(AB)C]_{i,j}=ab_{i1}c_{1j}+ab_{i2}c_{2j}+...+ab_{ik}c_{kj}$

$[(AB)C]_{i,j}=\sum_{n=1}^{k}ab_{in}c_{nj}$

$ab_{i1}=[AB]_{i,1}=\sum_{m=1}^pa_{im}b_{m1}$

$ab_{i2}=[AB]_{i,2}=\sum_{m=1}^pa_{im}b_{m2}$

...

$ab_{ik}=[AB]_{i,k}=\sum_{m=1}^pa_{im}b_{mk}$

Hence, $[(AB)C]_{i,j}=(\sum_{m=1}^pa_{im}b_{m1})c_{1j}+(\sum_{m=1}^pa_{im}b_{m2})c_{2j}+...+(\sum_{m=1}^pa_{im}b_{mk})c_{kj}$

We can abbreviate this long formula as:

$[(AB)C]_{i,j}=\sum_{n=1}^k(\sum_{m=1}^pa_{im}b_{mn})c_{nj} $

$[(AB)C]_{i,j}=\sum_{n=1}^k\sum_{m=1}^pa_{im}b_{mn}c_{nj} $

Now, let's look at $A(BC).$

$A(BC):m*n$ (ther are p elements)

$[A(BC)]_{i,j}=a_{i1}bc_{1j}+a_{i2}bc_{2j}+...+a_{ip}bc_{pj}$

$[A(BC)]_{i,j}=\sum_{m=1}^pa_{im}bc_{mj}$

$[BC]_{i,j}=\sum_{n=1}^kb_{in}c_{nj}$

We get

$[A(BC)]_{i,j}=\sum_{m=1}^{p}a_{im}\sum_{n=1}^{k}b_{mn}c_{nj} $

$[A(BC)]_{i,j}=\sum_{m=1}^{p}\sum_{n=1}^{k}a_{im}b_{mn}c_{nj} $

Since the sum is finite, we can change the order of summation.

Hence, $A(BC)=(AB)C$

Is my explanation correct? I am not sure about the logic behind the change of the position of summations. I will be thankful if someone can explain it.