2.5 Matrix Multiplication

The product of an m × p matrix A and a p × n matrix B is an m × n matrix C where each element cij is the dot product of row i of A and column j of B.

𝐂=𝐀𝐁\mathbf{C=AB} (12)

implies

cij=k=1p(aik+bkj),where1imand1jnc_{ij}=\displaystyle\sum_{k=1}^{p}(a_{ik}+b_{kj}),\operatorname{where}1\leq i% \leq m\operatorname{and}1\leq j\leq n (13)

The product of matrices A and B is undefined unless the number of rows in A is equal to the number of columns in B. In this case, the matrices are conformable for multiplication.

In general, matrix multiplication is not commutative.

𝐀𝐁𝐁𝐀\mathbf{AB\neq BA}

As a consequence, the following terminology is sometimes used. Considering the matrix product

𝐀𝐁\mathbf{AB}

The left multiplicand A is said to premultiply the matrix B. The right multiplicand B is said to postmultiply the matrix A.

Matrix multiplication distributes over matrix addition

𝐀(𝐁+𝐂)=(𝐀𝐁)+(𝐀𝐂)\mathbf{A(B+C)=\left(AB\right)+\left(AC\right)}

and

(𝐁+𝐂)𝐀=(𝐁𝐀)+(𝐂𝐀)\mathbf{(B+C)A=\left(BA\right)+\left(CA\right)}

if A, B, and C are conformable for the indicated operations. With the same caveat, matrix multiplication is associative.

𝐀(𝐁𝐂)=(𝐀𝐁)𝐂\mathbf{A\left(BC\right)=\left(AB\right)C}

The transpose of a matrix product is the product of the factors in reverse order, i.e.

(𝐀𝐁𝐂)𝐓=𝐂𝐓𝐁𝐓𝐀𝐓\mathbf{{\left(ABC\right)}^{T}={C}^{T}{B}^{T}{A}^{T}} (14)

The set of square matrices has a multiplicative identity which is denoted by I. The identity is a diagonal matrix with ones along the diagonal

aij={1wherei=j0whereij{a}_{ij}=\begin{cases}&1\operatorname{where}i=j\\ &0\operatorname{where}i\neq j\end{cases} (15)

The 3 × 3 multiplicative identity is

𝐈=(100010001)\mathbf{I}=\left(\begin{array}[]{ccc}1&0&0\\ 0&1&0\\ 0&0&1\end{array}\right)