Question: Show that $a(XY)=X(aY)$ where $a$ is an element of field and $X$ and $Y$ are $m\times n$ and $n\times p$ matrices.

Answer: 
By using the notation to designate the coefficient of the $i$th row and $j$th column of a matrix $A$: $(A)\_{i,j}$, we have

$$(a(XY))\_{i,j}=a\cdot (XY)\_{i,j}.$$

On the other hand,

\begin{align}
(X(aY))\_{i,j} & =\sum\_{k=1}^{n} (X)\_{i,k} (aY)\_{k,j}
\\ & =\sum\_{k=1}^{n} (X)\_{i,k}\ a\cdot(Y)\_{k,j}
\\ & = a\cdot\sum\_{k=1}^{n} (X)\_{i,k} (Y)\_{k,j} = a\cdot(XY)\_{i,j}.
\end{align}
Matrix multiplication $\pi:(X,Y)\mapsto XY$ is linear in each slot. By definition $X(aY) = \pi(X,aY)$, which by linearity in the second slot equals $a \pi (X,Y) = a (X Y)$. Hence $a(X Y) = X(aY)$.