MatrixCalc

Matrix Calculator

Add, subtract, multiply, transpose, determinant, inverse, rank, trace and power. Up to 50×50.

Matrix A
rows: 3
cols: 3
Matrix B
rows: 3
cols: 3
Operations
Result
Pick an operation to see the result here. Errors will show up in this area.

Tips: adjust sizes (max 50×50). For A×B, cols(A)=rows(B). det/inverse/trace/power require square matrices.

React, Tailwind & shadcn/ui. No external math deps. — English

Matrix multiplication calculator

Multiply two matrices and see the dot product behind every single entry. Handles any compatible sizes up to 50×50, including A×B and B×A.

Fill in matrices A and B above and press A × B. The button is disabled when the sizes do not fit, with a note telling you which dimensions must match. Open the steps to see each entry expanded as a sum of products, which is exactly how you would write it out by hand.

The dimension rule

To multiply an m×n matrix by an n×p matrix, the inner numbers must be equal: columns of A must match rows of B. The result is m×p — the outer numbers. This is why A × B can be perfectly valid while B × A is not even defined.

Worked example

12
34
×
56
78
=
1922
4350

The top-left entry is row 1 of A dotted with column 1 of B: 1·5 + 2·7 = 19. Each of the four entries is its own little dot product, and the calculator prints all four expansions.

Common mistakes

  • Multiplying entry by entry. Matrix multiplication is not a(i,j)·b(i,j). That operation exists — it is called the Hadamard product — but it is not what A × B means.
  • Assuming AB = BA. Matrix multiplication is not commutative. Try both buttons on the same pair and compare.
  • Concluding a factor is zero. A·B = 0 does not mean A or B is zero: matrices have zero divisors.
  • Transposing in place. (A·B)ᵀ = Bᵀ·Aᵀ — the order reverses.

Frequently asked questions

Why is the A × B button greyed out?
The number of columns of A does not equal the number of rows of B, so the product is undefined. Adjust the sizes with the plus and minus controls.
Is AB the same as BA?
Almost never. Often only one of the two is even defined, and when both exist they are usually different matrices.
How do I multiply a matrix by a number?
That is scalar multiplication — use the Scalars tab, where you can type any value of k, including negatives and decimals.
What is the largest size supported?
50×50 for the numeric result. The step-by-step expansion is limited to 8×8, past which it would print thousands of terms.

Want the full explanation? Read the guide: How matrix multiplication works

Other calculators