Definition: Suppose \(A=[a_{ik}]\) and \(B=[b_{kj}]\) are matrices such that the number of columns of A is the same as the number of rows of B; say, A is \(m \times p\) matrix and B is a \(p \times n\) matrix. Then the product AB is the \(m \times n\) matrix whose ij-entry is obtained by multiplying the i-th row of A by the j-th column of B. ie:
\(\begin{bmatrix}
a_{11} & \dots & a_{1p}\\
. & \dots & .\\
a_{i1} & \dots & a_{ip}\\
. & \dots & .\\
a_{m1} & \dots & a_{mp}
\end{bmatrix} \)
\(\begin{bmatrix}
b_{11} & \dots & b_{1j} & \dots & b_{1n}\\
. & \dots & . & \dots & .\\
. & \dots & . & \dots & .\\
b_{p1} & \dots & b_{pj} & \dots & b_{pn}
\end{bmatrix} = \)
\(\begin{bmatrix}
c_{11} & \dots & c_{1n}\\
. & \dots & .\\
. & c_{ij} & .\\
. & \dots & .\\
c_{m1} & \dots & c_{mn}\\
\end{bmatrix}\)
where \(c_{ij}=a_{i1}b_{1j} + a_{i2}b_{2j} + \dots + a_{ip}b_{pj}\).
Few theorems that may facilitate calculations of matrix multiplication:
a) \((AB)C = A(BC)\);
b) \(A(B+C) = AB + AC\);
c) \(k(AB) = (kA)B = A(kB)\)