Matrix Calculator
Add, subtract, multiply, transpose, or find the determinant and inverse of two matrices up to 5×5, with clear errors when an operation doesn't fit.
Matrix A
Matrix B
Operation
About this tool
What this tool does
A full matrix calculator for two matrices at once, A and B, from 1×1 up to 5×5. It handles addition, subtraction, both multiplication orders (A×B and B×A), transpose, scalar multiplication, determinant, and inverse — the core operations covered in a typical linear algebra course, all in one place instead of scattered across separate single-purpose calculators.
How to use it
Pick the size for Matrix A and Matrix B independently using the row/column dropdowns, then fill in the numbers (or hit "Random" to quickly generate test values). Click any operation button and the result appears below — as a formatted matrix, or as a single number for determinant. If an operation isn't valid for the sizes you've entered (like multiplying two matrices with mismatched inner dimensions, or asking for the determinant of a non-square matrix), you'll get a clear explanation of why instead of a silent wrong answer.
Common use cases
- Checking linear algebra homework — matrix multiplication and inverses are notoriously easy to slip up on by hand
- Verifying a system of linear equations solved via matrix inversion
- Quick sanity checks while implementing matrix math in code (transforms, graphics, machine learning)
- Teaching how determinant and inverse relate — a singular (determinant-zero) matrix has no inverse, and this tool tells you exactly that instead of erroring silently
Frequently asked questions
Why can't I multiply two matrices I've entered?
Matrix multiplication requires the number of columns in the first matrix to match the number of rows in the second. If A is 2×3 and B is 3×2, A×B works and produces a 2×2 result, but B×A wouldn't unless the dimensions happen to line up the other way too.
What does it mean for a matrix to have no inverse?
A square matrix has no inverse exactly when its determinant is zero — this is called a singular matrix. It means the matrix "collapses" dimensions rather than transforming them reversibly, so there's no way to undo it.
How large a matrix can I use?
Up to 5×5 for every operation. Determinant and inverse are computed correctly at any of those sizes using cofactor expansion and Gauss-Jordan elimination, not a shortcut formula that only works for 2×2 or 3×3.
What's the difference between A×B and B×A?
Matrix multiplication is not commutative — unlike regular numbers, A×B and B×A usually give different results, and one of them might not even be defined if the dimensions don't match in that order. That's why both buttons exist separately.
Can I multiply a matrix by a plain number?
Yes — that's scalar multiplication. Enter your number in the "k" field and click "k × A" (or "k × B") to multiply every entry in the matrix by that value.
