Computing a 2×2 Inverse
Finding the
inverse
of a big matrix usually takes a whole page of row operations. But for a
2\times 2 matrix, there is a genuine one-line formula —
no guesswork, no elimination, just three moves: swap the diagonal, negate the off-diagonal, and
divide by the determinant.
A = \begin{bmatrix} a & b \\ c & d \end{bmatrix} \;\Rightarrow\; A^{-1} = \frac{1}{ad - bc}\begin{bmatrix} d & -b \\ -c & a \end{bmatrix}.
Say it out loud as a chant: "swap a and d,
flip the sign of b and c, divide everything
by the determinant." That's the entire recipe — for any invertible 2\times2
matrix, applying those three moves in order always produces the inverse.
Where the formula comes from — and why the determinant sits underneath
The determinant isn't decoration in that denominator; it's the same
det ≠ 0
condition from the previous page, showing up in the one place it can't be ignored. If
ad - bc = 0, the formula asks you to divide by zero — which is
undefined, full stop. That isn't a flaw in the formula; it's the formula honestly reporting that no
inverse exists. Every non-invertible matrix trips this same wire: the recipe doesn't quietly give a
wrong answer, it refuses to give any answer at all.
Why swap and negate, though? Because those two moves build the adjugate — the
matrix that, before dividing, already "almost" inverts A: multiplying
A by its own swap-and-negate partner produces
(ad-bc)I, the identity scaled up by the determinant. Dividing that
partner by ad - bc is precisely what shrinks the scaled identity back
down to a plain, honest I. The determinant is doing real work: undoing
the exact amount of stretching A itself does to area.
Build the inverse live
Set the entries of A below and watch the recipe run in real time: the
determinant updates first, then every entry of A^{-1} follows from it.
Push the sliders until the determinant hits exactly zero and watch the formula break — the inverse
panel shows dashes instead of numbers, exactly as it should, because no inverse exists there.
Worked example: compute it fully, then check it
Take a concrete matrix and grind through all three moves by hand:
A = \begin{bmatrix} 2 & 3 \\ 1 & 2 \end{bmatrix}.
Step 1 — the determinant. \det A = ad - bc = (2)(2) - (3)(1) = 4 - 3 =
1. Non-zero, so an inverse exists — worth checking before doing anything else.
Step 2 — swap and negate. Swap the diagonal (2 and
2 trade places — here they happen to be equal, so it looks like nothing
moved) and negate the off-diagonal (3 and 1
both flip sign):
\begin{bmatrix} 2 & -3 \\ -1 & 2 \end{bmatrix}.
Step 3 — divide by the determinant. Since \det A = 1,
dividing changes nothing this time:
A^{-1} = \frac{1}{1}\begin{bmatrix} 2 & -3 \\ -1 & 2 \end{bmatrix} = \begin{bmatrix} 2 & -3 \\ -1 & 2 \end{bmatrix}.
Now build the check habit: multiply A \cdot A^{-1} and confirm it lands
on I.
A A^{-1} = \begin{bmatrix} 2(2)+3(-1) & 2(-3)+3(2) \\ 1(2)+2(-1) & 1(-3)+2(2) \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = I.
It checks out. Make this multiplication a habit every time — it takes twenty seconds and catches
almost every arithmetic slip before it costs you the rest of a problem.
Worked example: using the inverse to solve a system
Two equations, two unknowns: 2x + 3y = 8 and
x + 2y = 5. Written as A\vec{x} = \vec{b},
this is exactly the matrix from the last example:
\begin{bmatrix} 2 & 3 \\ 1 & 2 \end{bmatrix}\begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 8 \\ 5 \end{bmatrix}.
We already computed A^{-1} = \begin{bmatrix} 2 & -3 \\ -1 & 2 \end{bmatrix},
so solving is just one multiplication: \vec{x} = A^{-1}\vec{b}.
\vec{x} = \begin{bmatrix} 2 & -3 \\ -1 & 2 \end{bmatrix}\begin{bmatrix} 8 \\ 5 \end{bmatrix} = \begin{bmatrix} 2(8) + (-3)(5) \\ -1(8) + 2(5) \end{bmatrix} = \begin{bmatrix} 1 \\ 2 \end{bmatrix}.
So x = 1, y = 2. Check against the original
equations: 2(1) + 3(2) = 2 + 6 = 8 ✓, and
1(1) + 2(2) = 1 + 4 = 5 ✓. Once A^{-1} is in
hand, every system with that same left-hand side solves in one step, no matter what
\vec{b} is — the whole problem of "solving equations" collapses into
"multiply by a fixed matrix."
Worked example: when the formula breaks
Now try the recipe on a matrix that shouldn't have an inverse:
A = \begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix}, \qquad \det A = (1)(4) - (2)(2) = 4 - 4 = 0.
Swap and negate exactly as before — that part never fails, it's pure arithmetic on the entries:
\begin{bmatrix} 4 & -2 \\ -2 & 1 \end{bmatrix}.
But step 3 asks you to divide every entry by \det A = 0:
A^{-1} = \frac{1}{0}\begin{bmatrix} 4 & -2 \\ -2 & 1 \end{bmatrix} = \text{undefined.}
There is no number you can put in place of \tfrac{1}{0}, so the formula
simply stops here. That's not a dead end to push past — it's the formula confirming, from first
principles, that this particular A has no inverse. (Look at the columns
of A: (1,2) and (2,4)
point in the exact same direction, one just twice as long as the other — a dead giveaway that the
determinant will be zero before you even compute it.)
Two habits separate a clean solution from a wrong one:
-
Swap the diagonal and negate the off-diagonal — doing only one of the two is the
single most common mistake. A very common wrong answer looks like
\begin{bmatrix} d & b \\ c & a \end{bmatrix} (diagonal swapped, but the
signs on b and c were never flipped) or
\begin{bmatrix} a & -b \\ -c & d \end{bmatrix} (signs flipped, but the
diagonal never swapped). Both are wrong, and both will fail the "multiply back to
I" check — which is exactly why that check is worth the twenty
seconds it costs.
-
Compute the determinant first, before doing anything else. If it turns out to be
zero, you've just saved yourself from swapping, negating, and dividing your way through a formula
that was always going to fail at the last step. Checking \det A costs
one subtraction; discovering it's zero after writing out the whole adjugate matrix costs
much more time for nothing.
This exact swap-negate-divide recipe is genuinely how software does it. Calculators, spreadsheet
MINVERSE functions, and graphics libraries that need to invert a small
2\times2 transform (for undoing a rotation-and-scale in a game engine,
say) very often just hard-code this formula directly — at this size, it's faster than running a
general-purpose elimination algorithm, and there's no approximation involved: the answer is exact.
The idea is also older than "matrices" as a word. In 1750, the Swiss mathematician
Gabriel Cramer published a rule for solving systems of linear equations using
ratios of determinants — what we'd now recognise as this very formula in disguise, decades before
anyone organised numbers into the grid-with-brackets notation you're using today. Mathematicians
happily solved small systems this way for over a century before the word "matrix" was even coined.
See it explained