By Tim King · Updated
Matrix Calculator
Row by Column Matrix Multiplication, Addition and Transpose up to 8 by 8
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the Matrix Calculator works
This matrix calculator multiplies, adds, subtracts, scales, squares and transposes matrices up to 8 × 8. Type each row on its own line with the numbers separated by spaces or commas; fractions such as 1/2 work too. The result comes back row by row with the working for each entry.
A matrix is a grid of numbers. Adding or subtracting two matrices works entry by entry, so both must be the same size. Multiplying is different: each entry of the result is a row of the first matrix multiplied by a column of the second, term by term, then added up.
How the matrix calculator multiplies
The formula for entry (i, j) of A × B is the sum of A(i, k) × B(k, j) over every k. That only works when A has as many columns as B has rows, and the result takes the rows of A and the columns of B. A 2 × 3 matrix times a 3 × 4 matrix gives a 2 × 4 matrix.
First example. With A = [1 2; 3 4] and B = [5 6; 7 8], the top-left entry of A × B is 1 × 5 + 2 × 7 = 19. The full result is [19 22; 43 50].
Second example. B × A with the same matrices gives [23 34; 31 46], a different answer, because matrix multiplication does not commute. Order always matters.
How many multiplications does a 3 × 3 product take? Nine entries, each a sum of three products, so 27 multiplications and 18 additions.
Which operations work for each pair of matrix sizes
| A | B | A + B | A × B | B × A |
|---|---|---|---|---|
| 2 × 2 | 2 × 2 | 2 × 2 | 2 × 2 | 2 × 2 |
| 3 × 3 | 3 × 3 | 3 × 3 | 3 × 3 | 3 × 3 |
| 2 × 3 | 3 × 2 | Not defined | 2 × 2 | 3 × 3 |
| 3 × 2 | 2 × 3 | Not defined | 3 × 3 | 2 × 2 |
| 2 × 3 | 2 × 3 | 2 × 3 | Not defined | Not defined |
| 1 × 3 | 3 × 1 | Not defined | 1 × 1 | 3 × 3 |
| 3 × 1 | 1 × 3 | Not defined | 3 × 3 | 1 × 1 |
| 2 × 2 | 2 × 1 | Not defined | 2 × 1 | Not defined |
| 3 × 3 | 3 × 1 | Not defined | 3 × 1 | Not defined |
| 4 × 4 | 4 × 4 | 4 × 4 | 4 × 4 | 4 × 4 |
| 2 × 4 | 4 × 3 | Not defined | 2 × 3 | Not defined |
| 4 × 2 | 2 × 4 | Not defined | 4 × 4 | 2 × 2 |
| 1 × 2 | 2 × 2 | Not defined | 1 × 2 | Not defined |
| 2 × 2 | 3 × 3 | Not defined | Not defined | Not defined |
| 3 × 2 | 3 × 2 | 3 × 2 | Not defined | Not defined |
| 2 × 1 | 1 × 2 | Not defined | 2 × 2 | 1 × 1 |
| 1 × 4 | 4 × 1 | Not defined | 1 × 1 | 4 × 4 |
| 3 × 4 | 4 × 2 | Not defined | 3 × 2 | Not defined |
| 4 × 3 | 2 × 4 | Not defined | Not defined | 2 × 3 |
| 5 × 5 | 5 × 5 | 5 × 5 | 5 × 5 | 5 × 5 |
| 2 × 5 | 5 × 2 | Not defined | 2 × 2 | 5 × 5 |
| 1 × 1 | 1 × 1 | 1 × 1 | 1 × 1 | 1 × 1 |
Tips
- Check sizes first. Write the sizes side by side, 2 × 3 and 3 × 2; the inner numbers must match to multiply.
- Transpose swaps rows and columns. A 2 × 3 matrix becomes 3 × 2.
- Squaring needs a square. A² only exists when A has as many rows as columns.
FAQ
How do you multiply two matrices?
Take row 1 of the first matrix and column 1 of the second, multiply matching entries and add them; that is the top-left entry of the answer. Repeat for every row and column pair. The calculator writes out each of these sums so you can follow the method line by line.
Why is A × B not the same as B × A?
Each product pairs different rows with different columns, so the sums come out differently. Often only one order is even defined: a 2 × 3 times a 3 × 3 works, but the reverse does not. Swap the order with the operation menu to compare both results side by side.
When can you add two matrices?
Only when they have exactly the same number of rows and columns. Addition and subtraction work position by position, so every entry in one matrix needs a partner in the other. A 2 × 3 cannot be added to a 3 × 2 even though both hold six numbers.
What does the determinant of the result tell you?
For a square result up to 3 × 3 the calculator also shows its determinant. A determinant of zero means the matrix squashes space flat and has no inverse. The determinant of a product equals the product of the determinants, a handy check on hand-worked answers.
See also: all Algebra and Geometry tools, Arithmetic, Number Theory, Statistics, Trigonometry and Calculus.
Related tools
Determinant And Inverse Matrix Calculator
Determinant and inverse of a square matrix, as exact fractions.
System Of Equations Calculator
Solve simultaneous equations with every elimination step.
Linear Equation Calculator
Solve one-variable linear equations with full working.
Polynomial Root Calculator
Real and complex roots of any polynomial, with factorisation.
Arc Length And Sector Area Calculator
Arc length, sector area, chord and segment from radius and angle.