College Algebra

Cramer's Rule

Last updated: March 2026 · Advanced
Before you start

You should be comfortable with:

Real-world applications
Electrical

Voltage drop, wire sizing, load balancing

Cramer’s Rule is a method for solving systems of linear equations using determinants. Instead of performing row operations or finding an inverse matrix, you compute several determinants and take their ratios. The formula gives each variable directly — no back-substitution needed.

Cramer’s Rule is named after Swiss mathematician Gabriel Cramer, who published it in 1750. While it is not the most efficient method for large systems, it is elegant, self-contained, and particularly useful for systems of 2 or 3 equations where you need only one of the variables.

Cramer’s Rule for 2x2 Systems

Consider the system:

a1x+b1y=c1a_1 x + b_1 y = c_1

a2x+b2y=c2a_2 x + b_2 y = c_2

The coefficient matrix is A=[a1b1a2b2]A = \begin{bmatrix} a_1 & b_1 \\ a_2 & b_2 \end{bmatrix} with determinant D=a1b1a2b2D = \begin{vmatrix} a_1 & b_1 \\ a_2 & b_2 \end{vmatrix}.

Cramer’s Rule states:

x=DxD,y=DyDx = \frac{D_x}{D}, \quad y = \frac{D_y}{D}

where:

  • D=det(A)D = \det(A) — the determinant of the coefficient matrix
  • DxD_x — replace the xx-column (first column) of AA with the constants: Dx=c1b1c2b2D_x = \begin{vmatrix} c_1 & b_1 \\ c_2 & b_2 \end{vmatrix}
  • DyD_y — replace the yy-column (second column) of AA with the constants: Dy=a1c1a2c2D_y = \begin{vmatrix} a_1 & c_1 \\ a_2 & c_2 \end{vmatrix}

Memory aid: To find a variable, replace its column in the coefficient matrix with the constants column, compute the determinant, and divide by the original determinant DD.

Example 1: Cramer’s Rule for a 2x2 System

Solve:

3x+2y=163x + 2y = 16

xy=2x - y = 2

Step 1 — Compute DD (determinant of the coefficient matrix):

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

Since D=50D = -5 \neq 0, the system has a unique solution and Cramer’s Rule applies.

Step 2 — Compute DxD_x (replace the xx-column with the constants):

Dx=16221=16(1)2(2)=164=20D_x = \begin{vmatrix} 16 & 2 \\ 2 & -1 \end{vmatrix} = 16(-1) - 2(2) = -16 - 4 = -20

Step 3 — Compute DyD_y (replace the yy-column with the constants):

Dy=31612=3(2)16(1)=616=10D_y = \begin{vmatrix} 3 & 16 \\ 1 & 2 \end{vmatrix} = 3(2) - 16(1) = 6 - 16 = -10

Step 4 — Divide:

x=DxD=205=4,y=DyD=105=2x = \frac{D_x}{D} = \frac{-20}{-5} = 4, \quad y = \frac{D_y}{D} = \frac{-10}{-5} = 2

Answer: x=4x = 4, y=2y = 2

Verification: 3(4)+2(2)=12+4=163(4) + 2(2) = 12 + 4 = 16 and 42=24 - 2 = 2.

Example 2: Another 2x2 System

Solve:

2x+5y=12x + 5y = 1

3x+7y=23x + 7y = 2

Compute the determinants:

D=2537=1415=1D = \begin{vmatrix} 2 & 5 \\ 3 & 7 \end{vmatrix} = 14 - 15 = -1

Dx=1527=710=3D_x = \begin{vmatrix} 1 & 5 \\ 2 & 7 \end{vmatrix} = 7 - 10 = -3

Dy=2132=43=1D_y = \begin{vmatrix} 2 & 1 \\ 3 & 2 \end{vmatrix} = 4 - 3 = 1

x=31=3,y=11=1x = \frac{-3}{-1} = 3, \quad y = \frac{1}{-1} = -1

Answer: x=3x = 3, y=1y = -1

Verification: 2(3)+5(1)=65=12(3) + 5(-1) = 6 - 5 = 1 and 3(3)+7(1)=97=23(3) + 7(-1) = 9 - 7 = 2.

Cramer’s Rule for 3x3 Systems

For a system of three equations in three unknowns:

