Matrix multiplication calculator with every entry worked out
To multiply two matrices, each entry of the answer is a row of the first matrix times a column of the second: multiply the matching entries and add them up. This only works when the first matrix has as many columns as the second has rows. Our matrix multiplication calculator, part of the Matrix Calculator, multiplies matrices up to 5 by 5 exactly and writes out the sum for each entry.
Matrix Calculator
Multiply, invert and find determinants and eigenvalues
How to multiply matrices in the calculator
- Open the Matrix Calculator. It starts on Eigenvalues, so choose the A × B chip at the top of the Matrices section.
- Set the rows and columns of A, then type its entries. Fractions and decimals work.
- Set the rows and columns of B. Its rows must match A's columns.
- Read the product at the top. The working below shows each entry as a row of A times a column of B, then puts them together.
- Or press Multiply in the Examples section to load a ready-made 2 by 2 product.
The working lists up to nine entries in full, which covers every entry of a 3 by 3 product. If the sizes don't fit, the calculator says so and gives both sizes. For a matrix times itself, the Power chip works out A², A³ and so on. Random problem in the Practice section asks for single entries of a product.
How to multiply matrices: row times column
The entry in row i, column j of AB comes from row i of A and column j of B. Pair up their entries, first with first, second with second, multiply each pair, and add:
This is the dot product of a row and a column, so the row and the column need the same number of entries. That is where the size rule comes from.
The size rule
Write the sizes side by side, rows by columns. The inside numbers must match, and the outside numbers give the size of the answer: an m by n matrix times an n by p matrix is an m by p matrix.
| A | B | A × B |
|---|---|---|
| 2 by 2 | 2 by 2 | 2 by 2 |
| 2 by 3 | 3 by 2 | 2 by 2 |
| 3 by 2 | 2 by 3 | 3 by 3 |
| 3 by 3 | 3 by 1 (a column vector) | 3 by 1 |
| 1 by 3 | 3 by 1 | 1 by 1, a single number |
| 2 by 3 | 2 by 3 | Not possible: 3 ≠ 2 |
Worked examples you can check in the calculator
Example 1: 2 by 2 matrix multiplication
Multiply A = [1, 2; 3, 4] by B = [5, 6; 7, 8], writing each matrix row by row with a semicolon between rows. This is the calculator's Multiply example.
| Entry | Row of A × column of B | Value |
|---|---|---|
| Row 1, column 1 | 1 × 5 + 2 × 7 | 19 |
| 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 |
Now swap the order. B × A = [23, 34; 31, 46], a different answer. Matrix multiplication is not commutative: AB and BA are usually different, so always multiply in the order the question gives.
Example 2: 3 by 3 matrix times a vector
Set A to 3 by 3 and B to 3 by 1. Multiply A = [1, 0, 2; −1, 3, 1; 2, 1, 0] by the column vector (3, 1, 2):
- Row 1: 1 × 3 + 0 × 1 + 2 × 2 = 7
- Row 2: (−1) × 3 + 3 × 1 + 1 × 2 = 2
- Row 3: 2 × 3 + 1 × 1 + 0 × 2 = 7
The answer is the column vector (7, 2, 7). A 3 by 3 times a 3 by 1 gives a 3 by 1. This is how a matrix transforms a point or solves a system of equations written as Ax = b.
Example 3: a row times a column, and a column times a row
A 1 by 3 row times a 3 by 1 column gives a single number: [1, 2, 3] times the column (4, 5, 6) is 1 × 4 + 2 × 5 + 3 × 6 = 32. Swap the order and the answer is a 3 by 3 matrix, because every entry of the column multiplies every entry of the row:
| 4 | 8 | 12 |
| 5 | 10 | 15 |
| 6 | 12 | 18 |
The same two matrices, multiplied in the two orders, give a 1 by 1 and a 3 by 3. It is the clearest example of why order matters.
Example 4: squaring a matrix
A² means A × A, not squaring each entry. For A = [3, −2; 1, 4]:
Squaring each entry would give [9, 4; 1, 16], which is wrong. Only square matrices can be squared, because the size rule needs columns to match rows.
Try one
Matrix multiplication rules
| Rule | In symbols | True? |
|---|---|---|
| Order matters | AB = BA | Usually not |
| Grouping doesn't matter | (AB)C = A(BC) | Always |
| Brackets multiply out | A(B + C) = AB + AC | Always |
| The identity changes nothing | AI = IA = A | Always |
| Transpose of a product | (AB)ᵀ = BᵀAᵀ | Always, note the order flips |
| Zero product | AB = 0 means A = 0 or B = 0 | Not always |
The identity matrix I has 1s down the main diagonal and 0s elsewhere. Multiplying [3, 1; 2, 5] by the 2 by 2 identity gives [3, 1; 2, 5] back. The last row of the table is a surprise: two matrices that aren't zero can multiply to give the zero matrix, so you can't cancel matrices the way you cancel numbers.
Common mistakes
- Multiplying matching entries. That is not matrix multiplication. Each entry is a whole row times a whole column.
- Using a column of A or a row of B. It is always rows of the first matrix and columns of the second.
- Swapping the order. AB and BA are different, and one of them may not even exist.
- Getting the answer's size wrong. It has the first matrix's rows and the second matrix's columns.
- Sign slips with negatives. Put negative entries in brackets as you write the products, as the calculator does.
Common questions
Can you multiply a 2 by 3 matrix by a 3 by 2 matrix?
Why isn't matrix multiplication commutative?
How do you multiply a matrix by a number?
How do you multiply three matrices?
What size matrices can the calculator multiply?
Revision cards
Read the front, say your answer, then flip to check.
Where to go next
- Solve it
Matrix Calculator
Multiply, invert and find determinants and eigenvalues
Open the tool - Test it
College Linear Algebra
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper