Matrix Multiplication Notes
These Matrix Multiplication Notes explain how to multiply two matrices, with the working shown line by line. The columns of the first must match the rows of the second, and the answer takes its shape from the outer two sizes. Each entry comes from one row and one column, multiplied term by term and added. Order matters, as \(AB\) and \(BA\) are often different. Following the same pattern every time makes matrix multiplication easy to check and repeat.
Step-by-step method
- Set up the problem.
- Write the formula.
- Pair each row of A with each column of B.
- Work out each entry.
Formula: Matrix Multiplication Formula
This formula gives each entry of AB. Multiply the entries of row i of A by the matching entries of column j of B, then add the products.
Useful Tips to Remember
The columns of A must match the rows of B, and the answer has the rows of A and the columns of B. Order matters, because \(AB\) is usually not equal to \(BA\). Move along the row of A and down the column of B at the same time. Keep track of signs, since one negative product can change the whole entry.
Required knowledge
- How to multiply numbers, including negatives, covered in the Multiplication of Small Numbers Calculator.
- How to add the products, covered in the Addition of Small Numbers Calculator.
- The same row-times-column idea for vectors, covered in the Dot Product Calculator.
Where Is Matrix Multiplication Used?
Matrix multiplication combines transformations and data in one step, which makes it one of the most used operations in computing. Every 3D game and animation multiplies matrices to rotate, scale and move objects on screen. Neural networks are built from huge matrix multiplications, which is why graphics cards are used for AI. Economists multiply matrices to model how industries supply each other, and in probability, transition matrices are multiplied to predict future states.
- Rotating and moving objects in 3D graphics
- Running neural networks and AI models
- Input-output models in economics
- Markov chains and transition probabilities
- Solving systems of equations with matrices
Matrix Multiplication Practice Problems
Example 1 multiplies two \(2 \times 2\) matrices, and Example 2 multiplies a \(2 \times 3\) matrix by a \(3 \times 2\) matrix, giving a \(2 \times 2\) answer. Examples 3 and 4 give you two more problems of the same kind to try. Pair each row with each column yourself and compare.
The worked examples below go through the same pattern from start to finish, so you can compare every step with your own working. Try each problem on paper first, then open the example and check your working one step at a time, so you can see exactly which step went wrong if your answer does not match. Use them to check your answers and to understand why each step works.
See Example 1 Hide Example 1
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Pair each row of A with each column of B.
- Work out each entry.
Formula
Formula: Matrix Multiplication Formula
This formula gives each entry of AB. Multiply the entries of row i of A by the matching entries of column j of B, then add the products.
Step 1
Step 1 - Set up the problem.
In this problem: Matrix A is \(2 \times 2\) and Matrix B is \(2 \times 2\). The 2 columns of A match the 2 rows of B, so they can be multiplied and the answer is \(2 \times 2\).
Step 2
Step 2 - Write the formula.
In this problem: Each entry of AB comes from one row of A and one column of B. The matching entries are multiplied in pairs and the products are added.
Step 3
Step 3 - Pair each row of A with each column of B.
In this problem: Pairing every row of A with every column of B gives \(AB = \begin{bmatrix} 1 \times 5 + 2 \times 7 & 1 \times 6 + 2 \times 8 \\ 3 \times 5 + 4 \times 7 & 3 \times 6 + 4 \times 8 \end{bmatrix}\). For example, the top left entry uses \(\text{row } 1 = \begin{bmatrix} 1 & 2 \end{bmatrix}\) of A and \(\text{column } 1 = \begin{bmatrix} 5 \\ 7 \end{bmatrix}\) of B.
Step 4
Step 4 - Work out each entry.
In this problem: Working out each entry gives \(1 \times 5 + 2 \times 7 = 5 + 14 = 19\), \(1 \times 6 + 2 \times 8 = 6 + 16 = 22\), \(3 \times 5 + 4 \times 7 = 15 + 28 = 43\) and \(3 \times 6 + 4 \times 8 = 18 + 32 = 50\).
Final Answer
See Example 2 Hide Example 2
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Pair each row of A with each column of B.
- Work out each entry.
Formula
Formula: Matrix Multiplication Formula
This formula gives each entry of AB. Multiply the entries of row i of A by the matching entries of column j of B, then add the products.
Step 1
Step 1 - Set up the problem.
In this problem: Matrix A is \(2 \times 3\) and Matrix B is \(3 \times 2\). The 3 columns of A match the 3 rows of B, so they can be multiplied and the answer is \(2 \times 2\).
Step 2
Step 2 - Write the formula.
In this problem: Each entry of AB comes from one row of A and one column of B. The matching entries are multiplied in pairs and the products are added.
Step 3
Step 3 - Pair each row of A with each column of B.
In this problem: Pairing every row of A with every column of B gives \(AB = \begin{bmatrix} 2 \times 1 + 0 \times 0 + \left(-1\right) \times \left(-2\right) & 2 \times 2 + 0 \times 5 + \left(-1\right) \times 3 \\ 3 \times 1 + 1 \times 0 + 4 \times \left(-2\right) & 3 \times 2 + 1 \times 5 + 4 \times 3 \end{bmatrix}\). For example, the top left entry uses \(\text{row } 1 = \begin{bmatrix} 2 & 0 & -1 \end{bmatrix}\) of A and \(\text{column } 1 = \begin{bmatrix} 1 \\ 0 \\ -2 \end{bmatrix}\) of B.
Step 4
Step 4 - Work out each entry.
In this problem: Working out each entry gives \(2 \times 1 + 0 \times 0 + \left(-1\right) \times \left(-2\right) = 2 + 0 + 2 = 4\), \(2 \times 2 + 0 \times 5 + \left(-1\right) \times 3 = 4 + 0 - 3 = 1\), \(3 \times 1 + 1 \times 0 + 4 \times \left(-2\right) = 3 + 0 - 8 = -5\) and \(3 \times 2 + 1 \times 5 + 4 \times 3 = 6 + 5 + 12 = 23\).
Final Answer
See Example 3 Hide Example 3
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Pair each row of A with each column of B.
- Work out each entry.
Formula
Formula: Matrix Multiplication Formula
This formula gives each entry of AB. Multiply the entries of row i of A by the matching entries of column j of B, then add the products.
Step 1
Step 1 - Set up the problem.
In this problem: Matrix A is \(2 \times 2\) and Matrix B is \(2 \times 2\). The 2 columns of A match the 2 rows of B, so they can be multiplied and the answer is \(2 \times 2\).
Step 2
Step 2 - Write the formula.
In this problem: Each entry of AB comes from one row of A and one column of B. The matching entries are multiplied in pairs and the products are added.
Step 3
Step 3 - Pair each row of A with each column of B.
In this problem: Pairing every row of A with every column of B gives \(AB = \begin{bmatrix} 2 \times 1 + 3 \times 5 & 2 \times 0 + 3 \times 2 \\ 1 \times 1 + 4 \times 5 & 1 \times 0 + 4 \times 2 \end{bmatrix}\). For example, the top left entry uses \(\text{row } 1 = \begin{bmatrix} 2 & 3 \end{bmatrix}\) of A and \(\text{column } 1 = \begin{bmatrix} 1 \\ 5 \end{bmatrix}\) of B.
Step 4
Step 4 - Work out each entry.
In this problem: Working out each entry gives \(2 \times 1 + 3 \times 5 = 2 + 15 = 17\), \(2 \times 0 + 3 \times 2 = 0 + 6 = 6\), \(1 \times 1 + 4 \times 5 = 1 + 20 = 21\) and \(1 \times 0 + 4 \times 2 = 0 + 8 = 8\).
Final Answer
See Example 4 Hide Example 4
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Pair each row of A with each column of B.
- Work out each entry.
Formula
Formula: Matrix Multiplication Formula
This formula gives each entry of AB. Multiply the entries of row i of A by the matching entries of column j of B, then add the products.
Step 1
Step 1 - Set up the problem.
In this problem: Matrix A is \(2 \times 3\) and Matrix B is \(3 \times 2\). The 3 columns of A match the 3 rows of B, so they can be multiplied and the answer is \(2 \times 2\).
Step 2
Step 2 - Write the formula.
In this problem: Each entry of AB comes from one row of A and one column of B. The matching entries are multiplied in pairs and the products are added.
Step 3
Step 3 - Pair each row of A with each column of B.
In this problem: Pairing every row of A with every column of B gives \(AB = \begin{bmatrix} 1 \times 3 + 2 \times 2 + 0 \times 1 & 1 \times 1 + 2 \times 0 + 0 \times 4 \\ \left(-1\right) \times 3 + 3 \times 2 + 2 \times 1 & \left(-1\right) \times 1 + 3 \times 0 + 2 \times 4 \end{bmatrix}\). For example, the top left entry uses \(\text{row } 1 = \begin{bmatrix} 1 & 2 & 0 \end{bmatrix}\) of A and \(\text{column } 1 = \begin{bmatrix} 3 \\ 2 \\ 1 \end{bmatrix}\) of B.
Step 4
Step 4 - Work out each entry.
In this problem: Working out each entry gives \(1 \times 3 + 2 \times 2 + 0 \times 1 = 3 + 4 + 0 = 7\), \(1 \times 1 + 2 \times 0 + 0 \times 4 = 1 + 0 + 0 = 1\), \(\left(-1\right) \times 3 + 3 \times 2 + 2 \times 1 = -3 + 6 + 2 = 5\) and \(\left(-1\right) \times 1 + 3 \times 0 + 2 \times 4 = -1 + 0 + 8 = 7\).
Final Answer
Calculator and Practice Mode
Want to check your own working? The Matrix Multiplication Calculator solves any problem you type in and shows every step, so you can compare it line by line with your answer and find exactly where a mistake crept in. When you are ready to test yourself, Matrix Multiplication Practice gives you a new problem at Easy, Medium or Hard level, checks your answer and shows the full working whenever you get one wrong. Practice Mode for this calculator is available on the Pro plan.