a1x+b1y+c1z=d1a_1 x + b_1 y + c_1 z = d_1

a2x+b2y+c2z=d2a_2 x + b_2 y + c_2 z = d_2

a3x+b3y+c3z=d3a_3 x + b_3 y + c_3 z = d_3

Cramer’s Rule states:

x=DxD,y=DyD,z=DzDx = \frac{D_x}{D}, \quad y = \frac{D_y}{D}, \quad z = \frac{D_z}{D}

where:

  • DD is the determinant of the 3×33 \times 3 coefficient matrix
  • DxD_x replaces the first column with the constants [d1,d2,d3]T[d_1, d_2, d_3]^T
  • DyD_y replaces the second column with the constants
  • DzD_z replaces the third column with the constants

Example 3: Cramer’s Rule for a 3x3 System

Solve:

x+y+z=6x + y + z = 6

2xy+z=32x - y + z = 3

x+2yz=5x + 2y - z = 5

Step 1 — Compute DD:

D=111211121D = \begin{vmatrix} 1 & 1 & 1 \\ 2 & -1 & 1 \\ 1 & 2 & -1 \end{vmatrix}

Expand along the first row:

D=1(12)1(21)+1(4+1)=1+3+5=7D = 1(1 - 2) - 1(-2 - 1) + 1(4 + 1) = -1 + 3 + 5 = 7

Step 2 — Compute DxD_x (replace column 1 with constants):

Dx=611311521D_x = \begin{vmatrix} 6 & 1 & 1 \\ 3 & -1 & 1 \\ 5 & 2 & -1 \end{vmatrix}

Dx=6(12)1(35)+1(6+5)=6(1)1(8)+1(11)=6+8+11=13D_x = 6(1 - 2) - 1(-3 - 5) + 1(6 + 5) = 6(-1) - 1(-8) + 1(11) = -6 + 8 + 11 = 13

Step 3 — Compute DyD_y (replace column 2 with constants):

Dy=161231151D_y = \begin{vmatrix} 1 & 6 & 1 \\ 2 & 3 & 1 \\ 1 & 5 & -1 \end{vmatrix}

Dy=1(35)6(21)+1(103)=8+18+7=17D_y = 1(-3 - 5) - 6(-2 - 1) + 1(10 - 3) = -8 + 18 + 7 = 17

Step 4 — Compute DzD_z (replace column 3 with constants):

Dz=116213125D_z = \begin{vmatrix} 1 & 1 & 6 \\ 2 & -1 & 3 \\ 1 & 2 & 5 \end{vmatrix}

Dz=1(56)1(103)+6(4+1)=117+30=12D_z = 1(-5 - 6) - 1(10 - 3) + 6(4 + 1) = -11 - 7 + 30 = 12

Step 5 — Divide:

x=137,y=177,z=127x = \frac{13}{7}, \quad y = \frac{17}{7}, \quad z = \frac{12}{7}

Answer: x=137x = \frac{13}{7}, y=177y = \frac{17}{7}, z=127z = \frac{12}{7}

Verification: 137+177+127=427=6\frac{13}{7} + \frac{17}{7} + \frac{12}{7} = \frac{42}{7} = 6. The other equations can be verified similarly.

Notice this is the same system from the Gaussian elimination lesson — both methods produce the same answer.

When Cramer’s Rule Fails

Cramer’s Rule requires D0D \neq 0. When D=0D = 0:

  • The system is either inconsistent (no solution) or dependent (infinitely many solutions)
  • Cramer’s Rule cannot distinguish between these two cases — it simply fails
  • You must use Gaussian elimination to determine which case applies

Example 4: D=0D = 0 — Cramer’s Rule Does Not Apply

Solve:

x+2y=3x + 2y = 3

2x+4y=62x + 4y = 6

D=1224=44=0D = \begin{vmatrix} 1 & 2 \\ 2 & 4 \end{vmatrix} = 4 - 4 = 0

Cramer’s Rule fails. To determine why, note that the second equation is exactly twice the first — the system is dependent with infinitely many solutions. But if the second equation were 2x+4y=72x + 4y = 7 instead, DD would still be 0, yet the system would be inconsistent (no solution). Cramer’s Rule cannot tell you which.

Comparison to Other Methods

