Matrix Calculator
A matrix is a rectangular table of numbers, and matrix arithmetic is the language of systems of equations, computer graphics and data science. This calculator handles the everyday operations — addition, subtraction, multiplication, transpose, determinant and inverse — for matrices up to 4×4.
Pick an operation, set the size of each matrix, type your numbers into the grids, and the result appears below — with a plain explanation whenever an operation is not possible.
Result
How It Works
Addition and subtraction work entry by entry: (A + B)ᵢⱼ = Aᵢⱼ + Bᵢⱼ, and both matrices must be the same size. Multiplication is different: each entry of A × B is the dot product of a row of A with a column of B, so A must have as many columns as B has rows. The result has the rows of A and the columns of B. Matrix multiplication is not commutative — A × B is usually different from B × A.
The transpose flips a matrix over its diagonal: the rows become columns, so (Aᵀ)ᵢⱼ = Aⱼᵢ. A 2×3 matrix transposes into a 3×2 matrix. The determinant is a single number that summarises a square matrix: for a 2×2 matrix [[a, b], [c, d]] it is ad − bc, and for larger matrices this calculator uses the Bareiss algorithm, an exact integer-preserving form of Gaussian elimination. A determinant of 0 means the matrix is singular — its rows are not independent.
The inverse A⁻¹ is the matrix that undoes A: A × A⁻¹ is the identity matrix. It exists only when A is square and its determinant is not zero. This calculator finds it with Gauss–Jordan elimination — augmenting A with the identity matrix and reducing A to the identity, which turns the identity half into A⁻¹ — with partial pivoting for numerical stability. If the matrix is singular, the calculator says so plainly.
Worked Example
Take A = [[1, 2], [3, 4]] and B = [[5, 6], [7, 8]]. Adding gives A + B = [[6, 8], [10, 12]], and subtracting gives A − B = [[−4, −4], [−4, −4]]. Multiplying A by [[2, 0], [1, 2]] gives [[4, 4], [10, 8]] — check the top-left entry: 1×2 + 2×1 = 4.
The determinant of A is 1×4 − 2×3 = −2. For a 3×3 example, det [[6, 1, 1], [4, −2, 5], [2, 8, 7]] = −306. The inverse of [[4, 7], [2, 6]] is [[0.6, −0.7], [−0.2, 0.4]] — multiply them together and you get the identity matrix [[1, 0], [0, 1]]. The transpose of [[1, 2, 3], [4, 5, 6]] is [[1, 4], [2, 5], [3, 6]].
Assumptions
- Matrices are capped at 4×4. Larger matrices are possible in principle, but 4×4 covers school and most practical use, and keeps the grids usable on a phone.
- The inverse uses Gauss–Jordan elimination with partial pivoting. A matrix is treated as singular when the largest available pivot is smaller than 10⁻¹².
- Results are shown to 4 decimal places, with values within 10⁻⁹ of a whole number shown as whole numbers.
- Empty cells are not treated as zero — every cell must contain a number, so a forgotten entry is caught instead of silently changing the answer.
Sources: No external data is used on this page — every figure is calculated from the numbers you enter. Last reviewed: 15 November 2026.
Built and tested by SumKitTool — see how we check our numbers.
How to Use This Calculator
Choose an operation from the dropdown. For add, subtract and multiply, fill in both grids; for transpose, determinant and inverse, only Matrix A is used. Change a matrix's size with the Rows and Columns dropdowns — values you have already typed are kept wherever they still fit. Results update live as you type. The Reset button restores the 2×2 example matrices.
Tips and Practical Advice
- Check the sizes before multiplying. The number of columns in A must equal the number of rows in B — the most common matrix error.
- Verify an inverse by multiplying. A × A⁻¹ should give the identity matrix (1s on the diagonal, 0s elsewhere) — if it does not, something went wrong.
- A zero determinant means no inverse. If your matrix is singular, check for a duplicated row or a row that is a multiple of another — that is usually the cause.
- Remember that order matters. A × B and B × A are different calculations with different answers — and one of them may not even be defined.
Frequently Asked Questions
What sizes of matrix can this calculator handle?
Matrices up to 4×4. That covers the sizes used in school and most practical problems, and it keeps the grids usable on a phone. Addition and subtraction need both matrices to be the same size; multiplication needs the number of columns in the first matrix to equal the number of rows in the second.
Why does my matrix have no inverse?
A matrix has an inverse only if it is square and its determinant is not zero. If the determinant is 0, the matrix is singular — its rows are not independent — and there is no matrix that undoes it. This calculator checks and tells you plainly instead of showing meaningless numbers.
How is the determinant calculated?
For a 2×2 matrix [[a, b], [c, d]], the determinant is ad − bc. For larger matrices this calculator uses the Bareiss algorithm, an exact integer-preserving form of Gaussian elimination, so results stay accurate even for 3×3 and 4×4 matrices.
What is matrix multiplication used for?
Matrix multiplication combines two tables of numbers into one: each entry of the result is the dot product of a row from the first matrix and a column from the second. It is used to solve systems of equations, rotate and scale graphics, and model networks and transformations in science and engineering.
Last updated: