Mathwords logoMathwords

Cramer's Rule — Definition, Formula & Examples

Cramer’s Rule

A method for solving a linear system of equations using determinants. Cramer’s rule may only be used when the system is square and the coefficient matrix is invertible.

 

System of three linear equations: x − y + z = 10, x + 2y + 3z = 22, 4x + 5y + 6z = 12
Cramer's Rule solution showing x=−31/12, y=−29/6, z=31/4, each as a ratio of 3×3 determinants with values 10,−1,1,11,2,3,12,5,6.

 

 

See also

Cofactors, expansion by cofactors

Key Formula

xi=det(Ai)det(A)x_i = \frac{\det(A_i)}{\det(A)}
Where:
  • xix_i = The value of the i-th unknown variable in the system
  • AA = The coefficient matrix of the system
  • AiA_i = The matrix formed by replacing the i-th column of A with the constant vector b
  • det\det = The determinant of a matrix

Worked Example

Problem: Solve the system using Cramer's Rule: 2x + 3y = 8 x − 4y = −3
Step 1: Write the coefficient matrix A and compute its determinant.
A=(2314),det(A)=(2)(4)(3)(1)=83=11A = \begin{pmatrix} 2 & 3 \\ 1 & -4 \end{pmatrix}, \quad \det(A) = (2)(-4) - (3)(1) = -8 - 3 = -11
Step 2: Since det(A) = −11 ≠ 0, the system has a unique solution. Form A_x by replacing the first column (the x-coefficients) with the constants (8, −3).
Ax=(8334),det(Ax)=(8)(4)(3)(3)=32+9=23A_x = \begin{pmatrix} 8 & 3 \\ -3 & -4 \end{pmatrix}, \quad \det(A_x) = (8)(-4) - (3)(-3) = -32 + 9 = -23
Step 3: Form A_y by replacing the second column (the y-coefficients) with the constants.
Ay=(2813),det(Ay)=(2)(3)(8)(1)=68=14A_y = \begin{pmatrix} 2 & 8 \\ 1 & -3 \end{pmatrix}, \quad \det(A_y) = (2)(-3) - (8)(1) = -6 - 8 = -14
Step 4: Apply Cramer's Rule to find x and y.
x=det(Ax)det(A)=2311=2311,y=det(Ay)det(A)=1411=1411x = \frac{\det(A_x)}{\det(A)} = \frac{-23}{-11} = \frac{23}{11}, \qquad y = \frac{\det(A_y)}{\det(A)} = \frac{-14}{-11} = \frac{14}{11}
Answer: x = 23/11 and y = 14/11

Another Example

This example extends Cramer's Rule to a 3×3 system, showing how to compute 3×3 determinants by cofactor expansion and how the same replacement process applies to each variable.

Problem: Solve the 3×3 system using Cramer's Rule: x + 2y + z = 9 2x − y + 3z = 8 3x + y − z = 2
Step 1: Write the coefficient matrix A and compute its determinant using expansion by cofactors along the first row.
A = \begin{pmatrix} 1 & 2 & 1 \\ 2 & -1 & 3 \\ 3 & 1 & -1 \end{pmatrix}$$$$\det(A) = 1\bigl((-1)(-1)-(3)(1)\bigr) - 2\bigl((2)(-1)-(3)(3)\bigr) + 1\bigl((2)(1)-(-1)(3)\bigr)$$$$= 1(1-3) - 2(-2-9) + 1(2+3) = -2 + 22 + 5 = 25
Step 2: Form A_x by replacing column 1 with the constants (9, 8, 2) and compute its determinant.
A_x = \begin{pmatrix} 9 & 2 & 1 \\ 8 & -1 & 3 \\ 2 & 1 & -1 \end{pmatrix}$$$$\det(A_x) = 9(1-3) - 2(-8-6) + 1(8+2) = 9(-2) - 2(-14) + 10 = -18 + 28 + 10 = 20
Step 3: Form A_y by replacing column 2 with the constants and compute its determinant.
A_y = \begin{pmatrix} 1 & 9 & 1 \\ 2 & 8 & 3 \\ 3 & 2 & -1 \end{pmatrix}$$$$\det(A_y) = 1(-8-6) - 9(-2-9) + 1(4-24) = -14 + 99 - 20 = 65
Step 4: Form A_z by replacing column 3 with the constants and compute its determinant.
A_z = \begin{pmatrix} 1 & 2 & 9 \\ 2 & -1 & 8 \\ 3 & 1 & 2 \end{pmatrix}$$$$\det(A_z) = 1(-2-8) - 2(4-24) + 9(2+3) = -10 + 40 + 45 = 75
Step 5: Apply Cramer's Rule for each variable.
x=2025=45,y=6525=135,z=7525=3x = \frac{20}{25} = \frac{4}{5}, \quad y = \frac{65}{25} = \frac{13}{5}, \quad z = \frac{75}{25} = 3
Answer: x = 4/5, y = 13/5, z = 3

Frequently Asked Questions

When can you not use Cramer's Rule?
You cannot use Cramer's Rule when the determinant of the coefficient matrix is zero, because division by zero is undefined. A zero determinant means the system either has no solution or infinitely many solutions. The rule also requires the system to be square — the number of equations must equal the number of unknowns.
Is Cramer's Rule efficient for large systems?
For large systems (say, 4×4 or bigger), Cramer's Rule is computationally expensive because it requires calculating many determinants. Methods like Gaussian elimination or matrix factorization are far more efficient in practice. Cramer's Rule is most useful for 2×2 and 3×3 systems or for theoretical purposes.
What is the difference between Cramer's Rule and Gaussian elimination?
Cramer's Rule uses determinants to express each variable as a fraction of two determinants, giving a direct formula for each unknown. Gaussian elimination transforms the system into row-echelon form through row operations and then solves by back-substitution. Gaussian elimination is generally faster and works even when the system is not square.

Cramer's Rule vs. Gaussian Elimination

Cramer's RuleGaussian Elimination
ApproachUses ratios of determinants to find each variable directlyUses row operations to reduce the system, then back-substitutes
RequirementsSystem must be square with det(A) ≠ 0Works on any system (square or non-square, any determinant)
Efficiency (n equations)Requires computing n + 1 determinants; impractical for large nO(n³) operations; efficient for large systems
Best used forSmall systems (2×2, 3×3) or finding one specific variableSystems of any size; standard computational method
OutputExplicit formula for each variableRow-echelon or reduced row-echelon form of the augmented matrix

Why It Matters

Cramer's Rule appears in linear algebra and precalculus courses as a key application of determinants. It gives you a compact, closed-form expression for each variable, which is valuable in proofs and theoretical work — for instance, showing how a solution depends continuously on the system's coefficients. In engineering and physics, the rule is useful for quickly solving small systems that arise in circuit analysis, force equilibrium, and coordinate transformations.

Common Mistakes

Mistake: Replacing the wrong column when forming A_i
Correction: To solve for the i-th variable, you must replace the i-th column of the coefficient matrix with the constant vector b. A common error is replacing column 1 when solving for y. Double-check which variable corresponds to which column.
Mistake: Forgetting to check whether det(A) = 0 before applying the rule
Correction: Always compute det(A) first. If det(A) = 0, the coefficient matrix is not invertible and Cramer's Rule does not apply. The system is either inconsistent (no solution) or dependent (infinitely many solutions), and you need a different method.

Related Terms