MethodBest ForDrawbacks
Gaussian eliminationAny system, any sizeMore steps for small systems
Matrix inverse (X=A1BX = A^{-1}B)Multiple systems with same AAMust compute full inverse first
Cramer’s RuleSmall systems (2x2, 3x3); finding one variableInefficient for large systems; fails when D=0D = 0

When to choose Cramer’s Rule:

  • The system is 2×22 \times 2 or 3×33 \times 3 and you want a direct formula
  • You only need the value of one variable (compute just DD and that variable’s determinant)
  • You are on a timed test and want to avoid row operations

When NOT to use Cramer’s Rule:

  • The system has 4 or more variables (the number of determinants grows rapidly)
  • D=0D = 0 (the method fails entirely)
  • You need to solve many systems with the same coefficient matrix (the inverse method is faster)

Real-World Application: Electrical Circuit with Three Loops

An electrician analyzing a three-loop circuit writes Kirchhoff’s voltage equations:

5I12I2=105I_1 - 2I_2 = 10

2I1+8I23I3=0-2I_1 + 8I_2 - 3I_3 = 0

3I2+6I3=5-3I_2 + 6I_3 = -5

To find the current I1I_1 without solving the entire system, compute only DD and DI1D_{I_1}:

D=520283036D = \begin{vmatrix} 5 & -2 & 0 \\ -2 & 8 & -3 \\ 0 & -3 & 6 \end{vmatrix}

Expanding along the first row (taking advantage of the zero in position (1,3)(1,3)):

D=5(489)(2)(120)+0=5(39)+(2)(12)=19524=171D = 5(48 - 9) - (-2)(-12 - 0) + 0 = 5(39) + (-2)(12) = 195 - 24 = 171

DI1=1020083536D_{I_1} = \begin{vmatrix} 10 & -2 & 0 \\ 0 & 8 & -3 \\ -5 & -3 & 6 \end{vmatrix}

DI1=10(489)(2)(015)+0=10(39)+2(15)=39030=360D_{I_1} = 10(48 - 9) - (-2)(0 - 15) + 0 = 10(39) + 2(-15) = 390 - 30 = 360

I1=360171=40192.11 ampsI_1 = \frac{360}{171} = \frac{40}{19} \approx 2.11 \text{ amps}

The electrician found I1I_1 without ever computing I2I_2 or I3I_3. This is the key advantage of Cramer’s Rule — targeted answers.

Common Mistakes

  1. Replacing the wrong column. To find xx, replace the first column (the xx-coefficients) with the constants. To find yy, replace the second column. Replacing the wrong column gives the wrong variable’s value.
  2. Forgetting to check D0D \neq 0. Always compute the main determinant DD first. If D=0D = 0, stop — Cramer’s Rule does not apply.
  3. Sign errors in 3x3 determinants. Each cofactor expansion involves a sign from the checkerboard pattern. One wrong sign propagates through the entire calculation.
  4. Using Cramer’s Rule for large systems. A 4×44 \times 4 system requires five 4×44 \times 4 determinants. A 5×55 \times 5 system requires six 5×55 \times 5 determinants. The work grows factorially — use Gaussian elimination instead.

Practice Problems

Problem 1: Solve using Cramer’s Rule: 4x+y=94x + y = 9, x3y=1x - 3y = -1.

D=4113=121=13D = \begin{vmatrix} 4 & 1 \\ 1 & -3 \end{vmatrix} = -12 - 1 = -13

Dx=9113=27(1)=27+1=26D_x = \begin{vmatrix} 9 & 1 \\ -1 & -3 \end{vmatrix} = -27 - (-1) = -27 + 1 = -26

Dy=4911=49=13D_y = \begin{vmatrix} 4 & 9 \\ 1 & -1 \end{vmatrix} = -4 - 9 = -13

x=2613=2,y=1313=1x = \frac{-26}{-13} = 2, \quad y = \frac{-13}{-13} = 1

Answer: x=2x = 2, y=1y = 1

Verification: 4(2)+1=94(2) + 1 = 9 and 23(1)=12 - 3(1) = -1.

Problem 2: Use Cramer’s Rule to find only yy in: 5x2y=75x - 2y = 7, 3x+y=83x + y = 8.

