CCalclabhub

Linear Algebra

How To Calculate The Inverse Of A Matrix

The inverse of a matrix is the matrix that undoes it, and for the two-by-two case the recipe is shorter than the explanation.

Quick Answer

A inverse = (1 / (ad - bc)) x [ d, -b; -c, a ]

det
Determinant
a, b, c, d
Matrix entries
A inverse
Inverse matrix

Compute the determinant ad minus bc. If it is not zero, swap the two diagonal entries, negate the two off-diagonal entries and divide everything by the determinant.

What Is The Inverse Of A Matrix?

The inverse of a matrix is the matrix that multiplies with it to give the identity, the two-by-two matrix with ones on the diagonal and zeroes elsewhere. It is the matrix equivalent of a reciprocal: numbers have an inverse, matrices have an inverse, and it plays the same role of undoing a multiplication. For the number seven the inverse is one seventh because seven times one seventh is one; for a matrix the inverse satisfies the same relationship with matrix multiplication.

The determinant is the gatekeeper. For a matrix with entries a, b, c, d the determinant is ad minus bc, and if that comes out zero no inverse exists. Such a matrix is called singular, and it squashes the plane onto a line or a point so that no operation can restore the lost information. Checking the determinant before anything else saves you from writing down an inverse full of meaningless infinities.

The recipe for a two-by-two inverse is easy to remember as three moves. First swap the entries on the main diagonal, so a and d trade places. Second negate the two off-diagonal entries, so b and c become minus b and minus c. Third divide all four results by the determinant. The words swap, negate, divide describe the entire procedure, and no one needs to memorise a formula to do it correctly.

The determinant's size also tells you how much the matrix stretches space. A determinant of 10 means the transformation multiplies areas by 10, and correspondingly the inverse divides them by 10. A determinant of 0.5 shrinks areas and the inverse doubles them. A determinant that is negative flips orientation as well, which is why the inverse of a reflection is the reflection itself.

Square matrices larger than two by two are genuinely more work, and the usual paths are cofactor expansion, Gauss-Jordan elimination on the matrix augmented with the identity, or simply handing the problem to a computer. The two-by-two case is the one worth doing by hand, both because it appears often enough in textbook problems and because the small case makes the structure of the general method visible.

One practical note for reading the output: the inverse entries are usually not whole numbers, and that is entirely normal. An inverse is only guaranteed to be a neat fraction when the determinant divides the entries cleanly, which is why textbook examples are chosen so carefully and real-world matrices are not.

It is worth knowing why the recipe looks the way it does. The identity condition gives four equations in four unknowns, and solving them by elimination produces exactly the swapped and negated pattern you see in the formula. Nothing about the shortcut is arbitrary; it is the compressed result of a straightforward algebraic solve.

Matrices with a determinant of exactly one are called unimodular, and their inverses contain only integers. They show up constantly in crystallography and integer programming precisely because the transformation maps a lattice back onto itself without introducing fractions. If your matrix happens to have a determinant of one, the division step does nothing and the inverse is the swapped and negated matrix as written.

Formula

det(A) = a x d - b x c

The difference of the diagonal product and the off-diagonal product.

SymbolMeaning
det(A)Determinant
a, dDiagonal entries
b, cOff-diagonal entries

A inverse = (1 / det(A)) x [ d, -b; -c, a ]

Swap the diagonal, negate the off-diagonal, divide by the determinant.

SymbolMeaning
A inverseInverse matrix
det(A)Determinant
a, b, c, dEntries of A

A x A inverse = I, the identity matrix

Multiply the original matrix by the claimed inverse; the answer must be the identity.

SymbolMeaning
AOriginal matrix
A inverseClaimed inverse
IIdentity matrix

How To Calculate The Inverse Of A Matrix

  1. 1

    Write the matrix in a, b, c, d order

    Label the four entries as a top-left, b top-right, c bottom-left, d bottom-right. Every later step refers to these letters.

  2. 2

    Compute the determinant

    Multiply a by d, multiply b by c, and subtract the second from the first. If the result is zero, stop because the matrix has no inverse.

  3. 3

    Swap and negate

    The new top-left is d, the new bottom-right is a, the new top-right is minus b and the new bottom-left is minus c.

  4. 4

    Divide by the determinant and verify

    Divide each of the four entries by the determinant, then multiply the original matrix by your answer to confirm you get the identity.

