Matrix Multiplication Calculator
This Matrix Multiplication Calculator multiplies two matrices and shows the working 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. Pair each row with each column yourself and compare. For two more free worked examples, check out the Matrix Multiplication Notes.
The worked examples below go through the same pattern from start to finish, so you can compare every step with your own working. For more practice, the notes page goes further with extra worked examples and fuller explanations of the ideas behind each step. Use them together 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
Notes and Practice Mode
Want to understand the method more deeply? The Matrix Multiplication Notes go through the same pattern with extra worked examples and fuller explanations of the ideas behind each step, so you can see why every step works and not just what to do. 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.
The columns of A always match the rows of B. Empty boxes count as 0, and fractions like 1/2 are allowed.
Login and upgrade to Pro to unlock the full step solution.
Example Problems
Click one to load it into the box and solve it.