D=5231=5+6=11D = \begin{vmatrix} 5 & -2 \\ 3 & 1 \end{vmatrix} = 5 + 6 = 11

Dy=5738=4021=19D_y = \begin{vmatrix} 5 & 7 \\ 3 & 8 \end{vmatrix} = 40 - 21 = 19

y=DyD=1911y = \frac{D_y}{D} = \frac{19}{11}

Answer: y=1911y = \frac{19}{11}

Problem 3: Solve using Cramer’s Rule: x+y+z=4x + y + z = 4, xy+2z=5x - y + 2z = 5, 2x+yz=12x + y - z = 1.

D=111112211D = \begin{vmatrix} 1 & 1 & 1 \\ 1 & -1 & 2 \\ 2 & 1 & -1 \end{vmatrix}

D=1(12)1(14)+1(1+2)=1+5+3=7D = 1(1 - 2) - 1(-1 - 4) + 1(1 + 2) = -1 + 5 + 3 = 7

Dx=411512111=4(12)1(52)+1(5+1)=4+7+6=9D_x = \begin{vmatrix} 4 & 1 & 1 \\ 5 & -1 & 2 \\ 1 & 1 & -1 \end{vmatrix} = 4(1-2) - 1(-5-2) + 1(5+1) = -4 + 7 + 6 = 9

Dy=141152211=1(52)4(14)+1(110)=7+209=4D_y = \begin{vmatrix} 1 & 4 & 1 \\ 1 & 5 & 2 \\ 2 & 1 & -1 \end{vmatrix} = 1(-5-2) - 4(-1-4) + 1(1-10) = -7 + 20 - 9 = 4

Dz=114115211=1(15)1(110)+4(1+2)=6+9+12=15D_z = \begin{vmatrix} 1 & 1 & 4 \\ 1 & -1 & 5 \\ 2 & 1 & 1 \end{vmatrix} = 1(-1-5) - 1(1-10) + 4(1+2) = -6 + 9 + 12 = 15

x=97,y=47,z=157x = \frac{9}{7}, \quad y = \frac{4}{7}, \quad z = \frac{15}{7}

Answer: x=97x = \frac{9}{7}, y=47y = \frac{4}{7}, z=157z = \frac{15}{7}

Verification: 97+47+157=287=4\frac{9}{7} + \frac{4}{7} + \frac{15}{7} = \frac{28}{7} = 4.

Problem 4: The system 2x+4y=62x + 4y = 6, x+2y=3x + 2y = 3 has D=0D = 0. Can you determine whether it is inconsistent or dependent?

Cramer’s Rule cannot determine this. However, notice that the first equation is exactly twice the second: 2(x+2y)=2(3)=62(x + 2y) = 2(3) = 6. The equations are identical, so the system is dependent with infinitely many solutions: x=32tx = 3 - 2t, y=ty = t for any real number tt.

To distinguish inconsistent from dependent when D=0D = 0, use Gaussian elimination.

Problem 5: An electrician needs only I2I_2 from the system 3I1+I2=73I_1 + I_2 = 7, I12I2=0I_1 - 2I_2 = 0. Find I2I_2 using Cramer’s Rule.

D=3112=61=7D = \begin{vmatrix} 3 & 1 \\ 1 & -2 \end{vmatrix} = -6 - 1 = -7

DI2=3710=07=7D_{I_2} = \begin{vmatrix} 3 & 7 \\ 1 & 0 \end{vmatrix} = 0 - 7 = -7

I2=77=1 ampI_2 = \frac{-7}{-7} = 1 \text{ amp}

Answer: I2=1I_2 = 1 amp

Key Takeaways

  • Cramer’s Rule solves a system by computing determinants: each variable equals the ratio of a modified determinant to the original determinant DD
  • To find a specific variable, replace that variable’s column in the coefficient matrix with the constants column, compute the determinant, and divide by DD
  • Cramer’s Rule works only when D0D \neq 0 — when D=0D = 0, it fails and cannot distinguish between inconsistent and dependent systems
  • It is most practical for 2x2 and 3x3 systems and particularly useful when you need only one variable
  • For larger systems, Gaussian elimination or the inverse method is more efficient
  • Always compute DD first — if it is zero, switch to another method

Return to College Algebra for more topics in this section.

Last updated: March 29, 2026