Examples

Example 1: A clean textbook case

a (top-left)
4
b (top-right)
7
c (bottom-left)
2
d (bottom-right)
6
StepCalculationResult
Determinantdet = a x d - b x c4 x 6 - 7 x 2
Determinant valuedet10
Swap and negateswap and negate[6, -7; -2, 4]
Inversedivide by det[0.6, -0.7; -0.2, 0.4]

Result: The determinant is 10 and the inverse is 0.6 and minus 0.7 in the top row, minus 0.2 and 0.4 in the bottom row.

Example 2: A determinant of one

a (top-left)
5
b (top-right)
2
c (bottom-left)
7
d (bottom-right)
3
StepCalculationResult
Determinantdet = 5 x 3 - 2 x 71
Swap and negateswap and negate[3, -2; -7, 5]
Inverseinverse[3, -2; -7, 5]

Result: Because the determinant is 1, the inverse is simply the swapped and negated matrix 3 and minus 2 over minus 7 and 5, with no division needed.

Example 3: A matrix with no inverse

a (top-left)
2
b (top-right)
4
c (bottom-left)
3
d (bottom-right)
6
StepCalculationResult
Determinantdet = 2 x 6 - 4 x 30
Inverseinversedoes not exist

Result: The determinant is 0, so this matrix is singular and has no inverse at all.

Calculator

Determinant

10

Inverse top-left
0.6
Inverse top-right
-0.7
Inverse bottom-left
-0.2
Inverse bottom-right
0.4

Values update as you type. This calculator covers the single scenario its formula assumes — see Common Mistakes for what it leaves out.

Prefer a full-width tool? Open the The Inverse Of A Matrix calculator page.

Common Mistakes

  • Forgetting to check the determinant first

    If ad minus bc is zero the matrix is singular and no inverse exists. Computing one anyway produces a division by zero and a meaningless answer.

  • Negating the diagonal instead of the off-diagonal

    The swap applies to the diagonal and the negation applies to the off-diagonal. Doing both to the same pair is the single most common mix-up.

  • Dividing only some entries by the determinant

    Every one of the four entries is divided by the same number. Forgetting the division on one entry breaks the identity check immediately.

  • Confusing the determinant formula

    The determinant is ad minus bc, not ad plus bc and not ab minus cd. The two products must be one diagonal and one off-diagonal pair.

  • Skipping the verification

    Multiply the original matrix by your answer and confirm you get the identity. It takes one line and catches sign errors that are invisible when reading the result.

  • Using the two-by-two recipe on a larger matrix

    The swap-negate-divide shortcut is specific to two-by-two matrices. Larger ones need cofactor expansion or Gauss-Jordan elimination.

FAQ

How do you find the inverse of a 2 by 2 matrix?

Compute ad minus bc, then build a matrix with d and minus b on top and minus c and a underneath, and divide every entry by the determinant.

When does a matrix have no inverse?

Exactly when its determinant is zero. Such a matrix is called singular, and it maps the plane onto something of lower dimension.

What does it mean that a matrix is invertible?

It means the transformation the matrix represents can be undone, so the mapping is one-to-one and no information is lost.

Is the inverse of a matrix its transpose?

No. The transpose flips the matrix across its diagonal and satisfies a different relationship. Only for special matrices called orthogonal matrices do the two coincide.

How do you check that an inverse is correct?

Multiply the original matrix by the inverse. If the result is the identity matrix, with ones on the diagonal and zeroes elsewhere, the inverse is right.

Can a determinant be negative?

Yes. A negative determinant means the transformation reverses orientation, flipping the shape over as well as scaling it.

References

  1. [1]Wikipedia, Invertible matrix — https://en.wikipedia.org/wiki/Invertible_matrix
  2. [2]Wikipedia, Determinant of a matrix — https://en.wikipedia.org/wiki/Determinant
  3. [3]Khan Academy, Introduction to matrices — https://www.khanacademy.org/math/linear-algebra