Let be a general matrix and let denote a general matrix. Denote the matrix product by . Then matrix multiplication is carried out by computing the inner product of every row of with every column of . Let the th row of be denoted by , , and the th column of by , . Then the matrix product is defined as
An matrix can be multiplied on the right by an matrix, where is any positive integer. An matrix can be multiplied on the left by a matrix, where is any positive integer. Thus, the number of columns in the matrix on the left must equal the number of rows in the matrix on the right.
Matrix multiplication is non-commutative, in general. That is, normally even when both products are defined (such as when the matrices are square.)
The transpose of a matrix product is the product of the transposes in reverse order:
The identity matrix is denoted by and is defined as
As a special case, a matrix times a vector produces a new vector which consists of the inner product of every row of with
As a further special case, a row vector on the left may be multiplied by a column vector on the right to form a single inner product: