Type to search, in English or Thai

  1. Home
  2. Articles
  3. Vectors & Linear Algebra
  4. Cramer's rule

// Article · Linear algebra

Cramer's Rule: How to Use It, Why It Works, and When Not to Use It

Cramer's rule gives a direct formula for each unknown of a linear system — no row reduction and no inverse. It is perfect for exam questions that ask for a single unknown, but it has limits you must know. This article collects how to use it, where it comes from, the special cases and its practical range in one place.

By Ajarn ModUpdated
The 30-second summary
  • xi=ΔiΔx_i = \dfrac{\Delta_i}{\Delta}, where Δ=det⁡A\Delta = \det A and Δi\Delta_i is the determinant of AA with column ii replaced by the constants b\mathbf b
  • Valid when AA is square and Δ≠0\Delta \ne 0 · one unknown needs only two determinants
  • For systems larger than 3×3, or in software, use Gaussian elimination or LU instead

The rule in one sentence

Compute the determinant Δ\Delta of the coefficient matrix, put the right-hand constants in place of the column of the unknown you want, compute the new determinant Δi\Delta_i, and divide.

Δ = det A321−1= −5Δₓ72−1−1= −5Δᵧ371−1= −10system: 3x + 2y = 7, x − y = −1x = Δₓ/Δ = 1 · y = Δᵧ/Δ = 2
A 2×2 example: replacing the first column by b\mathbf b gives Δx\Delta_x; replacing the second gives Δy\Delta_y.
3x+2y=7x−y=−1⇒Δ=∣321−1∣=−5,x=∣72−1−1∣−5=−5−5=1,y=∣371−1∣−5=−10−5=2\begin{aligned} 3x + 2y &= 7 \\ x - y &= -1 \end{aligned} \quad\Rightarrow\quad \Delta = \begin{vmatrix} 3 & 2 \\ 1 & -1 \end{vmatrix} = -5,\quad x = \frac{\begin{vmatrix} 7 & 2 \\ -1 & -1 \end{vmatrix}}{-5} = \frac{-5}{-5} = 1,\quad y = \frac{\begin{vmatrix} 3 & 7 \\ 1 & -1 \end{vmatrix}}{-5} = \frac{-10}{-5} = 2

3×3 systems: solve only for what is asked

Example

Find yy from 2x+y−z=3, x+3y+2z=14, 3x−y+z=22x + y - z = 3,\ x + 3y + 2z = 14,\ 3x - y + z = 2

  1. Δ=∣21−11323−11∣=2(3+2)−1(1−6)+(−1)(−1−9)=25\Delta = \begin{vmatrix} 2 & 1 & -1 \\ 1 & 3 & 2 \\ 3 & -1 & 1 \end{vmatrix} = 2(3 + 2) - 1(1 - 6) + (-1)(-1 - 9) = 25
  2. Δy=∣23−11142321∣=2(14−4)−3(1−6)+(−1)(2−42)=75\Delta_y = \begin{vmatrix} 2 & 3 & -1 \\ 1 & 14 & 2 \\ 3 & 2 & 1 \end{vmatrix} = 2(14 - 4) - 3(1 - 6) + (-1)(2 - 42) = 75

y=75/25=3y = 75/25 = 3 — no need to find xx and zz at all

All three unknowns of a 3×3 system need four determinants. Always check by substituting back, or use the step-by-step Cramer calculator (in Thai).

Why the rule works (a two-line proof)

Let XiX_i be the identity matrix with column ii replaced by the solution vector x\mathbf x. Multiplying by AA, column ii becomes Ax=bA\mathbf x = \mathbf b while the other columns stay those of AA, so AXi=AiAX_i = A_i. Now use det⁡(AB)=det⁡Adet⁡B\det(AB) = \det A\det B:

det⁡A⋅det⁡Xi=det⁡Ai,det⁡Xi=xi ⇒ xi=det⁡Aidet⁡A\det A\cdot\det X_i = \det A_i,\qquad \det X_i = x_i \ \Rightarrow\ x_i = \frac{\det A_i}{\det A}

Seen another way, Cramer's rule is x=A−1b=adj⁡A bdet⁡A\mathbf x = A^{-1}\mathbf b = \dfrac{\operatorname{adj}A\,\mathbf b}{\det A} written one unknown at a time, so it always agrees with the inverse method.

When Δ = 0, and parameter-k problems

If Δ=0\Delta = 0 the formula fails, and the system has either no solution or infinitely many. A favourite exam example:

kx+y=1x+ky=1Δ=k2−1,Δx=Δy=k−1\begin{aligned} kx + y &= 1 \\ x + ky &= 1 \end{aligned}\qquad \Delta = k^2 - 1,\quad \Delta_x = \Delta_y = k - 1
  • k≠±1k \ne \pm1: x=y=1k+1x = y = \dfrac{1}{k + 1}
  • k=1k = 1: Δ=Δx=Δy=0\Delta = \Delta_x = \Delta_y = 0; both equations are the same line → infinitely many solutions
  • k=−1k = -1: Δ=0\Delta = 0 but Δx=−2≠0\Delta_x = -2 \ne 0 → parallel lines → no solution
Trap Never cancel the factor (k−1)(k - 1) before checking k=1k = 1. And for 3×3 systems, even if Δ\Delta and every Δi\Delta_i are zero the system can still have no solution — use rank to decide (in Thai).

When to use it, and when not to

Use it forAvoid it for
2–3 unknowns by hand4 or more unknowns
A single unknown, e.g. one mesh currentΔ=0\Delta = 0 or very close to zero
Symbolic coefficients (RR, kk, ss) when you want a general formulaDifferent numbers of equations and unknowns
2×2 AC circuits with complex impedancesSoftware that needs speed and numerical accuracy

Cost is the main reason. With determinants by cofactor expansion, Cramer's rule needs about (n+1)!(n + 1)! multiplications, so a 20-unknown system needs about 5×10195\times10^{19} of them (roughly 1,600 years at a billion per second), while Gaussian elimination needs about n3/3≈2,700n^3/3 \approx 2{,}700. Details are in numerical solution of linear systems (in Thai).

Continue in the library (in Thai)

Frequently asked questions

When can Cramer's rule be used?

When the number of equations equals the number of unknowns (a square coefficient matrix) and the determinant of the coefficient matrix is non-zero. If Δ = 0 the system has either no solution or infinitely many, and row reduction is needed to tell which.

Why is Cramer's rule fast in exams?

If the question asks for only one unknown you need just two determinants, Δ and the determinant for that unknown, instead of solving for everything or inverting the whole matrix. It is ideal for 2–3 unknowns by hand.

Why don't computer programs use Cramer's rule?

The cost explodes. With cofactor expansion a 20-unknown system needs about 5 × 10¹⁹ multiplications, while Gaussian elimination needs about 2,700, and Gaussian elimination with partial pivoting is also more stable numerically.

Can Cramer's rule be used for AC circuits?

Yes. It uses only addition, subtraction, multiplication and division, so it works directly with complex impedances, and also with the Laplace variable s, where Δ(s) = 0 is the characteristic equation of the circuit.

All 7 articles in Vectors & Linear Algebra → · All articles