When does the product AB exist?
The product \(AB\) exists only when the number of columns of \(A\) equals the number of rows of \(B\). The answer has as many rows as \(A\) and as many columns as \(B\).
The two inner numbers must be equal; the two outer numbers give the order of the answer: \(\begin{array}{ccccc}A&&B&=&AB\\ (m\times \color{#1E6FBA}{\mathbf{n}})&&(\color{#1E6FBA}{\mathbf{n}}\times p)&&(m\times p)\end{array}\)
Why: each entry of \(AB\) pairs a row of \(A\) with a column of \(B\), entry by entry. A row of \(A\) has \(n\) entries (one for each column of \(A\)) and a column of \(B\) has \(n\) entries (one for each row of \(B\)), so the entries pair up exactly when the two inner numbers are equal.
| Orders of A and B | Inner numbers | Product AB |
|---|---|---|
| \((2\times\color{#1E6FBA}{\mathbf{3}})(\color{#1E6FBA}{\mathbf{3}}\times1)\) | \(3=3\) | \(2\times1\) |
| \((1\times\color{#1E6FBA}{\mathbf{2}})(\color{#1E6FBA}{\mathbf{2}}\times2)\) | \(2=2\) | \(1\times2\) |
| \((3\times\color{#1E6FBA}{\mathbf{1}})(\color{#1E6FBA}{\mathbf{1}}\times3)\) | \(1=1\) | \(3\times3\) |
| \((2\times\color{#1E6FBA}{\mathbf{2}})(\color{#1E6FBA}{\mathbf{1}}\times2)\) | \(2\ne1\) | not defined |
The row-by-column rule
The entry in row \(i\), column \(j\) of \(AB\) uses row \(i\) of \(A\) and column \(j\) of \(B\): multiply the first entries, the second entries and so on, then add the products.
\(\begin{pmatrix}\color{#1E6FBA}{\mathbf{2}}&\color{#1E6FBA}{\mathbf{1}}&\color{#1E6FBA}{\mathbf{3}}\\ 0&4&-1\end{pmatrix}\begin{pmatrix}1&\color{#1E6FBA}{\mathbf{5}}\\ 2&\color{#1E6FBA}{\mathbf{0}}\\ -1&\color{#1E6FBA}{\mathbf{2}}\end{pmatrix}=\begin{pmatrix}\cdot&\bbox[2px,border:1.5px solid rgb(30 111 186)]{16}\\ \cdot&\cdot\end{pmatrix}\)
Row 1 of the first matrix meets column 2 of the second: \(2(5)+1(0)+3(2)=16\). This is the entry in row 1, column 2 of the answer.
Method
Example
\(A=\begin{pmatrix}2&1&3\\ 0&4&-1\end{pmatrix}\) is \(2\times3\) and \(B=\begin{pmatrix}1&5\\ 2&0\\ -1&2\end{pmatrix}\) is \(3\times2\), so \(AB\) exists and is \(2\times2\).
\(AB=\begin{pmatrix}2(1)+1(2)+3(-1)&2(5)+1(0)+3(2)\\ 0(1)+4(2)+(-1)(-1)&0(5)+4(0)+(-1)(2)\end{pmatrix}=\begin{pmatrix}1&16\\ 9&-2\end{pmatrix}\)
The order of multiplication matters
In general \(AB\ne BA\). Sometimes only one of the two products exists. Here \(BA\) is \((3\times2)(2\times3)\), a \(3\times3\) matrix, so it cannot equal the \(2\times2\) matrix \(AB\).
Even when both products are \(2\times2\), they usually differ: \(\begin{pmatrix}1&2\\ 0&1\end{pmatrix}\begin{pmatrix}1&0\\ 1&1\end{pmatrix}=\begin{pmatrix}3&2\\ 1&1\end{pmatrix}\), but \(\begin{pmatrix}1&0\\ 1&1\end{pmatrix}\begin{pmatrix}1&2\\ 0&1\end{pmatrix}=\begin{pmatrix}1&2\\ 1&3\end{pmatrix}\).
Some pairs do give the same product in either order, for example a square matrix with itself, or with the identity matrix below. Multiply in the order the question writes.
Squares and the identity matrix
For a square matrix, \(A^2\) means \(AA\). It is not found by squaring each entry.
\(\begin{pmatrix}1&2\\ 3&0\end{pmatrix}^2=\begin{pmatrix}1&2\\ 3&0\end{pmatrix}\begin{pmatrix}1&2\\ 3&0\end{pmatrix}=\begin{pmatrix}7&2\\ 3&6\end{pmatrix}\), not \(\begin{pmatrix}1&4\\ 9&0\end{pmatrix}\).
The identity matrix \(I=\begin{pmatrix}1&0\\ 0&1\end{pmatrix}\) has 1s on the leading diagonal and 0s elsewhere. For every \(2\times2\) matrix \(A\), \(AI=IA=A\), just as multiplying a number by 1 leaves it unchanged.
Check
Do not multiply entry by entry. Use a row of the first matrix with a column of the second, never a column of the first. Write the orders first: if the inner numbers differ, write "not possible" and give the reason.
Create a free account to practise similar questions.
Need help? Join our E-Maths tuition for O-Level success.
Learn more