Guides6 min
How to Find the Inverse of a Matrix by Gauss-Jordan Elimination
The inverse of a matrix plays the role that division plays for numbers. This guide walks through Gauss-Jordan elimination on a 2×2 and a 3×3 example, one row operation at a time, and shows what happens when no inverse exists.
What is an inverse matrix?
For a square matrix A, a matrix B with AB = BA = I is called the inverse of A and written A⁻¹. Here I is the identity matrix: ones on the diagonal, zeros everywhere else.
Not every matrix has an inverse. It exists only when A is square and its determinant is not zero. A matrix with an inverse is called invertible (or nonsingular).
Gauss-Jordan elimination at a glance
Write the identity matrix next to A to form [A | I]. Apply row operations until the left half becomes I. The right half is then A⁻¹.
Three row operations are allowed.
- Swap two rows: R₁ ↔ R₂
- Multiply a row by a nonzero number: R₁ ← 2R₁
- Add a multiple of one row to another: R₂ ← R₂ − 5R₁
Why does this work? Each row operation is the same as multiplying on the left by an invertible matrix. The product of all the operations that turn A into I is exactly A⁻¹, and applying the same operations to I accumulates that product on the right.
Example 1: a 2×2 matrix
Let's invert the matrix below.
- 01Append the identity matrix I to the right of A to form [A | I].21105301
- 02Divide row 1 by the pivot so the pivot becomes 1.
R₁ ← (1/2)R₁1121205301 - 03Make every other entry of column 1 zero.
R₂ ← R₂ − 5R₁112120012−521 - 04Divide row 2 by the pivot so the pivot becomes 1.
R₂ ← 2R₂11212001−52 - 05Make every other entry of column 2 zero.
R₁ ← R₁ − (1/2)R₂103−101−52
The left half is now the identity, so the right half is the inverse.
For 2×2 matrices there is also a formula. If A = [[a, b], [c, d]], then A⁻¹ = 1/(ad − bc) · [[d, −b], [−c, a]]. Here ad − bc = 2·3 − 1·5 = 1, which gives [[3, −1], [−5, 2]], the same as elimination.
Checking the answer
Multiply AA⁻¹. If you get the identity matrix, the inverse is correct.
Example 2: a 3×3 matrix
Now a 3×3 matrix. The method is identical; there is just one more pivot.
- 01Form [B | I].123100014010560001
- 02Make every other entry of column 1 zero.
R₃ ← R₃ − 5R₁1231000140100−4−15−501 - 03Make every other entry of column 2 zero.
R₁ ← R₁ − 2R₂R₃ ← R₃ + 4R₂10−51−20014010001−541 - 04Make every other entry of column 3 zero.
R₁ ← R₁ + 5R₃R₂ ← R₂ − 4R₃100−2418501020−15−4001−541
The left half is I, so B⁻¹ is the matrix below. Because det(B) = 1, every entry of the inverse is an integer.
When there is no inverse
If a row of zeros appears on the left half during elimination, the left half can never become the identity. The matrix has no inverse.
- 01Form [C | I].12102401
- 02Make every other entry of column 1 zero.
R₂ ← R₂ − 2R₁121000−21
Row 2 of the left half became all zeros, so C is not invertible. Indeed det(C) = 1·4 − 2·2 = 0: the second row is twice the first.
Common mistakes
- Applying an operation to the left half only. Every row operation applies to the whole row, including the I part.
- Skipping a zero pivot. If a lower row has a nonzero entry in that column, swap it up.
- Sign errors in fraction arithmetic. Always finish by checking AA⁻¹ = I.
- Pushing on when the determinant is zero. Computing the determinant first can save a lot of work.
FAQ
Can I tell in advance whether the inverse exists?
Yes: the inverse exists exactly when the determinant is nonzero. For 3×3 determinants see the cofactor expansion guide.
What about 4×4 and larger?
The method is the same, but the arithmetic gets long and error-prone by hand. Use the calculator to check your work.
Should I use elimination for 2×2 too?
For 2×2 the formula is faster. From 3×3 up, elimination is usually easier to organize.
Related guides