Skip to content

Matrix Product

Definition

If A\boldsymbol{A} has size m×nm\times n and B\boldsymbol{B} has size n×kn\times k, the matrix product AB\boldsymbol{A}\boldsymbol{B} is the m×km\times k matrix with entries (AB)ij=∑r=1nairbrj\displaystyle (\boldsymbol{A}\boldsymbol{B})_{ij}=\sum_{r=1}^n a_{ir}b_{rj}.


Interpretation

Matrix multiplication combines rows of the left matrix with columns of the right matrix and represents composition of linear maps: (AB)x=A(Bx)(\boldsymbol{A}\boldsymbol{B})\boldsymbol{x}=\boldsymbol{A}(\boldsymbol{B}\boldsymbol{x}). The row-times-column rule is exactly what makes this hold.

A 2 by 3 matrix A times a 3 by 2 matrix B giving a 2 by 2 product, with row 2 of A, column 2 of B and the entry c22 they produce highlighted.

The entry c22=a21b12+a22b22+a23b32c_{22}=a_{21}b_{12}+a_{22}b_{22}+a_{23}b_{32} is obtained by multiplying row 22 of A\boldsymbol{A} by column 22 of B\boldsymbol{B}. Both have three entries, which is why the inner sizes of the 2×32\times3 and 3×23\times2 matrices must agree; the outer sizes give the 2×22\times2 size of the product.

A second reading uses columns. If a1,…,an\boldsymbol{a}_1,\ldots,\boldsymbol{a}_n are the columns of A\boldsymbol{A}, then Ax=x1a1+⋯+xnan\boldsymbol{A}\boldsymbol{x}=x_1\boldsymbol{a}_1+\cdots+x_n\boldsymbol{a}_n is a linear combination of these columns, and column jj of AB\boldsymbol{A}\boldsymbol{B} is A\boldsymbol{A} times column jj of B\boldsymbol{B}. In the second Example, 3(10)+4(21)=(114)3\begin{pmatrix}1\\0\end{pmatrix}+4\begin{pmatrix}2\\1\end{pmatrix}=\begin{pmatrix}11\\4\end{pmatrix}. With this reading, a linear system Ax=b\boldsymbol{A}\boldsymbol{x}=\boldsymbol{b} asks for a combination of the columns of A\boldsymbol{A} that equals b\boldsymbol{b}.

The order of the factors matters. When AB\boldsymbol{A}\boldsymbol{B} is defined, BA\boldsymbol{B}\boldsymbol{A} may not be, and even for square matrices the two usually differ: for A=(0100)\boldsymbol{A}=\begin{pmatrix}0&1\\0&0\end{pmatrix} and B=(0010)\boldsymbol{B}=\begin{pmatrix}0&0\\1&0\end{pmatrix}, AB=(1000)\boldsymbol{A}\boldsymbol{B}=\begin{pmatrix}1&0\\0&0\end{pmatrix} but BA=(0001)\boldsymbol{B}\boldsymbol{A}=\begin{pmatrix}0&0\\0&1\end{pmatrix}. A common slip is to multiply matrices entry by entry, as for matrix addition; that is a different operation.


Key Results

  • The product AB\boldsymbol{A}\boldsymbol{B} is defined only when the number of columns of A\boldsymbol{A} equals the number of rows of B\boldsymbol{B}.
  • Matrix multiplication is associative and distributive, but not generally commutative.

Examples

  • A 2×32\times3 matrix times a 3×43\times4 matrix gives a 2×42\times4 matrix.
  • (1201)(34)=(114)\begin{pmatrix}1&2\\0&1\end{pmatrix}\begin{pmatrix}3\\4\end{pmatrix}=\begin{pmatrix}11\\4\end{pmatrix}.

Prerequisites

Sources

Aliases: matrix multiplication, product of matrices Symbols: sum

Last updated: 20 October 2026 03:02