DeterminantsTopic #20 of 30

Cramer's Rule

Solving linear systems using determinants, applications and limitations.

Overview

Cramer's Rule provides an explicit formula for solving systems of linear equations using determinants. While computationally intensive for large systems, it's useful for theoretical purposes and small systems.

Prerequisites

  • The system must be square (nn equations, nn unknowns)
  • The coefficient matrix AA must be invertible (det(A)0\det(A) \neq 0)

The Formula

For the system Ax=bA\mathbf{x} = \mathbf{b} where AA is n×nn \times n:

xi=det(Ai)det(A)x_i = \frac{\det(A_i)}{\det(A)}

where AiA_i is AA with column ii replaced by b\mathbf{b}.

2×2 System

For:

a1x+b1y=c1a_1 x + b_1 y = c_1 a2x+b2y=c2a_2 x + b_2 y = c_2

Solutions:

x=c1b1c2b2a1b1a2b2,y=a1c1a2c2a1b1a2b2x = \frac{\begin{vmatrix} c_1 & b_1 \\ c_2 & b_2 \end{vmatrix}}{\begin{vmatrix} a_1 & b_1 \\ a_2 & b_2 \end{vmatrix}}, \qquad y = \frac{\begin{vmatrix} a_1 & c_1 \\ a_2 & c_2 \end{vmatrix}}{\begin{vmatrix} a_1 & b_1 \\ a_2 & b_2 \end{vmatrix}}

Example: 2×2 System

Solve:

3x+2y=73x + 2y = 7 xy=1x - y = 1

Step 1: Calculate det(A)\det(A)

det(A)=3211=3(1)2(1)=5\det(A) = \begin{vmatrix} 3 & 2 \\ 1 & -1 \end{vmatrix} = 3(-1) - 2(1) = -5

Step 2: Calculate det(A1)\det(A_1) - replace column 1 with b\mathbf{b}

det(A1)=7211=7(1)2(1)=9\det(A_1) = \begin{vmatrix} 7 & 2 \\ 1 & -1 \end{vmatrix} = 7(-1) - 2(1) = -9

Step 3: Calculate det(A2)\det(A_2) - replace column 2 with b\mathbf{b}

det(A2)=3711=3(1)7(1)=4\det(A_2) = \begin{vmatrix} 3 & 7 \\ 1 & 1 \end{vmatrix} = 3(1) - 7(1) = -4

Step 4: Apply Cramer's Rule

x=det(A1)det(A)=95=95=1.8x = \frac{\det(A_1)}{\det(A)} = \frac{-9}{-5} = \frac{9}{5} = 1.8

y=det(A2)det(A)=45=45=0.8y = \frac{\det(A_2)}{\det(A)} = \frac{-4}{-5} = \frac{4}{5} = 0.8

3×3 System

For three unknowns xx, yy, zz:

x=det(Ax)det(A),y=det(Ay)det(A),z=det(Az)det(A)x = \frac{\det(A_x)}{\det(A)}, \quad y = \frac{\det(A_y)}{\det(A)}, \quad z = \frac{\det(A_z)}{\det(A)}

where AxA_x, AyA_y, AzA_z have the xx, yy, zz columns replaced by b\mathbf{b}.

Example: 3×3 System

Solve:

x+2y+z=4x + 2y + z = 4 2x+y+z=52x + y + z = 5 x+y+2z=6x + y + 2z = 6

A=[121211112],b=[456]A = \begin{bmatrix} 1 & 2 & 1 \\ 2 & 1 & 1 \\ 1 & 1 & 2 \end{bmatrix}, \quad \mathbf{b} = \begin{bmatrix} 4 \\ 5 \\ 6 \end{bmatrix}

det(A)=1(1×21×1)2(2×21×1)+1(2×11×1)\det(A) = 1(1 \times 2 - 1 \times 1) - 2(2 \times 2 - 1 \times 1) + 1(2 \times 1 - 1 \times 1) =1(1)2(3)+1(1)=16+1=4= 1(1) - 2(3) + 1(1) = 1 - 6 + 1 = -4

(After calculating all modified determinants)

x=1x = 1, y=1y = 1, z=2z = 2

Advantages

  • Gives explicit formula for each variable
  • Useful for parametric solutions (variables in terms of parameters)
  • Good for theoretical analysis
  • Easy to compute for 2×22 \times 2 and 3×33 \times 3 systems

Limitations

  • Only works for square systems with unique solutions
  • Computationally expensive for large nn (requires n+1n+1 determinants)
  • Each determinant computation is O(n!)O(n!)
  • Not numerically stable for large systems

Comparison with Other Methods

MethodBetter For
Cramer's RuleSmall systems, symbolic computation
Gaussian EliminationGeneral systems, numerical computation
Matrix InverseMultiple systems with same AA
LU DecompositionLarge systems, repeated solving

When to Use

Use Cramer's Rule when:

  • System is small (2×22 \times 2 or 3×33 \times 3)
  • Need explicit formula for solution
  • Solving symbolically (parameters in coefficients)
  • Theoretical derivations

Avoid when:

  • System is large (n>4n > 4)
  • Need numerical efficiency
  • System may be singular or nearly singular