Cramer's Rule for Solving Linear Systems

April 13, 2026

Problem

Solve the system 3x + 2y = 5, x + 4y = 7 using Cramer's rule. Show the ratios of determinants.

Explanation

What is Cramer's rule?

For a square linear system Ax=bA \mathbf{x} = \mathbf{b} with detA0\det A \ne 0, each variable is a ratio of determinants: xi=det(Ai)det(A)x_i = \dfrac{\det(A_i)}{\det(A)}

where AiA_i is the matrix obtained by replacing column ii of AA with the right-hand side b\mathbf{b}.

Step-by-step

Setup: A=(3214)A = \begin{pmatrix} 3 & 2 \\ 1 & 4 \end{pmatrix}, b=(57)\mathbf{b} = \begin{pmatrix} 5 \\ 7 \end{pmatrix}.

Step 1 — detA\det A: detA=(3)(4)(2)(1)=122=10\det A = (3)(4) - (2)(1) = 12 - 2 = 10

Since detA0\det A \ne 0, Cramer's rule applies.

Step 2 — A1A_1: replace column 1 with b\mathbf{b}. A1=(5274), detA1=(5)(4)(2)(7)=2014=6A_1 = \begin{pmatrix} 5 & 2 \\ 7 & 4 \end{pmatrix}, \ \det A_1 = (5)(4) - (2)(7) = 20 - 14 = 6

x=detA1detA=610=35x = \dfrac{\det A_1}{\det A} = \dfrac{6}{10} = \boxed{\dfrac{3}{5}}

Step 3 — A2A_2: replace column 2 with b\mathbf{b}. A2=(3517), detA2=(3)(7)(5)(1)=215=16A_2 = \begin{pmatrix} 3 & 5 \\ 1 & 7 \end{pmatrix}, \ \det A_2 = (3)(7) - (5)(1) = 21 - 5 = 16

y=detA2detA=1610=85y = \dfrac{\det A_2}{\det A} = \dfrac{16}{10} = \boxed{\dfrac{8}{5}}

Verification

  • Eq 1: 3(3/5)+2(8/5)=9/5+16/5=25/5=53(3/5) + 2(8/5) = 9/5 + 16/5 = 25/5 = 5
  • Eq 2: (3/5)+4(8/5)=3/5+32/5=35/5=7(3/5) + 4(8/5) = 3/5 + 32/5 = 35/5 = 7

Why it works

From Ax=bA \mathbf{x} = \mathbf{b}, replacing column ii of AA with b\mathbf{b} gives a matrix whose determinant expands as xidetAx_i \det A (the other xkx_k terms vanish because they'd create repeated columns). So det(Ai)=xidet(A)\det(A_i) = x_i \det(A), yielding Cramer's formula.

When to use it

  • Small systems (2×22 \times 2, 3×33 \times 3). Beautiful closed form, easy to verify.
  • Symbolic work with few unknowns where you want a clean expression in terms of the coefficients.
  • Theoretical arguments about how solutions depend on parameters.

Not the fastest computational method for large systems. Gaussian elimination runs in O(n3)O(n^3); Cramer's rule via cofactor expansion is O(n!)O(n!) — exponential. For n4n \ge 4, prefer row reduction or matrix inversion.

When it FAILS

If detA=0\det A = 0, the system is either inconsistent (no solution) or dependent (infinitely many solutions). Cramer's rule doesn't distinguish between these — you need to fall back to row reduction to diagnose which case you're in.

Common mistakes

  • Replacing the wrong column. AiA_i uses column ii, not row ii.
  • Skipping the determinant check. Always confirm detA0\det A \ne 0 first.
  • Wrong sign on cofactor sub-determinants (in 3×33 \times 3 or larger cases).

Try it in the visualization

Slide b\mathbf{b} and watch x,yx, y update as ratios. The three matrices A,A1,A2A, A_1, A_2 are shown side by side, with the replaced columns highlighted in gold.

Interactive Visualization

Parameters

3.00
2.00
1.00
4.00
5.00
7.00
2.00
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day
Cramer's Rule for Solving Linear Systems | MathSpin