Matrices
How to Multiply two matrices
Use this to find the product of two matrices, a common first step before finding an inverse.
Before you start
- Knowing the order of a matrix (rows × columns)
- Multiplying and adding numbers, including negatives
- Keeping track of row and column positions
When to use it
Use this to find the product of two matrices, a common first step before finding an inverse.
The steps
- Check the multiplication is allowed: the columns of the first matrix must equal the rows of the second.
- Take the first row of the left matrix and the first column of the right matrix.
- Multiply matching entries and add them to get one number of the answer.
- Repeat for every row–column pair, keeping their positions.
- Write the results in the correct positions of the product matrix.
Worked example
Given A = (1 2; 3 4) and B = (5 6; 7 8), find the product AB.
- A has 2 columns and B has 2 rows; they match, so AB exists and is a 2×2 matrix.
- Take row 1 of A, (1, 2), and column 1 of B, (5, 7).
- Multiply matching entries and add: 1×5 + 2×7 = 5 + 14 = 19, which goes in position (row 1, column 1).
- Repeat: row 1 × column 2 = 1×6 + 2×8 = 22; row 2 × column 1 = 3×5 + 4×7 = 43; row 2 × column 2 = 3×6 + 4×8 = 50.
- Place each number in its position: AB = (19 22; 43 50).
A second example, with a twist
The matrices are not square (2×3 times 3×2) and include negatives, so checking the order and the signs matters. Given A = (1 0 2; −1 3 1) and B = (2 1; 0 4; 3 −1), find AB.
- A has 3 columns and B has 3 rows; they match, so AB exists and is a 2×2 matrix.
- Take row 1 of A, (1, 0, 2), and column 1 of B, (2, 0, 3).
- Multiply matching entries and add: 1×2 + 0×0 + 2×3 = 2 + 0 + 6 = 8, in position (1, 1).
- Repeat for every pair: row 1 × column 2 = 1×1 + 0×4 + 2×(−1) = −1; row 2 × column 1 = (−1)×2 + 3×0 + 1×3 = 1; row 2 × column 2 = (−1)×1 + 3×4 + 1×(−1) = 10.
- Place each number: AB = (8 −1; 1 10).
Formulae you may need
Formula pages
Practise this in a KBAT problem
Frequently asked questions
Is AB the same as BA?
Usually not. Matrix multiplication is not commutative, so AB and BA are generally different, and sometimes only one of them is even allowed.
Always multiply in the order the question gives. Swapping the order can change every entry, or make the multiplication impossible because the sizes no longer match.
When is multiplication not allowed?
Check the sizes: the number of columns in the left matrix must equal the number of rows in the right matrix. If they do not match, the product does not exist.
For example, a 2×3 matrix can multiply a 3×2 matrix, but not another 2×3 matrix.
What size will the answer be?
The product takes its rows from the left matrix and its columns from the right matrix. So a 2×3 times a 3×2 gives a 2×2 answer, and a 2×2 times a 2×2 gives a 2×2 answer.
Write down the expected size first as a check.