Let \(\mathbf{A}\) be a matrix of size \(n\times p\) and \(\mathbf{B}\) be a matrix of size \(p\times q\).
The
matrix product \(\mathbf{A}\times \mathbf{B}\) is a matrix \(\mathbf{C}\) of size \(n\times q\) where the entry \(c_{ij}\) is the dot product of the \(i\)-th row of \(\mathbf{A}\) and the \(j\)-th column of \(\mathbf{B}\):$$c_{ij}=\sum_{k=1}^p a_{ik}b_{kj}, \qquad 1 \leqslant i \leqslant n,\; 1 \leqslant j \leqslant q.$$

The product is defined only if the number of columns in \(\mathbf{A}\) is equal to the number of rows in \(\mathbf{B}\). We often omit the symbol \(\times\) and write \(\mathbf{A}\mathbf{B}\) for \(\mathbf{A}\times \mathbf{B}\).