Skip to content

Cramer's rule: how and when to use it

5 min read

Short answer

For a square system Ax=bA\mathbf x=\mathbf b with det⁡A≠0\det A\ne0, Cramer's rule gives each unknown as xi=det⁡Aidet⁡Ax_i=\dfrac{\det A_i}{\det A}, where AiA_i is AA with its ii-th column replaced by b\mathbf b. It is neat for 2×22\times2 and sometimes 3×33\times3 systems, but row reduction is faster for anything bigger.

xᵢ = det(Aᵢ) / det(A)xᵢ = det(Aᵢ) / det(A)Aᵢ A with column i replaced by bdet(A) ≠ 0 required, otherwise no unique solution2×2 x = (ed − bf)/(ad − bc) patternLarge n use elimination instead
One determinant for the denominator, then one per unknown for the numerators.

When it works and when it does not

If det⁡A=0\det A=0 the rule breaks (division by zero): the system has no solution or infinitely many, and Cramer's rule cannot tell which. For large nn, computing n+1n+1 determinants is far slower than Gaussian elimination. The rule shines when you need a single variable, or a formula that shows how the solution depends on the parameters.

Why it works

Replacing column ii of AA by b=Ax=∑xjaj\mathbf b=A\mathbf x=\sum x_j\mathbf a_j leaves a matrix whose columns repeat every other column. Determinants vanish for repeated columns, so only the xiaix_i\mathbf a_i term survives, giving det⁡Ai=xidet⁡A\det A_i=x_i\det A.

Worked example

Solve 2x+y=52x+y=5, x+3y=10x+3y=10 using Cramer's rule.

det⁡A=∣2113∣=6−1=5\det A=\begin{vmatrix}2&1\\1&3\end{vmatrix}=6-1=5.

x=∣51103∣5=15−105=1x=\dfrac{\begin{vmatrix}5&1\\10&3\end{vmatrix}}{5}=\dfrac{15-10}{5}=1 and y=∣25110∣5=20−55=3y=\dfrac{\begin{vmatrix}2&5\\1&10\end{vmatrix}}{5}=\dfrac{20-5}{5}=3.

Check: 2(1)+3=52(1)+3=5 ✓ and 1+3(3)=101+3(3)=10 ✓.

Try it yourself

Solve 3x+2y=73x+2y=7, x−y=1x-y=1 with Cramer's rule.

Show the answer

det⁡A=−3−2=−5\det A=-3-2=-5. x=7(−1)−2(1)−5=−9−5=1.8x=\dfrac{7(-1)-2(1)}{-5}=\dfrac{-9}{-5}=1.8 and y=3(1)−1(7)−5=−4−5=0.8y=\dfrac{3(1)-1(7)}{-5}=\dfrac{-4}{-5}=0.8. Check: 5.4+1.6=75.4+1.6=7 ✓ and 1.8−0.8=11.8-0.8=1 ✓.

Keep going with practice

Determinants and systems of equations are covered in Vidi's Linear Algebra & Probability course, with a matrix calculator for checking.