Skip to main content
Mathovia

Algebra / Systems of Equations

Cramer's Rule

Cramer's rule solves a system of linear equations with nothing but determinants. Each variable is one determinant divided by another, so there's no substituting or eliminating, and it gives a formula for the whole solution at once. It's quickest for 2 × 2 and 3 × 3 systems.

Practice Problems
Written by
MPhil in Mathematics, Founder of Mathovia
Published

Mathematics verification: Mathematical formulas, calculations, worked examples and solutions are reviewed for accuracy before publication. How we check our work

Most methods for solving a system of equations are step-by-step procedures: isolate, substitute, eliminate, repeat. Cramer’s rule is different. It’s a formula. Write down the coefficients, work out a few determinants, divide, and the solution falls out with no rearranging at all. Gabriel Cramer published it in 1750, and for small systems it’s still one of the tidiest methods there is, particularly when the numbers are awkward and substitution would mean fractions from the first step.

Cramer's rule: x equals D sub x over D, y equals D sub y over D, provided D is not zero
Cramer's rule for a system of two equations

First, Determinants

A determinant is a single number calculated from a square grid of numbers. Cramer’s rule is built entirely from them, so it’s worth getting the 2 × 2 case automatic before anything else:

A 2 × 2 determinant with entries a, b, c, d: the blue diagonal from a to d is the first product and the amber diagonal from b to c is subtracted, giving ad − bc; for the entries 2, 3, 4, −1 this is 2(−1) − 3(4) = −14
Multiply down the main diagonal, then subtract the other diagonal

The vertical bars mean “determinant of”, not absolute value; a determinant can be negative. The order matters too: , never .

Cramer’s Rule for Two Equations

For the system

make three determinants. uses the coefficients. is with the -column replaced by the constants , and is with the -column replaced. Then

as long as .

Example 1: A 2 × 2 System

Solve and .

For 2x + 3y = 13 and 4x − y = 5: D is the determinant of 2, 3, 4, −1, which is −14; Dx replaces the x-column with the constants 13 and 5, giving −28; Dy replaces the y-column with 13 and 5, giving −42; dividing by D gives x = 2 and y = 3
Swap the constants into one column at a time

Step 1 — the coefficient determinant.

Step 2 — replace the -column with the constants.

Step 3 — replace the -column with the constants.

Step 4 — divide.

Check: and . The solution is , the same answer the substitution method or elimination method would give.

Why Cramer’s Rule Works

It isn’t magic; it’s elimination done once, in general, and written compactly. Take and . To eliminate , multiply the first equation by and the second by , then subtract:

The bracket on the left is exactly , and the right side is exactly . Dividing gives . Eliminating instead gives the same way. So every time you use Cramer’s rule, you’re doing elimination without writing out the steps, and the condition is simply the requirement that you never divide by zero at the end.

Cramer’s Rule for Three Equations

The pattern extends to three unknowns: , , , now with 3 × 3 determinants. A 3 × 3 determinant expands along the top row into three 2 × 2 determinants, with alternating signs:

Example 2: A 3 × 3 System

Solve , , .

Step 1 — the coefficient determinant.

Step 2 — the three replaced determinants. Put the constants 6, 3, 2 into each column in turn:

Step 3 — divide by .

That’s four 3 × 3 determinants, which is a fair amount of arithmetic. For systems with three variables, elimination or an augmented matrix is often less work by hand; Cramer’s rule shines when you only need one of the variables, since you can compute just and that variable’s determinant.

When the Determinant Is Zero

If , Cramer’s rule can’t be used, because it would divide by zero. That isn’t a flaw in the method; it’s telling you the system doesn’t have exactly one solution.

Other determinantsWhat the system has
not 0anythingexactly one solution
0at least one not 0no solution (parallel lines)
0all 0usually infinitely many solutions

For example, and give , and . The lines are parallel and never meet. In the three-variable case, “usually” matters: three planes can all have zero determinants and still fail to meet, so check with elimination when everything is zero.

A zero determinant has a geometric meaning too. For two equations, measures how far the two lines are from being parallel: it’s zero exactly when their slopes match. So computing first is a quick test of whether a system has one solution before you do any other work.

Cramer’s Rule vs Other Methods

MethodBest for
Cramer’s rule2 × 2 systems, awkward coefficients, finding a single variable
Substitutiona variable with coefficient 1 or −1
Eliminationmost systems by hand, especially 3 × 3
Augmented matriceslarger systems and calculators

The system of equations calculator can show Cramer’s rule step by step alongside the other methods, which is a quick way to check your determinants.

Common Mistakes to Avoid

  • Replacing the wrong column. replaces the -column, the first one; replaces the second.
  • Computing . The main diagonal comes first: .
  • Forgetting the alternating signs in a 3 × 3 expansion: , , along the top row.
  • Dividing the wrong way. It’s , the variable’s determinant on top.
  • Skipping the standard form. Line every equation up as before reading off coefficients, or the constants end up in the wrong place.
  • Using it when . Stop and classify the system instead.

Practice Problems

Work each one before opening the answer.

Problem 1. Evaluate .

Show answer

Answer:

Problem 2. Evaluate .

Show answer

Answer:

Problem 3. Use Cramer’s rule to solve and .

Show answer

, , .

Answer:

Problem 4. Use Cramer’s rule to solve and .

Show answer

, , .

Answer:

Problem 5. Does , have a unique solution?

Show answer

, so there’s no unique solution. Since , there’s no solution at all: the lines are parallel.

Answer: no, it has no solution

Problem 6. Evaluate .

Show answer

Expand along the top row:

Answer:

Determinants also decide whether a matrix can be inverted, which leads to another way of solving systems: multiplying by the inverse of the coefficient matrix.

Frequently Asked Questions

What is Cramer's rule?+

A formula that solves a square system of linear equations using determinants. For two equations, and , where is the determinant of the coefficients and , are the same determinant with the - or -column replaced by the constants.

How do you find a 2 × 2 determinant?+

Multiply down the main diagonal and subtract the product of the other diagonal: for a grid with top row and bottom row , the determinant is . For example, .

When can't you use Cramer's rule?+

When the determinant of the coefficients is zero. Then the system has either no solution or infinitely many, and Cramer's rule would divide by zero. It also only works for square systems, with as many equations as unknowns.

Is Cramer's rule faster than elimination?+

For 2 × 2 systems it's about the same amount of work, and it's very quick if you're comfortable with determinants. For 3 × 3 it needs four 3 × 3 determinants, which is more arithmetic than elimination. For larger systems, elimination is much faster.

What does it mean if D is zero but Dx is not?+

The system has no solution. The equations describe parallel lines, or parallel planes in three dimensions, which never meet. If D and every other determinant are zero, the system usually has infinitely many solutions instead.

Related lessons

Calculators for this topic