Matrix Inverse
The inverse of a square matrix A is the matrix A⁻¹ such that A·A⁻¹ is the identity. This calculator checks that the determinant is non-zero, then applies Gauss-Jordan elimination to produce the inverse.
Undoing a transformation
Dividing by a matrix is not an operation. What takes its place is multiplying by an inverse — the matrix that undoes what the original does, returning the identity when the two are multiplied together. Not every square matrix has one, and the ones that do not are not rare edge cases.
This calculator finds the inverse by Gauss-Jordan elimination, after first confirming that the matrix has one at all.
A matrix maps vectors to other vectors, and its inverse maps them back. That is the whole idea, and it explains immediately why some matrices have no inverse: a transformation that sends two different vectors to the same place cannot be reversed, because there is no way to know which one to return to.
The determinant is what detects that collapse, which is why it is computed before any elimination begins. A zero determinant means the transformation flattens space, and the tool reports that rather than beginning a procedure that would break down partway through.
How to use this calculator
- Enter the matrix Commas between entries, semicolons between rows. It must be square: only a square matrix can have an inverse, since anything else changes the dimension it acts on.
- Read the determinant line first It appears before the inverse and decides whether one exists. A value of zero ends the calculation with an explanation rather than a result.
- Read the inverse Returned as a matrix of the same size. Its entries are frequently fractional even when every entry of the original is a whole number.
- Verify by multiplying Multiplying the original by the result should give the identity. That check is available in the matrix multiplication tool and settles any doubt in one step.
How the inverse is computed
The determinant is computed first and tested against a small tolerance rather than against exact zero, since floating-point arithmetic rarely produces a clean zero. If it falls below that threshold the matrix is reported as singular and nothing further is attempted.
Otherwise the matrix is augmented: the identity matrix of the same size is written alongside it, forming a block twice as wide. Every row operation from that point is applied across the full width, so whatever is done to the left half is recorded on the right.
The left half is then reduced to the identity, one column at a time. For each column the row with the largest entry in that position is swapped into place — partial pivoting, which keeps the divisions numerically stable — then scaled so its pivot becomes 1, and multiples of it are subtracted from every other row to clear the rest of the column.
When the left half has become the identity, the right half is the inverse. That is not a coincidence: the sequence of row operations that turns the matrix into the identity is precisely the inverse transformation, and applying it to the identity records it as a matrix.
What each input means
- A Matrix — form field “Matrix (rows separated by ;)”
- The square matrix to invert, entered row by row. Its determinant is checked before any elimination is attempted.
- det A Determinant
- Reported first. Non-zero means an inverse exists; a value at or near zero ends the calculation.
- A⁻¹ Inverse
- The matrix satisfying A·A⁻¹ = I. It is unique when it exists, so there is no ambiguity about which inverse is returned.
Worked examples
Every number below is produced by the same calculation engine the tool above runs. Nothing here is typed by hand, so the walkthrough cannot drift from what you get when you enter the same values yourself.
A 2×2 matrix with a clean inverse
The matrix with rows (4, 7) and (2, 6). Its determinant is 10, comfortably non-zero, so an inverse exists.
Inputs Matrix (rows separated by ;) = 4, 7; 2, 6
- Matrix [[4, 7], [2, 6]]
- Determinant det = 10
- Method Augment with the identity, then Gauss-Jordan eliminate.
- Inverse [[0.6, -0.7], [-0.2, 0.4]]
Result [[0.6, -0.7], [-0.2, 0.4]]
Every entry of the inverse is the corresponding entry of the adjugate divided by 10. That division is why whole-number matrices so often invert to fractional ones — the determinant almost never divides the entries exactly.
Multiplying the original by the result gives the identity, with the off-diagonal entries cancelling exactly. Checking one off-diagonal entry by hand is enough to confirm the whole calculation, since the cancellation there is the least likely to happen by accident.
A 3×3 matrix with a zero in the corner
Rows (2, 1, 1), (1, 3, 2) and (1, 0, 0). The last row has two zeros, which is exactly the situation partial pivoting is designed for.
Inputs Matrix (rows separated by ;) = 2, 1, 1; 1, 3, 2; 1, 0, 0
- Matrix [[2, 1, 1], [1, 3, 2], [1, 0, 0]]
- Determinant det = -1
- Method Augment with the identity, then Gauss-Jordan eliminate.
- Inverse [[0, 0, 1], [-2, 1, 3], [3, -1, -5]]
Result [[0, 0, 1], [-2, 1, 3], [3, -1, -5]]
Elimination reorders the rows as it goes, choosing the largest available entry as each pivot. Without that reordering a small or zero entry in a pivot position would either stall the procedure or divide by something near zero and lose precision.
The determinant is non-zero despite the sparse last row, so the matrix is invertible. Zeros in a matrix say nothing on their own about whether it is singular — only the determinant does.
Reading the result
Why the inverse has fractions
Every entry ends up divided by the determinant, and a determinant rarely divides a whole-number entry cleanly. An inverse with fractional entries is the normal case, and a whole-number inverse means the determinant happened to be 1 or −1.
Singular is a property, not a failure
A matrix with determinant zero has no inverse at all — not one that is hard to compute. Its rows are linearly dependent, so the transformation loses information that nothing can restore.
Nearly singular is its own problem
A determinant very close to zero passes the test but produces an inverse with enormous entries, in which small changes to the input cause large changes to the output. The result is valid arithmetic and unreliable as a model.
When you would use this
Solving a linear system
A system written as a matrix times an unknown vector is solved by multiplying both sides by the inverse. For a single system direct elimination is faster, but the inverse pays off when the same matrix is reused with several different right-hand sides.
Reversing a geometric transformation
Rotations, scalings and shears are matrices, and undoing one means applying its inverse. A transformation that flattens a shape onto a line has determinant zero and no inverse, which matches the intuition that it cannot be undone.
Assumptions and limitations
What this calculator assumes
- The matrix is square, since only a square matrix can have a two-sided inverse.
- Singularity is judged against a small numerical tolerance rather than exact zero.
- Partial pivoting is applied, so rows may be reordered during elimination.
- The inverse, when it exists, is unique.
Where it stops being the right tool
- The intermediate row-reduction steps are not shown, only the method and the final result.
- Entries are displayed as decimals rather than exact fractions, so an entry of one third appears rounded.
- Pseudo-inverses for singular or rectangular matrices are not computed.
- Very ill-conditioned matrices return an inverse without any warning about how sensitive it is.
Common mistakes
Expecting an inverse for a rectangular matrix
Why it happens. Multiplication works between matrices of different shapes, so it seems plausible that inversion might too. A non-square matrix changes the dimension it maps between, and no single matrix undoes that in both directions.
How to avoid it. Check that the row and column counts match before entering. Rectangular matrices need a pseudo-inverse, which is a different construction.
Reading a zero determinant as a computation problem
Why it happens. It stops the calculation where every other input produces a matrix, which reads as a refusal rather than as an answer about the matrix.
How to avoid it. Treat it as the result. The rows are linearly dependent, and no inverse exists to be found by any method.
Multiplying in the wrong order to check
Why it happens. Matrix multiplication is generally not commutative, so the instinct is that the order of the check matters.
How to avoid it. Either order works here — this is one of the cases where the two products agree, both giving the identity. If neither does, the inverse is genuinely wrong.
Learn why this works
Key terms
Frequently asked questions
Which matrices have an inverse?
Square matrices whose determinant is non-zero. A determinant of zero means the rows are linearly dependent and the transformation collapses space, so no matrix can reverse it.
How is the inverse computed?
By Gauss-Jordan elimination. The identity is written alongside the matrix, and row operations reduce the left half to the identity while the same operations are applied to the right half, which becomes the inverse.
Why check the determinant first?
So that a singular matrix produces a clear explanation rather than a breakdown partway through elimination. It is also cheaper than discovering the problem when a pivot column turns out to be unusable.
How can I confirm the answer is right?
Multiply the original matrix by the result. The product should be the identity — ones down the diagonal and zeros everywhere else. Small floating-point residues in the off-diagonal entries are expected and harmless.