Matrix Multiplication Calculator

Published on: September 21, 2025
Final Answer: Free | Full Steps: Pro

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

  1. Set up the problem.
  2. Write the formula.
  3. Pair each row of A with each column of B.
  4. 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.

\((AB)_{ij} = a_{i1}b_{1j} + a_{i2}b_{2j} + \cdots + a_{in}b_{nj}\)

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

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

\(A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix},\; B = \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix}\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Pair each row of A with each column of B.
  4. 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.

\((AB)_{ij} = a_{i1}b_{1j} + a_{i2}b_{2j} + \cdots + a_{in}b_{nj}\)

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\).

\(A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix},\; B = \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix}\)

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.

\((AB)_{ij} = a_{i1}b_{1j} + a_{i2}b_{2j} + \cdots + a_{in}b_{nj}\)

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.

\(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}\)

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\).

\(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} = \begin{bmatrix} 5 + 14 & 6 + 16 \\ 15 + 28 & 18 + 32 \end{bmatrix} = \begin{bmatrix} 19 & 22 \\ 43 & 50 \end{bmatrix}\)

Final Answer

\(AB = \begin{bmatrix} 19 & 22 \\ 43 & 50 \end{bmatrix}\)
See Example 2 Hide Example 2

Problem

\(A = \begin{bmatrix} 2 & 0 & -1 \\ 3 & 1 & 4 \end{bmatrix},\; B = \begin{bmatrix} 1 & 2 \\ 0 & 5 \\ -2 & 3 \end{bmatrix}\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Pair each row of A with each column of B.
  4. 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.

\((AB)_{ij} = a_{i1}b_{1j} + a_{i2}b_{2j} + \cdots + a_{in}b_{nj}\)

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\).

\(A = \begin{bmatrix} 2 & 0 & -1 \\ 3 & 1 & 4 \end{bmatrix},\; B = \begin{bmatrix} 1 & 2 \\ 0 & 5 \\ -2 & 3 \end{bmatrix}\)

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.

\((AB)_{ij} = a_{i1}b_{1j} + a_{i2}b_{2j} + \cdots + a_{in}b_{nj}\)

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.

\(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}\)

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\).

\(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} = \begin{bmatrix} 2 + 0 + 2 & 4 + 0 - 3 \\ 3 + 0 - 8 & 6 + 5 + 12 \end{bmatrix} = \begin{bmatrix} 4 & 1 \\ -5 & 23 \end{bmatrix}\)

Final Answer

\(AB = \begin{bmatrix} 4 & 1 \\ -5 & 23 \end{bmatrix}\)

Notes and Practice Mode

Size of A
2
×
2
Size of B
2
×
2
Matrix A
×
Matrix B

The columns of A always match the rows of B. Empty boxes count as 0, and fractions like 1/2 are allowed.

Example Problems

Click one to load it into the box and solve it.