Cramer's Rule - Formula, 2x2 & 3x3 Examples
Cramer's Rule - Formula, 2x2 & 3x3 Examples
TL;DR
Cramer's rule solves a system of linear equations by writing each unknown as a ratio of two determinants. For a system with coefficient determinant D, the value of each variable is its own determinant divided by D, where each numerator swaps one column of the coefficient matrix for the constants. This article gives the 2x2 and 3x3 formulas, derives where they come from, works six examples, and pins down the one condition (D≠0) that decides whether the method works at all.
What Is Cramer's Rule?
Cramer's rule is a formula that solves a system of n linear equations in n unknowns using determinants, provided the system has exactly one solution. Each unknown equals a fraction: the denominator is the determinant of the coefficient matrix, and the numerator is that same determinant with the unknown's column replaced by the column of constants.
Two terms before we go further. A coefficient matrix is the grid of numbers multiplying the variables. A determinant is a single number computed from a square matrix; for a 2x2 matrix it is ad−bc. If either of those is new, read the determinant of a matrix explainer first, then come back here.
How Do You Use Cramer's Rule On A 2x2 System?
Start with the smallest case. Take the system
a1x+b1y=c1 a2x+b2y=c2
The coefficient determinant is
D=∣a1b1a2b2∣=a1b2−a2b1
Now build two more determinants by swapping a column for the constants (c1,c2):
Dx=∣c1b1c2b2∣,Dy=∣a1c1a2c2∣
The solution is
x=DxD,y=DyD,D≠0
Variable glossary: a1,b1,a2,b2 are the coefficients; c1,c2 are the constants on the right; D is the coefficient determinant; Dx and Dy are the numerator determinants for x and y.
Where Does The Rule Come From?
The formula is not magic, and seeing the derivation once means you never have to memorize it. Take the 2x2 system and eliminate y the ordinary way.
Multiply the first equation by b2 and the second by b1:
a1b2x+b1b2y=c1b2 a2b1x+b1b2y=c2b1
Subtract the second from the first. The y terms cancel:
(a1b2−a2b1)x=c1b2−c2b1
Divide both sides by (a1b2−a2b1):
x=c1b2−c2b1a1b2−a2b1
Look at the two pieces. The denominator is exactly D, and the numerator is exactly Dx. The rule is just elimination, written in determinant shorthand. That is also the first hint about when it breaks: you divided by (a1b2−a2b1), so the whole thing collapses the moment that quantity is zero.
Steps To Solve A System With Cramer's Rule
The same five steps work for a 2x2 or a 3x3 system. The order matters, because step 2 is the one that can stop the whole process early.
- Write the system in standard form, lining up the coefficients so each variable sits in its own column (insert a 0 coefficient for any missing variable).
- Compute the coefficient determinant D first. If D=0, stop here, the rule does not apply, and you switch to elimination or substitution.
- Build each numerator determinant by replacing only that variable's column with the column of constants, one variable at a time (Dx, Dy, and Dz for a 3x3).
- Divide each numerator by D to get the variable: x=DxD, y=DyD, z=DzD.
- Substitute the values back into the original equations to check that both (or all three) hold.
Examples of Cramer's Rule
Example 1
Solve 2x−y=5 and x+y=4.
Coefficient determinant:
D=∣2−111∣=(2)(1)−(1)(−1)=3
Replace the x-column with the constants:
Dx=∣5−141∣=(5)(1)−(4)(−1)=9
Replace the y-column with the constants:
Dy=∣2514∣=(2)(4)−(1)(5)=3
Divide:
x=93=3,y=33=1
Final answer: x=3, y=1. Substituting back, 2(3)−1=5 and 3+1=4. Both hold.
Example 2
Solve 3x+2y=7 and 6x+4y=1.
The first instinct is to grind through Dx and Dy right away. Try it. Watch where it goes.
Dx=∣7214∣=28−2=26
So far so good. Now the denominator:
D=∣3264∣=12−12=0
And there it is. x=260 is undefined. The mistake was diving into the numerators before checking D. Always compute D first. If D=0, Cramer's rule cannot produce a value, and you stop and switch methods.
Example 3
Solve 4x+3y=18 and x−2y=−1.
D=∣431−2∣=−8−3=−11
Dx=∣183−1−2∣=−36−(−3)=−33
Dy=∣4181−1∣=−4−18=−22
x=−33−11=3,y=−22−11=2
Final answer: x=3, y=2.
Example 4
Solve the 3x3 system x+y+z=6, y+3z=11, x−2y+z=0.
For a 3x3, D is the determinant of the full coefficient matrix. With the missing x in the second equation written as 0x:
D=∣1110131−21∣=9
Swap the first column for the constants (6,11,0):
Dx=∣61111130−21∣=9
Swap the second column:
Dy=∣1610113101∣=18
Swap the third column:
Dz=∣11601111−20∣=27
Divide:
x=99=1,y=189=2,z=279=3
Final answer: x=1, y=2, z=3.
Example 5
Use Cramer's rule to find only y in 5x+2y=16 and 3x−y=5.
D=∣523−1∣=−11
Dy=∣51635∣=−23
y=−23−11=2311
Final answer: y=2311.
Example 6
A small word problem. Two notebooks and three pens cost 13; four notebooks and one pen cost 16. Find the price of each.
Let x be the notebook price and y the pen price:
2x+3y=13 4x+y=16
D=∣2341∣=−10
Dx=∣133161∣=−35
Dy=∣213416∣=−20
x=−35−10=3.5,y=−20−10=2
Final answer: A notebook costs 3.50 and a pen costs 2.
Why The Determinant Decides Everything
If D=0, the rule has nothing to divide by.
- D≠0: the system has exactly one solution, and Cramer's rule delivers it.
- D=0 and at least one numerator is also 0: the equations overlap, and the system has infinitely many solutions.
- D=0 but the numerators are not all 0: the equations contradict each other, and the system has no solution.
Geometrically, D=0 means the lines (in 2D) or planes (in 3D) are parallel or coincident rather than crossing at a single point.
There is also a practical limit worth naming honestly. Cramer's rule is elegant for 2x2 and 3x3 systems, but for large systems it is one of the slowest methods known, because the number of determinant computations explodes. Working scientists solving a system of equations with hundreds of variables reach for Gaussian elimination, not Cramer's rule.
Tripping Points To Avoid
Mistake 1: Computing the numerators before checking D
Don't do this: Calculate Dx and Dy, then discover D=0.
The correct way: Compute D first every time. If D=0, stop and switch to elimination or substitution.
Mistake 2: Replacing the wrong column
Don't do this: For Dy, swap the constants into the first column instead of the second.
The correct way: The numerator for a variable replaces that variable's column with the constants and leaves the others alone.
Mistake 3: Sign errors in the determinant expansion
Don't do this: Write a11M11+a12M12+a13M13 with all plus signs.
The correct way: The signs alternate: +,−,+ across the first row. A dropped minus sign here is the most common reason a Cramer's-rule answer comes out wrong even when the setup was right.
Practice Questions on Cramer's Rule
Work each one with D computed first. Answers follow.
- Solve x+y=5 and 2x−y=1.
- Solve 3x−2y=4 and 6x−4y=9. State what happens.
- Use Cramer's rule to find only x in 4x+y=11 and 2x+3y=13.
- Solve the 3x3 system x+y+z=6, 2x−y+z=3, x+2y−z=2.
- Set up the system where two coffees and one tea cost 7; one coffee and three teas cost 11.
Answers:
- x=2, y=3.
- D=0, so Cramer's rule cannot be used.
- x=2.
- x=1, y=2, z=3.
- D=5, so a coffee costs 2 and a tea costs 3.
Key Takeaways
- Cramer's rule writes each unknown as a ratio of determinants, with the coefficient determinant D in every denominator.
- Each numerator replaces one variable's column with the column of constants.
- Always compute D first; if D=0, the rule cannot be used.
- D=0 signals either no solution or infinitely many, never a unique one.
- The method is ideal for 2x2 and 3x3 work and for isolating a single variable, but impractical for large systems.