Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

How to Solve a System with Cramer's Rule

For a square system with det⁡(A)≠0\det(A) \neq 0, each unknown is a fraction: the determinant of AA with that unknown's column replaced by b\mathbf{b}, over det⁡(A)\det(A). No row operations at all.

Recognize the task

A square system, usually 2×22 \times 2 or 3×33 \times 3: 2x+3y=82x + 3y = 8, x−y=−1x - y = -1. Especially useful when only one unknown is wanted, or when the coefficients contain a letter. Test: is the number of equations equal to the number of unknowns, and is det⁡(A)≠0\det(A) \neq 0? If det⁡(A)=0\det(A) = 0, Cramer's rule does not apply.
The rule and its proof are in the lesson section Cramer's Rule.

Steps

StepOn 2x+3y=8, x−y=−12x + 3y = 8,\ x - y = -1
1Write A and b, and compute det(A). Stop if it is 00; use elimination instead.det⁡(231−1)=−2−3=−5\det\begin{pmatrix} 2 & 3 \\ 1 & -1 \end{pmatrix} = -2 - 3 = -5
2Replace column 1 with b and take the determinant. All other columns stay where they are.det⁡(A1)=det⁡(83−1−1)=−8+3=−5\det(A_1) = \det\begin{pmatrix} 8 & 3 \\ -1 & -1 \end{pmatrix} = -8 + 3 = -5
3Do the same for every other unknown you need. For xix_i, replace column ii.det⁡(A2)=det⁡(281−1)=−2−8=−10\det(A_2) = \det\begin{pmatrix} 2 & 8 \\ 1 & -1 \end{pmatrix} = -2 - 8 = -10
4Divide by det(A). Cramer's rule: xi=det⁡(Ai)/det⁡(A)x_i = \det(A_i) / \det(A).x=−5−5=1, y=−10−5=2x = \frac{-5}{-5} = 1,\ y = \frac{-10}{-5} = 2
5Check in the original equations.2+6=82 + 6 = 8 ✓, 1−2=−11 - 2 = -1 ✓

Worked examples

Example 1 · a 2 × 2 system

basic
4x−y=10, x+2y=74x - y = 10,\ x + 2y = 7: det⁡(A)=8+1=9\det(A) = 8 + 1 = 9
det⁡(10−172)=27, det⁡(41017)=18\det\begin{pmatrix} 10 & -1 \\ 7 & 2 \end{pmatrix} = 27,\ \det\begin{pmatrix} 4 & 10 \\ 1 & 7 \end{pmatrix} = 18
replace column 1, then column 2
x=3, y=2x = 3,\ y = 2
divide each by 99

Example 2 · a negative determinant

signs
2x+5y=1, 3x+4y=52x + 5y = 1,\ 3x + 4y = 5: det⁡(A)=8−15=−7\det(A) = 8 - 15 = -7
det⁡(A1)=4−25=−21, det⁡(A2)=10−3=7\det(A_1) = 4 - 25 = -21,\ \det(A_2) = 10 - 3 = 7
x=3, y=−1x = 3,\ y = -1
mind the sign of det⁡(A)\det(A)

Example 3 · a 3 × 3 system, one unknown

only z wanted
x+y+z=6, 2x−y+z=3, x+2y−z=2x + y + z = 6,\ 2x - y + z = 3,\ x + 2y - z = 2
det⁡(A)=det⁡(1112−1112−1)=7\det(A) = \det\begin{pmatrix} 1 & 1 & 1 \\ 2 & -1 & 1 \\ 1 & 2 & -1 \end{pmatrix} = 7
cofactor expansion
det⁡(A3)=det⁡(1162−13122)=21\det(A_3) = \det\begin{pmatrix} 1 & 1 & 6 \\ 2 & -1 & 3 \\ 1 & 2 & 2 \end{pmatrix} = 21
b\mathbf{b} in column 3
z=217=3z = \frac{21}{7} = 3
For 3×33 \times 3 determinants, see cofactor expansion or the rule of Sarrus.

See it happen

Write b=xa1+ya2\mathbf{b} = x\mathbf{a}_1 + y\mathbf{a}_2, where a1,a2\mathbf{a}_1, \mathbf{a}_2 are the columns of AA. Swapping b\mathbf{b} into column 1 gives a parallelogram on b\mathbf{b} and a2\mathbf{a}_2; the ya2y\mathbf{a}_2 part of b\mathbf{b} adds no area, so the area is xx times the area of the parallelogram on a1,a2\mathbf{a}_1, \mathbf{a}_2. The ratio of the two determinants is xx. Try it in the Cramer's rule visualizer.

Common mistakes

Replacing a row instead of a column

✗ det⁡(8−11−1)=−7\det\begin{pmatrix} 8 & -1 \\ 1 & -1 \end{pmatrix} = -7, so x=75x = \frac{7}{5}
✓ replace column 1: det⁡(83−1−1)=−5\det\begin{pmatrix} 8 & 3 \\ -1 & -1 \end{pmatrix} = -5, x=1x = 1

Reversing the 2 × 2 determinant

✗ det⁡(83−1−1)=3⋅(−1)−8⋅(−1)=5\det\begin{pmatrix} 8 & 3 \\ -1 & -1 \end{pmatrix} = 3 \cdot (-1) - 8 \cdot (-1) = 5
✓ main diagonal first: 8⋅(−1)−3⋅(−1)=−58 \cdot (-1) - 3 \cdot (-1) = -5

Using the rule when det(A) = 0

✗ x+y=2, 2x+2y=4x + y = 2,\ 2x + 2y = 4: "x=00x = \frac{0}{0}, no solution"
✓ the rule does not apply; elimination shows infinitely many solutions