Generic expression for the (i,j) element of matrix ABC It is given that A is a matrix with dimensions m x n, and C is a matrix with dimensions r x s.
In order for the product ABC to be defined, I assumed that matrix B has dimensions n x r.
I am now asked to write an expression for the (i,j) element of ABC in terms of only the elements of matrices A, B, and C. I don't know how to begin. It's not easy for me to wrap my head around the fact that the matrices have unknown dimensions respresented by variables. If they were defined, I could deduce an expression based off of matrix multiplication rules. Any tips on how to proceed?
 A: Let $A$ be a $m$-by-$n$ matrix, $B$ a $n$-by-$p$ matrix, and $C$ a $p$-by-$r$ matrix. I'm sure that you're aware that the entry in the $j$th row and $k$th column of $AB$ is given by
$$(AB)_{j,k} = \sum_{r=1}^n A_{j,r} B_{r,k}.$$
Notice this is the product of the $(j,r)$th entry of $A$ and $(r,k)$th entry of $B$. To represent the $(j,k)$th entry of $(AB)C$, we do so by taking the product of the $(j,r)$th entry of $AB$ and $(r,k)$th entry of $C$. The main difference is that our sum is no longer to $n$, but rather to $p$ (can you tell why)?
We then have the following (in a spoiler):

 $$((AB)C)_{j,k} = \sum_{r=1}^p (AB)_{j,r}C_{r,k} = \sum_{r=1}^p \left( \sum_{s=1}^n A_{j,s} B_{s,r} \right) C_{r,k}. $$

Also, as a quick extra tidbit, technically it's improper to call it quits after the above work. How do you know for instance that $(AB)C=ABC$? What if $A(BC) \neq (AB)C$? Which one then would denote $ABC$?
Lucky for us, they're the same! Of course that takes a proof. Can you see how to rearrange the above sum to also show that $(AB)C=A(BC)$? (That is, matrix multiplication is associative!) Here is that in a spoiler:

 \begin{align*} \sum_{r=1}^p \left( \sum_{s=1}^n A_{j,s} B_{s,r} \right) C_{r,k} &= \sum_{r=1}^p \left( \sum_{s=1}^n A_{j,s} B_{s,r} C_{r,k} \right) \\ &= \sum_{s=1}^n A_{j,s} \left( \sum_{r=1}^p B_{s,r} C_{r,k} \right) \\ &= \sum_{s=1}^nA_{j,s} (BC)_{s,k}\\ & = (A(BC))_{j,k}. \end{align*}

