Uni-Sine
MathematicsAlgebra

Inverse matrix calculator with steps

The inverse of a square matrix A is the matrix A⁻¹ that multiplies with it to give the identity: AA⁻¹ = A⁻¹A = I. It exists only when the determinant of A is not 0. Our inverse matrix calculator, part of the Matrix Calculator, finds the inverse of any invertible matrix up to 5 by 5 with exact fractions, using the 2 by 2 formula or Gauss-Jordan elimination, and shows each step.

Try it

Matrix Calculator

Multiply, invert and find determinants and eigenvalues

Go to its page

How to find an inverse in the calculator

  1. Open the Matrix Calculator and choose the Inverse chip at the top of the Matrices section.
  2. Set the size of A. Only square matrices have inverses, so there is one size button, from 1 to 5.
  3. Type the entries. Fractions (type a slash) and decimals work.
  4. Read A⁻¹ at the top, with the determinant beside it. The answer stays exact, so you will often see fractions.
  5. Follow the working: for a 2 by 2, the formula; for 3 by 3 and bigger, A set beside the identity matrix and every row operation that turns A into I.
  6. To see a 3 by 3 straight away, press Inverse in the Examples section.

If the determinant is 0, the calculator tells you the matrix has no inverse instead of giving an answer.

Inverse of a 2x2 matrix

For a 2 by 2 matrix there is a formula. Swap the two entries on the main diagonal, change the signs of the other two, and divide everything by the determinant ad − bc:

\left[a,\ b;\ c,\ d\right]^{-1} = \frac{1}{ad - bc}\left[d,\ -b;\ -c,\ a\right]Rows are separated by semicolons

Example 1: a 2 by 2 inverse

Find the inverse of A = [4, 7; 1, 2], writing each matrix row by row. The determinant is 4 × 2 − 7 × 1 = 1, so dividing by it changes nothing:

A^{-1} = \left[2,\ -7;\ -1,\ 4\right]

Check by multiplying: A × A⁻¹ has top left entry 4 × 2 + 7 × (−1) = 1, and the other entries come out as 0, 0 and 1. That is the identity, so the inverse is right.

Example 2: an inverse with fractions

For A = [4, 3; 6, 2], the determinant is 4 × 2 − 3 × 6 = −10. Swap, change signs, and divide by −10:

A^{-1} = -\frac{1}{10}\left[2,\ -3;\ -6,\ 4\right]
−1/53/10
3/5−2/5

The calculator gives these fractions exactly. Decimals would be −0.2, 0.3, 0.6 and −0.4.

Inverse of a 3x3 matrix by Gauss-Jordan elimination

For 3 by 3 and bigger, write A and the identity side by side as [A | I]. Use row operations to turn the left half into I. Whatever you do to the left, do to the right as well, and when the left is I, the right is A⁻¹. Three row operations are allowed: swap two rows, multiply a row by a number that isn't 0, and add a multiple of one row to another.

Example 3: a 3 by 3 inverse

Find the inverse of A = [1, 2, 1; 0, 1, 1; 1, 3, 3]. Its determinant is 1, so it has an inverse. Each row below shows the left half | the right half.

StepRow 1Row 2Row 3
Start: [A | I]1, 2, 1 | 1, 0, 00, 1, 1 | 0, 1, 01, 3, 3 | 0, 0, 1
R3 − R11, 2, 1 | 1, 0, 00, 1, 1 | 0, 1, 00, 1, 2 | −1, 0, 1
R1 − 2R21, 0, −1 | 1, −2, 00, 1, 1 | 0, 1, 00, 1, 2 | −1, 0, 1
R3 − R21, 0, −1 | 1, −2, 00, 1, 1 | 0, 1, 00, 0, 1 | −1, −1, 1
R1 + R31, 0, 0 | 0, −3, 10, 1, 1 | 0, 1, 00, 0, 1 | −1, −1, 1
R2 − R31, 0, 0 | 0, −3, 10, 1, 0 | 1, 2, −10, 0, 1 | −1, −1, 1

The left half is now the identity, so the right half is the inverse: A⁻¹ = [0, −3, 1; 1, 2, −1; −1, −1, 1]. The calculator may choose its row operations in a different order, but the inverse is always the same, because a matrix has only one inverse.

For a second check, load the Inverse example in the calculator: A = [2, 1, 1; 1, 3, 2; 1, 0, 0] has determinant −1 and inverse [0, 0, 1; −2, 1, 3; 3, −1, −5].

Example 4: a matrix with no inverse

A = [2, 4; 3, 6] has determinant 2 × 6 − 4 × 3 = 0, so it has no inverse. It is called singular. Its second row is 1.5 times its first, so the rows point the same way and the matrix squashes the plane onto a line, which can't be undone. In Gauss-Jordan elimination, a singular matrix shows up as a row of zeros on the left.

Try one

practice
Pick an answer, then check it.
What is the inverse of [5, 2; 2, 1]?

Using an inverse to solve equations

Simultaneous equations can be written as Ax = b, where A holds the coefficients. Multiply both sides by A⁻¹ on the left and x = A⁻¹b. For 4x + 7y = 15 and x + 2y = 4, A = [4, 7; 1, 2], whose inverse is example 1's answer:

\binom{x}{y} = \left[2,\ -7;\ -1,\ 4\right]\binom{15}{4} = \binom{30 - 28}{-15 + 16} = \binom{2}{1}

So x = 2 and y = 1. In the calculator, find A⁻¹ first, then use A × B with the column of right-hand sides as B.

Common mistakes

  • Swapping the wrong entries. In the 2 by 2 formula, a and d swap places, and b and c only change sign.
  • Forgetting to divide by the determinant, or dividing by its size and losing a minus sign.
  • Taking 1 over each entry. That is not the inverse.
  • Doing a row operation to only half of [A | I]. Every operation applies to the whole row.
  • Not checking the determinant first. If it is 0, stop: there is no inverse.
  • Multiplying on the wrong side when solving. x = A⁻¹b, not bA⁻¹.

Common questions

How do I know if a matrix has an inverse?
Work out its determinant. If it isn't 0, the matrix is invertible. If it is 0, the matrix is singular and has no inverse. The calculator gives the determinant alongside the inverse.
Can a non-square matrix have an inverse?
No. Only square matrices have an inverse in the usual sense, which is why the calculator keeps the rows and columns equal when you choose Inverse.
How do I check my inverse?
Multiply it by the original matrix. If you get the identity, 1s down the diagonal and 0s elsewhere, it is right. In the calculator, use A × B with your answer as B.
What is the inverse of a product?
(AB)⁻¹ = B⁻¹A⁻¹. The order flips, like taking off socks and shoes in the reverse of the order you put them on.
Why does the calculator give fractions?
Because dividing by the determinant usually leaves fractions, and the calculator keeps answers exact rather than rounding them.

Revision cards

Read the front, say your answer, then flip to check.

Where to go next

  • Solve it

    Matrix Calculator

    Multiply, invert and find determinants and eigenvalues

    Open the tool
  • Test it

    College Linear Algebra

    A new exam-style paper every day, with instant marking and a mark scheme

    Start today's paper
Read next
Maths · AlgebraMatrix calculator: multiply, inverse, determinant, RREFAdd, multiply, invert and row reduce matrices up to 5 by 5 with exact fractions, plus determinants, eigenvalues and worked examples to check.