MatrixStep

Guides7 min

Cramer's Rule: Solving Linear Systems with Determinants (2×2 and 3×3 Examples)

Cramer's rule writes down the solution of a linear system using nothing but determinants. For two or three equations it is quick and tidy, which is why it shows up so often on exams. This guide shows how the formula is used and when it cannot be used.

What is Cramer's rule?

For a system Ax = b with as many equations as unknowns, if the determinant det(A) of the coefficient matrix is nonzero, the solution is given by

xⱼ = det(Aⱼ) / det(A)

where Aⱼ is the matrix A with its j-th column replaced by b. In other words, you compute one extra determinant per variable.

Example 1: a 2×2 system

3x + 2y = 7
x − y = 4

First find the determinant of the coefficient matrix. If it is 0, Cramer's rule cannot be used.

321−1det(A) = 3·(−1) − 2·1 = −5

For x, replace the first column by b; for y, replace the second column.

A₁ (column 1 replaced by b) =724−1det = 7·(−1) − 2·4 = −15
A₂ (column 2 replaced by b) =3714det = 3·4 − 7·1 = 5
x = −15 / (−5) = 3y = 5 / (−5) = −1

Check by substituting: 3·3 + 2·(−1) = 7 and 3 − (−1) = 4, so both equations hold.

Example 2: a 3×3 system

2x + y − z = 8
−3x − y + 2z = −11
−2x + y + 2z = −3

The determinant of the coefficient matrix is −1. It is nonzero, so the system has exactly one solution. The determinants of the matrices with each column replaced by b are shown below.

A₁ =81−1−11−12−312det(A₁) = −2
A₂ =28−1−3−112−2−32det(A₂) = −3
A₃ =218−3−1−11−21−3det(A₃) = 1
x = −2 / (−1) = 2y = −3 / (−1) = 3z = 1 / (−1) = −1

The solution is (x, y, z) = (2, 3, −1). Solving the same system by Gauss-Jordan elimination gives the same answer.

When Cramer's rule cannot be used

Why Cramer's rule is rarely used in practice

Solving for n variables requires n + 1 determinants of n×n matrices. Determinants are already expensive, so the work grows quickly as n increases. On exams it is best kept to two or three variables; beyond that, elimination is far faster. If you only need a single variable, however, Cramer's rule can be the better choice.

Common mistakes

FAQ

Does det(A) = 0 mean there is no solution?

No. There may be no solution or infinitely many. You have to row-reduce the augmented matrix with elimination to decide which.

Can Cramer's rule be used to find an inverse?

The inverse formula using the adjugate rests on the same principle as Cramer's rule. It is covered in Inverse by cofactors and the adjugate.

Can I check this with the calculator?

Yes. Enter the coefficients and constants in the linear system solver and you will get the same solution.

Related guides