Multiplication of two matrices is defined only if the number of columns of the left matrix is the same as the number of rows of the right matrix.

If A is an m-by-n matrix and B is an n-by-p matrix, then their matrix product AB is the m-by-p matrix whose entries are given by dot product of the corresponding row of A and the corresponding column of B: