How to Find the Inverse of a Matrix
The 2 × 2 shortcut, the 3 × 3 adjugate method, the determinant test, and how to check the answer.
The inverse of a matrix is the matrix that undoes it: multiply a matrix by its inverse, in either order, and you get the identity matrix, the matrix equivalent of the number 1. Finding it is a mechanical procedure, different for 2 × 2 and 3 × 3 matrices, and it starts in both cases with the determinant, the single number that decides whether an inverse exists at all. This guide works both methods by hand on numbers you can check.
- The inverse A⁻¹ satisfies A × A⁻¹ = A⁻¹ × A = I, the identity matrix.
- For a 2 × 2 matrix [[a, b], [c, d]], the inverse is (1 / det) × [[d, −b], [−c, a]], where det = ad − bc.
- For A = [[1, 2], [3, 4]], det = −2 and the inverse is [[−2, 1], [1.5, −0.5]].
- A matrix with determinant zero is singular: it has no inverse, and the system it represents has no unique solution.
- What an inverse is
- The determinant test: does an inverse exist?
- Inverse of a 2 × 2 matrix, step by step
- Inverse of a 3 × 3 matrix: cofactors and the adjugate
- Checking the answer: multiply back to the identity
- Using the inverse to solve systems
- When there is no inverse
- Mistakes, and a routine that always works
What an inverse is
The inverse of a square matrix A, written A⁻¹, is the matrix that undoes A. Multiplying them in either order gives the identity matrix I: A × A⁻¹ = I and A⁻¹ × A = I. The identity is the matrix with ones on the main diagonal and zeros everywhere else, so for 2 × 2 matrices I = [[1, 0], [0, 1]], and multiplying any matrix by the identity leaves it unchanged, exactly as multiplying a number by 1 leaves the number unchanged.
The analogy with ordinary numbers is exact up to one point. The inverse of 5 is 1/5, because 5 × (1/5) = 1, and the inverse of a matrix is the matrix that plays the role of 1/5. The point where the analogy breaks is existence: every non-zero number has an inverse, but not every matrix does. A matrix whose determinant is zero, a singular matrix, has no inverse at all, and no procedure will produce one. The determinant test below is therefore the first step, not an afterthought.
Only square matrices can have inverses. A 2 × 3 matrix has no inverse, because the product of a 2 × 3 matrix with anything cannot be the 2 × 2 identity and the 3 × 3 identity at once; the shapes do not allow it. The inverse, when it exists, has the same size as the original matrix: the inverse of a 2 × 2 matrix is 2 × 2, and the inverse of a 3 × 3 matrix is 3 × 3.
The determinant test: does an inverse exist?
For a 2 × 2 matrix [[a, b], [c, d]], the determinant is ad − bc: the product of the main diagonal minus the product of the other diagonal. For A = [[1, 2], [3, 4]], the determinant is 1 × 4 − 2 × 3, which is 4 − 6, which is −2. A negative determinant is fine; the test is only whether it is zero. Since −2 is not zero, A has an inverse, and the inverse will contain a division by −2, which is why the entries come out as halves and whole numbers rather than fractions with a large denominator.
For a 3 × 3 matrix, the determinant is computed by expanding along a row or column, multiplying each entry by the determinant of the 2 × 2 matrix left after deleting its row and column, with alternating signs. The worked 3 × 3 example below does this in full. The rule for existence is the same at every size: determinant zero means singular, no inverse, and no unique solution to the associated system; determinant non-zero means an inverse exists.
A determinant near zero deserves a warning even when it is not exactly zero. A tiny determinant means the matrix is nearly singular, and its inverse has very large entries, so small errors in the original entries, or in the arithmetic, swing the answer wildly. The calculator on this page flags this: a determinant that is exactly zero gives no inverse, and a determinant close to zero gives an inverse that should be treated with suspicion.
Inverse of a 2 × 2 matrix, step by step
The 2 × 2 inverse is a three-step recipe. One, compute the determinant, ad − bc. Two, swap the two diagonal entries, a and d. Three, change the signs of the two off-diagonal entries, b and c. Four, divide every entry of the resulting matrix by the determinant. In symbols, the inverse of [[a, b], [c, d]] is (1 / det) × [[d, −b], [−c, a]], where det = ad − bc.
Work it on A = [[1, 2], [3, 4]]. The determinant is 1 × 4 − 2 × 3 = −2. Swapping the diagonal gives [[4, 2], [3, 1]], and changing the signs of the off-diagonal entries gives [[4, −2], [−3, 1]]. Dividing every entry by −2 gives [[4 / −2, −2 / −2], [−3 / −2, 1 / −2]], which is [[−2, 1], [1.5, −0.5]]. That is the inverse, and the check in the next section confirms it multiplies back to the identity.
The recipe’s four steps are easy to memorise and easy to get wrong in exactly one place: the signs. The diagonal entries swap without changing sign, and the off-diagonal entries change sign without swapping. Swapping the wrong pair, or changing the wrong signs, gives a matrix that looks plausible and fails the check, which is why the check, multiplying back to the identity, is part of the method rather than an optional extra.
Inverse of a 3 × 3 matrix: cofactors and the adjugate
The 3 × 3 inverse has more steps but the same shape: compute the determinant, build the matrix of cofactors, transpose it to get the adjugate, and divide by the determinant. The cofactor of an entry is the determinant of the 2 × 2 matrix left after deleting that entry’s row and column, multiplied by +1 or −1 in a checkerboard pattern that starts with + in the top-left corner.
Work it on M = [[2, 1, 0], [1, 3, 1], [0, 1, 2]]. The determinant, expanding along the first row, is 2 × (3 × 2 − 1 × 1) − 1 × (1 × 2 − 1 × 0) + 0, which is 2 × 5 − 1 × 2, which is 8. The cofactors are: C₁₁ = +(3 × 2 − 1 × 1) = 5; C₁₂ = −(1 × 2 − 1 × 0) = −2; C₁₃ = +(1 × 1 − 3 × 0) = 1; C₂₁ = −(1 × 2 − 0 × 1) = −2; C₂₂ = +(2 × 2 − 0 × 0) = 4; C₂₃ = −(2 × 1 − 1 × 0) = −2; C₃₁ = +(1 × 1 − 3 × 0) = 1; C₃₂ = −(2 × 1 − 1 × 0) = −2; C₃₃ = +(2 × 3 − 1 × 1) = 5. The cofactor matrix is [[5, −2, 1], [−2, 4, −2], [1, −2, 5]], and since it is symmetric, its transpose, the adjugate, is the same matrix. Dividing by the determinant 8 gives the inverse [[0.625, −0.25, 0.125], [−0.25, 0.5, −0.25], [0.125, −0.25, 0.625]].
Two things in that calculation deserve attention. First, the checkerboard of signs is the step most often skipped: forgetting a minus sign on C₁₂ or C₂₁ corrupts the whole inverse. Second, the transpose step is the step most often forgotten entirely: the inverse uses the adjugate, the transpose of the cofactor matrix, not the cofactor matrix itself. In this example the cofactor matrix happens to be symmetric, so the transpose changes nothing, which is a coincidence of the chosen numbers, not a property of the method; with a non-symmetric cofactor matrix, skipping the transpose gives the wrong answer.
Checking the answer: multiply back to the identity
The check is the definition: multiply the matrix by its claimed inverse and confirm the product is the identity. For A = [[1, 2], [3, 4]] and the claimed inverse [[−2, 1], [1.5, −0.5]], the product A × A⁻¹ is computed row by column. The top-left entry is 1 × (−2) + 2 × 1.5, which is −2 + 3, which is 1. The top-right is 1 × 1 + 2 × (−0.5), which is 1 − 1, which is 0. The bottom-left is 3 × (−2) + 4 × 1.5, which is −6 + 6, which is 0. The bottom-right is 3 × 1 + 4 × (−0.5), which is 3 − 2, which is 1. The product is [[1, 0], [0, 1]], the identity, so the inverse is correct.
For the 3 × 3 example, one entry is enough to show the method: the top-left entry of M × M⁻¹ is row 1 of M, [2, 1, 0], dotted with column 1 of the inverse, [0.625, −0.25, 0.125], which is 2 × 0.625 + 1 × (−0.25) + 0 × 0.125, which is 1.25 − 0.25, which is 1, as required. The top-middle entry is [2, 1, 0] dotted with [−0.25, 0.5, −0.25], which is −0.5 + 0.5 + 0, which is 0, as required. Checking all nine entries is a few minutes of arithmetic; checking two or three catches almost every error, because a wrong cofactor corrupts a whole row or column rather than a single entry.
Using the inverse to solve systems
The reason inverses exist is systems of equations. The system x + 2y = 5 and 3x + 4y = 11 is the matrix equation A × x = b, with A = [[1, 2], [3, 4]] and b = [5, 11], and its solution is x = A⁻¹ × b. Multiplying the inverse [[−2, 1], [1.5, −0.5]] by b gives [−2 × 5 + 1 × 11, 1.5 × 5 + (−0.5) × 11], which is [−10 + 11, 7.5 − 5.5], which is [1, 2]. So x = 1 and y = 2, which checks against the original equations: 1 + 2 × 2 = 5, and 3 × 1 + 4 × 2 = 11.
For a single system, Gaussian elimination is usually faster than computing the inverse. The inverse earns its keep when the same coefficient matrix meets many different answer columns: compute the inverse once, then each new system is a single multiplication. That is the situation in engineering and computer graphics, where the same transformation is applied to many vectors, and it is why the inverse is a standard tool rather than a classroom exercise.
When there is no inverse
A matrix has no inverse exactly when its determinant is zero. The simplest example is [[2, 4], [1, 2]], whose determinant is 2 × 2 − 4 × 1, which is 0. Its rows are multiples of each other: the second row is half the first, so the two rows carry the same information, and the matrix collapses two dimensions into one. The associated system, 2x + 4y = a and x + 2y = b, has either no solution or infinitely many, depending on whether a equals 2b, and no unique solution exists to be found by an inverse.
Geometrically, a singular matrix squashes space flat: it maps a two-dimensional plane onto a line, and the squashing cannot be undone, because the information about where on the plane a point came from is lost. A non-singular matrix stretches and rotates space but keeps it two-dimensional, and the inverse is the motion that restores it. The determinant is the factor by which areas are scaled, so a determinant of zero is an area scaled to nothing, and the loss is permanent.
Near-singular matrices deserve the same caution as singular ones. A determinant of 0.001 gives an inverse with entries in the hundreds, and a rounding error in the third decimal place of the input becomes an error of whole units in the output. If the calculator reports a very small determinant, treat the inverse as numerically fragile and check the input, rather than trusting the digits.
Mistakes, and a routine that always works
The commonest mistake is the sign pattern: swapping the diagonal and changing the signs of the off-diagonal entries is the whole 2 × 2 recipe, and doing either step to the wrong pair gives a plausible-looking wrong answer. The second mistake is forgetting to divide by the determinant, which leaves a matrix that is the adjugate rather than the inverse, and which fails the identity check by exactly the determinant factor. The third mistake is forgetting the transpose in the 3 × 3 method: the inverse needs the adjugate, not the cofactor matrix. The fourth is a determinant error, usually a dropped minus sign in ad − bc, which corrupts every entry at once.
The routine that works is short. One, compute the determinant and stop if it is zero. Two, for a 2 × 2 matrix, swap the diagonal, change the signs of the off-diagonal entries, and divide everything by the determinant. Three, for a 3 × 3 matrix, build the cofactor matrix with the checkerboard signs, transpose it, and divide by the determinant. Four, check by multiplying the matrix by the claimed inverse and confirming the identity, at least for two or three entries. Five, if the check fails, recheck the determinant first, because a determinant error is the single commonest cause.
Frequently asked questions
What is the inverse of a matrix?
The inverse of a square matrix A, written A⁻¹, is the matrix that undoes it: A × A⁻¹ = A⁻¹ × A = I, the identity matrix. Multiplying any matrix by the identity leaves it unchanged, exactly as multiplying a number by 1 leaves it unchanged.
How do you find the inverse of a 2 × 2 matrix?
Use the recipe: for [[a, b], [c, d]], the inverse is (1 / det) × [[d, −b], [−c, a]], where det = ad − bc. For A = [[1, 2], [3, 4]], det = −2, so the inverse is [[−2, 1], [1.5, −0.5]]. Swap the diagonal, change the signs of the off-diagonal entries, and divide by the determinant.
What if the determinant is zero?
Then the matrix is singular and has no inverse. For example, [[2, 4], [1, 2]] has determinant 2 × 2 − 4 × 1 = 0, because its rows are multiples of each other. The associated system has no unique solution, so there is nothing for an inverse to find.
How do you find the inverse of a 3 × 3 matrix?
Build the matrix of cofactors, with the checkerboard sign pattern, transpose it to get the adjugate, and divide every entry by the determinant. For M = [[2, 1, 0], [1, 3, 1], [0, 1, 2]], the determinant is 8 and the inverse is [[0.625, −0.25, 0.125], [−0.25, 0.5, −0.25], [0.125, −0.25, 0.625]].
How do you check an inverse is correct?
Multiply the matrix by its claimed inverse and confirm the product is the identity matrix. For A = [[1, 2], [3, 4]] and its inverse [[−2, 1], [1.5, −0.5]], the product is [[1, 0], [0, 1]]. Checking two or three entries catches almost every error.
Can every matrix be inverted?
No. Only square matrices with a non-zero determinant have inverses. A non-square matrix has no inverse at all, and a square matrix with determinant zero is singular and has none either. A determinant close to zero gives an inverse that exists but is numerically fragile.
Try it on the calculator
Run the same matrices through the Matrix Calculator and watch the determinant and inverse update as you change a single entry.
Open the Matrix Calculator →- 1Matrix Operations Explained: Addition, Multiplication, and Solving
Adding, subtracting, and multiplying matrices, with worked numbers and the linear systems they solve.
- 2Algebra Calculator
Equations with steps.
- 3Graphing Calculator
Plot functions.
- 4Statistics Calculator
Mean, median, spread.
