Inverse matrix calculator
Type a square matrix, one row per line, and get its inverse A⁻¹ as exact fractions or as decimals, together with the determinant.
One row per line, numbers separated by spaces. Fractions such as 1/2 are allowed.
Fill in the fields; the answer appears here straight away.
How it's worked out
How it works
-
Enter the values
Type the numbers or the formula. Decimals may use a point or a comma. No idea? Click Fill in an example.
-
Instant answer
The answer appears as you type, with the most important intermediate values.
-
See the working
Under "How it's worked out" you see the steps, handy for checking your own calculation.
How it works
The matrix is extended with the identity matrix and reduced with row operations (Gauss-Jordan) until the left half is the identity. The right half is then A⁻¹. As a check, A × A⁻¹ gives the identity matrix.
For a 2×2 matrix [[a, b], [c, d]] there is a shortcut: A⁻¹ = 1/(ad − bc) · [[d, −b], [−c, a]].
No inverse?
A matrix with determinant 0 has no inverse, because its rows are dependent. You get a message instead of a result. Fractions stay exact by default; switch to decimals if you prefer. For just the determinant, use the determinant calculator.
Worked examples
- The default: [[2, 1], [5, 3]] has determinant 2 × 3 − 1 × 5 = 1, so its inverse is [[3, −1], [−5, 2]].
- With a fraction: [[4, 7], [2, 6]] has determinant 24 − 14 = 10. The inverse is (1/10) × [[6, −7], [−2, 4]].
- No inverse: [[1, 2], [2, 4]] has determinant 4 − 4 = 0, because the second row is twice the first.
Solving Ax = b
For 2x + y = 5 and 5x + 3y = 13, the matrix is A = [[2, 1], [5, 3]]. Its inverse times b = (5, 13) gives x = 3 × 5 − 1 × 13 = 2 and y = −5 × 5 + 2 × 13 = 1. For larger systems typed as equations, the system of equations solver does the same without a matrix.
The determinant at work
The inverse of a 2×2 matrix is 1/det times the matrix with its diagonal swapped and the other entries negated. The smaller the determinant, the larger the entries of the inverse. See the determinant calculator for how it is calculated, and the eigenvalue calculator for what a matrix does to a vector.
Frequently asked questions
When does a matrix have an inverse?
When it is square and its determinant is not zero. A matrix with determinant 0 is called singular, and the calculator reports that no inverse exists.
Why show fractions instead of decimals?
Fractions are exact. The inverse of [[4, 7], [2, 6]] has entries 3/5, −7/10, −1/5 and 2/5, which are 0.6, −0.7, −0.2 and 0.4 as decimals. You can switch to decimals above the field when you prefer them.
What is an inverse used for?
To undo a transformation and to solve systems of equations: if Ax = b, then x = A⁻¹b. In graphics it reverses a rotation or scaling.
How can I check the result?
Multiply A by A⁻¹. The product must be the identity matrix, with ones on the diagonal and zeros elsewhere.