What the rule says
Take two linear equations in x and y:
The solution is
- x = (ed − bf) / (ad − bc)
- y = (af − ec) / (ad − bc)
Holds when ad − bc ≠ 0.
The bottom is the determinant of the
coefficients, the same for both unknowns. Each top is that determinant with one column replaced by the
right-hand sides e and f: the x-column (a, c) is replaced for x, and the y-column (b, d) for y.
Books use other letters for the same system. A common one is a₁x + b₁y = c₁ and a₂x + b₂y = c₂, which
gives x = (c₁b₂ − b₁c₂) / (a₁b₂ − b₁a₂). This page uses a to f so that the determinant matches the one on
its own page.
Where it comes from
It is elimination, done once for all numbers. To remove y, multiply the first equation by d and the second
by b, and subtract:
- adx + bdy = ed
- bcx + bdy = bf
- (ad − bc)x = ed − bf
Divide by ad − bc and x appears. To remove x instead, multiply the first equation by c and the second by
a, subtract, and (ad − bc)y = af − ec. The division is only possible when ad − bc is not 0, which is
where the condition comes from.
Worked examples
A system with a negative determinant. 3x + 5y = 27 and 7x + 4y = 40. Here a = 3, b = 5, c = 7, d = 4,
e = 27, f = 40. The determinant is ad − bc = 3 · 4 − 5 · 7 = 12 − 35 = −23. Then
- x = (27 · 4 − 5 · 40) / (−23) = (108 − 200) / (−23) = −92 / −23 = 4
- y = (3 · 40 − 27 · 7) / (−23) = (120 − 189) / (−23) = −69 / −23 = 3
Check: 3 · 4 + 5 · 3 = 27 and 7 · 4 + 4 · 3 = 40.
The same system in the equation system calculator.
Negative numbers throughout. 4x − 3y = −41 and 5x − 5y = −60. The determinant is
4 · (−5) − (−3) · 5 = −20 + 15 = −5, and
- x = ((−41) · (−5) − (−3) · (−60)) / (−5) = (205 − 180) / (−5) = −5
- y = (4 · (−60) − (−41) · 5) / (−5) = (−240 + 205) / (−5) = 7
When the determinant is 0. x + 2y = 4 and 2x + 4y = 8 give ad − bc = 1 · 4 − 2 · 2 = 0, and the rule
cannot be used. Here the second equation is twice the first, so every point on the line x + 2y = 4 is a
solution. Change the right-hand side to 2x + 4y = 7 and the determinant is still 0, but now the equations
contradict each other and there is no solution. The rule stops at the same place in both cases; elimination
shows which one it is.
The part to get right: which column is replaced
The mistake is in the top. For 3x + 5y = 27 and 7x + 4y = 40:
| Top used for x |
Value |
Verdict |
| ed − bf |
27 · 4 − 5 · 40 = −92 |
correct, gives x = 4 |
| eb − fd |
27 · 5 − 40 · 4 = −25 |
wrong, gives x ≈ 1.09 |
| ad − bc in the top too |
−23 |
wrong, gives x = 1 |
The top for x is the determinant of the matrix with rows (e, b) and (f, d): e and f stand where a and c
were. Cramer’s rule for y has them in the second column instead, which is why y has af − ec on top and not
ed − bf.
Common mistakes
- Dropping a sign from the bottom. With ad − bc = −23, using 23 turns x = 4 into x = −4.
- Swapping the two products in a top. ed − bf and bf − ed have opposite signs, and so do the answers.
- Using the rule when the determinant is 0. The quotient is a division by 0. Use elimination to tell
“no solution” from “infinitely many”.
- Taking x’s formula for y. y has a different top, af − ec.
- Not checking. Put x and y into both original equations. A sign error shows up at once.
Where to go next
The determinant of a 2×2 matrix page has
the bottom of the fraction. The
elimination method and the
substitution method solve the same
systems step by step, and the
system of equations calculator does it with your own numbers.
Common questions
Is Cramer’s rule faster than elimination?
For two equations it is about the same, and it gives a closed formula, which helps when the coefficients
are letters. For larger systems, elimination needs far fewer operations than working out the determinants by expansion.
What happens with three equations?
The same idea works with 3×3 determinants: the bottom is the determinant of the coefficients and each top
replaces one column with the right-hand sides.
What does ad − bc = 0 mean for the lines?
Each equation is a line, and ad − bc = 0 means the two lines have the same direction. They are either
parallel and different, which gives no solution, or the same line, which gives infinitely many.