This site is a work in progress. New lessons are added regularly.
Contact us
Determinants and Cramer's Rule
Learning goals
Find ad−bc appearing as the denominator in elimination
Compute a 2×2 determinant as main minus anti-diagonal
Apply Cramer's rule, replacing a column with the constants
Expand a 3×3 determinant by cofactors along a row
Tie a unique solution to D=0
Choose row reduction for large systems instead
Solving the general two-variable system
Take the most general system of two linear equations in two unknowns. Write the coefficients as letters so
the result works for every system at once:
ax+bycx+dy=e,=f.
Solve it by elimination, exactly as you always have. To clear y, multiply the first equation by d and
the second by b, so the y terms match:
adx+bdybcx+bdy=ed,=bf.
Subtract the second line from the first. The bdy terms cancel, and x is left with the coefficient
ad−bc:
(ad−bc)x=ed−bf.
Now do the mirror image to clear x. Multiply the first equation by c and the second by a, then
subtract the first from the second, and the same coefficient ad−bc reappears in front of y:
(ad−bc)y=af−ce.
Look at what these two results share. The quantity ad−bc sits in front of both x and y, which
means it becomes the denominator the moment you divide to solve:
x=ad−bced−bf,y=ad−bcaf−ce.
One combination of the four coefficients controls both answers. If it is not zero, you can divide and the
system has a clean solution. If it is zero, the division is illegal and something has gone wrong with the
system itself. A number that important should not stay nameless.
The determinant and its bar notation
The shared quantity ad−bc is the determinant of the four coefficients, arranged in the square
grid in which they appear:
acbd=ad−bc.
The straight bars are the determinant symbol. The rule they stand for is short: multiply down the main
diagonal (a times d), then subtract the product up the other diagonal (b times c). We write the
coefficient determinant of our system as D, so D=ad−bc.
The 2 by 2 determinant is the product down the main diagonal minus the product up the anti-diagonal.
Check your understanding
Evaluate the determinant 2354.
Multiply down the main diagonal, then subtract the anti-diagonal product.
2354=2×4−5×3=8−15=−7
The answer is negative, which is fine. A determinant is a signed number, not an absolute value.
Cramer’s rule for a two-variable system
Look again at the answers we derived,
x=ad−bced−bf,y=ad−bcaf−ce,
and notice that every numerator is itself a determinant. The denominator is D in both. The numerator for
x is ed−bf, which is the determinant you get from D by a single column swap. You take D and
replace its first
column (the x-column, a and c) with the constants e and f. The numerator for y is af−ce, the
determinant from replacing the second column (the y-column, b and d) with the same constants. Name
these column-swapped determinants Dx and Dy:
Dx=efbd=ed−bf,Dy=acef=af−ce.
With that naming, the whole solution collapses into a pattern worth memorizing. This is Cramer’s rule:
x=DDx,y=DDy(D=0). Cramer's rule builds each numerator by replacing one column of D with the constant column: the x-numerator swaps the x-column, the y-numerator swaps the y-column.
Why Cramer's rule gives the exact solution when D=0#
Look back at the elimination. Starting from the two original equations, honest algebra produced
Dx=Dx and Dy=Dy, so every solution of the system must satisfy those two relations. When D=0 we may divide, and the relations force
x=DDx,y=DDy.
No other values are possible, so the system has at most this one solution. It remains to check that this
pair actually solves the system, since forcing the values does not by itself guarantee they work. Substitute
them into the first equation and clear the denominator:
The middle step used −abf+baf=0, so those terms drop and e factors out of what remains. The same
computation on cx+dy returns f. The pair therefore satisfies both equations, and it is the only pair
that can, so it is the unique solution.
∎
Worked example 1Solve 3x+2y=16 and 5x−3y=14 by Cramer's rule
Read the coefficients straight off the equations. The coefficient determinant is
D=352−3=(3)(−3)−(2)(5)=−9−10=−19.
Since D=0, the system has a unique solution and Cramer’s rule applies. For Dx, replace the
x-column with the constants 16 and 14:
Dx=16142−3=(16)(−3)−(2)(14)=−48−28=−76.
For Dy, replace the y-column with the constants instead:
Dy=351614=(3)(14)−(16)(5)=42−80=−38.
Now divide:
x=DDx=−19−76=4,y=DDy=−19−38=2.
The solution is (x,y)=(4,2). A quick check confirms it: 3(4)+2(2)=16 and 5(4)−3(2)=14.
Notice D was negative the whole way through, which never caused trouble, because a determinant is allowed
to be negative.
The determinant test for a unique solution
The derivation quietly answered a deeper question than “what is the solution.” It told us exactly when a
solution exists and is unique. Everything hinged on whether we were allowed to divide by D, so D is the
switch that decides the whole character of the system.
A two-variable system has a unique solution exactly when D=0#
We prove both directions, since “exactly when” is a claim in both. Throughout, recall the two relations that
hold for any solution: Dx=Dx and Dy=Dy.
First, if D=0, the previous proof already produced one and only one solution, x=Dx/D and
y=Dy/D. So D=0 gives a unique solution.
Now the other direction, in its contrapositive form: suppose D=0, and show the solution cannot be
unique. With D=0 the two relations read 0=Dx and 0=Dy, and both must hold for any solution to
exist at all. Two cases cover it.
If either Dx=0 or Dy=0, then one of the relations says 0=(a nonzero number), which
nothing can make true. The system then has no solution.
If instead Dx=0 and Dy=0 as well, look at the two equations directly, assuming each has a nonzero
coefficient on at least one variable. Excluding that case costs nothing, since a degenerate equation
like 0x+0y=1 has no solution by itself, which is still not a unique solution. Since D=0, the coefficient rows (a,b) and (c,d) are
proportional. Because Dx=Dy=0 forces the constants to scale by that same factor as well, one
equation is a constant multiple of the other. The two therefore impose at most one line’s worth of constraint, so the
solution set is never a single point. In the consistent case that set is a whole line, giving infinitely
many solutions.
Either way, a system with D=0 has no solution or infinitely many, never exactly one. Combined with the
first direction, a system has a unique solution precisely when D=0.
∎
This is the tidy end of the one-none-infinitely-many trichotomy you met at the start of the chapter. The
determinant is a single number that detects which case you are in:
D=0: the two lines cross at one point, so there is exactly one solution.
D=0: the lines are parallel (no solution) or the same line (infinitely many). The determinant cannot
tell those two apart by itself, only that the system is degenerate.
Be careful with that last point, because it is the easiest thing to overstate. A zero determinant does
not mean “no solution.” It means “not a unique solution,” which is either no solution or infinitely
many. You need one more look at the constants to decide which.
Check your understanding
For which values of k does the system {kx+y=1x+ky=3 have exactly one solution?
A unique solution happens exactly when the coefficient determinant is nonzero, so find where D is zero.
D=k11k=k2−1
This is zero when k=1 or k=−1, so the system has a unique solution for every other value, that is k=1 and k=−1.
Determinants of three-variable systems
For three unknowns the coefficients form a 3×3 array, and its determinant is built out of 2×2
determinants. Expand along the first row: multiply each top entry by the 2×2 determinant left
after crossing out that entry’s own row and column. Then attach the alternating signs to those products in
order: plus, minus, plus.
adgbehcfi=aehfi−bdgfi+cdgeh.
Each small determinant is the minor of the entry in front of it. The middle term carries a minus sign,
which is the single most common slip, so watch for it. This method is called cofactor expansion, and it
reduces any 3×3 determinant to three easy 2×2 ones.
Worked example 2Evaluate a 3 by 3 determinant by cofactor expansion
Expand along the first row of
105216340.
Take the three top entries 1, 2, 3 in turn, each with its minor and its sign:
11640−20540+30516.
Evaluate each 2×2 determinant:
1640=−24,0540=−20,0516=−5.
Now combine with the signs, and mind the minus on the middle term:
1(−24)−2(−20)+3(−5)=−24+40−15=1.
The determinant equals 1.
Check your understanding
Evaluate 231124012 by expanding along the first row.
Expand along the top row, with signs plus, minus, plus. The top-right entry is 0, so its term drops out.
22412−13112+0=2(0)−1(5)=−5
So the determinant is −5.
Cramer’s rule for a three-variable system
Cramer’s rule extends to three unknowns with no new ideas, only more columns. Let D be the coefficient
determinant of
The solution is (x,y,z)=(2,1,3), which checks in all three equations. Had you wanted only z, you
could have computed just D and Dz and skipped the other two determinants entirely.
Cramer’s rule or row reduction?
Cramer’s rule and the row reduction from the previous lesson solve the same systems, so which should you
reach for? They have opposite strengths, and the honest answer is that it depends on what you want.
Cramer’s rule is a closed formula: it writes each unknown as one determinant over another, with no
back-substitution and no bookkeeping of row swaps. That makes it excellent in two situations. First, when
you need only one unknown, you compute just D and that variable’s numerator and stop, while row reduction
would make you solve for everything. Second, for theory, the formula shows plainly how the answer depends on
the numbers in the system, which is why D=0 reads off the unique-solution condition at a glance.
Row reduction wins on scale. A cofactor expansion of an n×n determinant fans out into smaller
determinants and the work grows explosively with n, and Cramer needs n+1 of these determinants. Row
reduction grows far more gently, which is why it, not Cramer, is what people and computers use to solve large
systems.
Situation
Better tool
Why
You need only one of the unknowns
Cramer’s rule
Compute just D and that one numerator
You want a formula in the coefficients
Cramer’s rule
Each unknown is a ratio of determinants
A full solve of a 2×2 or 3×3
Either one
The effort is about the same
A large system (4×4 and up)
Row reduction
Determinant cost grows explosively
Common mistakes
Practice
Multiple Choice Questions (MCQ)
Progressively harder sets of questions. Each opens on its own page.
Longer questions in parts, to be worked out on paper. Progressive hints, the answer on its
own so you can check yourself and try again, then the full worked solution, plus a rubric
to mark your own work against.
Give a mathematician five points on a page. Which curve runs through all five of them? That question was
live in the seventeen hundreds, and it is harder than it sounds. You pick a family of curves, each one
carrying several unknown coefficients. Then you demand that every point satisfy the equation. Each point
hands you one linear equation, and the unknowns are the coefficients themselves.
Gabriel Cramer worked on exactly this problem, in Geneva, a city that is now Swiss. He wanted curves,
not arithmetic. A system was a nuisance standing in his way, and he had to clear it again and again. So
what he wanted was a formula: the answer already written, waiting for numbers to be dropped in.
His book on curves appeared in 1750, and the rule you have just learned is in an appendix at the back.
It says nothing whatever about how to solve a system. It says what the answer is. Every unknown is a
ratio, with the same quantity underneath every time, and each numerator built by swapping the constants
into one column. That shared denominator must not be zero, and it is zero in exactly the cases where no
single answer exists.
That is why the rule survives in a course that also teaches row reduction. Row reduction is a procedure,
and it delivers numbers. Cramer’s rule is a statement about the answer. That is what you need when the
coefficients are letters, or when a single unknown out of three is all you actually want.