PrecalculusMatricesN-VM.C.8

Multiplying Matrices

Each entry is a row times a column.

Not started Jump to practice

Adding matrices works entry by entry, so you might expect multiplying to work the same way. It does not. The useful product combines a row of the first matrix with a column of the second, and it comes from real calculations like totals and costs.

Key idea

If $A$ is $m \times n$ and $B$ is $n \times p$, then $AB$ is $m \times p$, and its entry in row $i$, column $j$ is row $i$ of $A$ times column $j$ of $B$: multiply matching entries and add. The inside sizes must match. In general $AB \ne BA$.

Why it works

Suppose row $1$ of $A$ lists what you buy: $2$ apples and $3$ pears. Column $1$ of $B$ lists the prices at a store: $\$1$ and $\$2$. Your bill there is $2 \cdot 1 + 3 \cdot 2 = 8$: a row times a column. Each other entry of $AB$ is another shopper at another store. The row and the column must have the same length, or the items do not line up. Swapping the order asks a different question, so $BA$ is usually different.
The matrix times the vector $\mathbf{v}$: each entry of $A\mathbf{v}$ is a row of $A$ times $\mathbf{v}$. Edit the entries and drag $\mathbf{v}$.

Worked examples

Worked example: Two by two

Find $AB$ for $A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}$, $B = \begin{bmatrix} 5 & 0 \\ -1 & 2 \end{bmatrix}$.
  1. Row 1, column 1: $1 \cdot 5 + 2 \cdot (-1) = 3$. Row 1, column 2: $1 \cdot 0 + 2 \cdot 2 = 4$.
  2. Row 2, column 1: $3 \cdot 5 + 4 \cdot (-1) = 11$. Row 2, column 2: $3 \cdot 0 + 4 \cdot 2 = 8$.

Answer: $AB = \begin{bmatrix} 3 & 4 \\ 11 & 8 \end{bmatrix}$

Worked example: Different sizes

Find $AB$ for $A = \begin{bmatrix} 1 & 0 & 2 \\ -1 & 3 & 1 \end{bmatrix}$ and $B = \begin{bmatrix} 2 & 1 \\ 0 & -1 \\ 4 & 3 \end{bmatrix}$.
  1. $(2 \times 3)(3 \times 2)$: the inside sizes match, and the product is $2 \times 2$.
  2. Row 1: $(1)(2) + (0)(0) + (2)(4) = 10$ and $$(1)(1) + (0)(-1) + (2)(3) = 7.$$
  3. Row 2: $$(-1)(2) + (3)(0) + (1)(4) = 2$$ and $$(-1)(1) + (3)(-1) + (1)(3) = -1.$$

Answer: $\begin{bmatrix} 10 & 7 \\ 2 & -1 \end{bmatrix}$

Worked example: Order matters

With $A$ and $B$ from the first example, find $BA$.
  1. Row 1 of $B$ times the columns of $A$: $5 \cdot 1 + 0 \cdot 3 = 5$ and $5 \cdot 2 + 0 \cdot 4 = 10$.
  2. Row 2: $-1 \cdot 1 + 2 \cdot 3 = 5$ and $-1 \cdot 2 + 2 \cdot 4 = 6$.

Answer: $BA = \begin{bmatrix} 5 & 10 \\ 5 & 6 \end{bmatrix} \ne AB$

Common mistake

Multiplying matching entries, as if $\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}\begin{bmatrix} 5 & 0 \\ -1 & 2 \end{bmatrix}$ were $\begin{bmatrix} 5 & 0 \\ -3 & 8 \end{bmatrix}$, or assuming $AB = BA$. Check the sizes first (inside numbers equal, outside numbers give the answer's size), then compute every entry as a row times a column.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 2 XP.

Loading practice…

Builds on

Leads to

Sources and further reading

  • OpenStax Precalculus 2e, Section 9.5 Matrices and Matrix Operations
  • Common Core State Standards for Mathematics, N-VM.C.8
@teddyrookbook GitHub