Tutorials › Linear Algebra › Two-Variable Systems with Cramer’s Rule

Cramer's Rule, Adjugate and Volume · Tutorial 258 of 1000

Two-Variable Systems with Cramer's Rule

Use three exact determinant calculations to solve a two-variable system when its coefficient determinant is nonzero, and recognize why the rule does not give a unique solution when it is zero.

Intermediate 9 min read

What You'll Learn

  • Write a two-variable system as a coefficient matrix and a right-hand-side column.
  • Compute the coefficient determinant and the two column-replacement determinants.
  • Apply Cramer’s rule when the coefficient determinant is nonzero.
  • Verify a computed solution by substituting it into both equations.
  • Distinguish singular systems with infinitely many solutions from those with no solution.

Three Determinants for Two Unknowns

A two-variable linear system asks for values of \(x\) and \(y\) that satisfy two equations at once. When the coefficient matrix has a nonzero determinant, Cramer’s rule gives each unknown using a determinant in the denominator and a determinant formed by replacing one coefficient column with the right-hand side. The method is compact, but the column order and the condition on the denominator matter: if that determinant is zero, the formulas do not give a unique solution.

Write a system over \(\mathbb{R}\) as

$$ \begin{aligned} ax+by&=e,\\ cx+dy&=f. \end{aligned} $$

Its coefficient matrix is \(\mathbf{A}=\begin{bmatrix}a&b\\c&d\end{bmatrix}\), and its right-hand-side column is \(\begin{bmatrix}e\\f\end{bmatrix}\). The determinant of a \(2\times2\) matrix \(\begin{bmatrix}r&s\\t&u\end{bmatrix}\) is \(ru-st\). For the coefficient matrix, this gives \(ad-bc\).

Definition: For the system above, define the coefficient determinant and the two column-replacement determinants by $$ \Delta=\det\begin{bmatrix}a&b\\c&d\end{bmatrix}=ad-bc,\qquad \Delta_x=\det\begin{bmatrix}e&b\\f&d\end{bmatrix}=ed-bf,\qquad \Delta_y=\det\begin{bmatrix}a&e\\c&f\end{bmatrix}=af-ec. $$ The matrix for \(\Delta_x\) replaces the first coefficient column with the right-hand side; the matrix for \(\Delta_y\) replaces the second coefficient column.

The order of entries follows the columns: the first column contains the coefficients of \(x\), and the second contains the coefficients of \(y\). In \(\Delta_x\), the right-hand side goes in the first column; in \(\Delta_y\), it goes in the second. Reversing a column changes the sign of a \(2\times2\) determinant, so keeping that order is essential.

Why the Quotient Formulas Work

Theorem (Cramer’s rule for two variables): If \(\Delta\ne0\), the system has exactly one solution, given by $$ x=\frac{\Delta_x}{\Delta},\qquad y=\frac{\Delta_y}{\Delta}. $$

Proof. First derive equations that any solution must satisfy. Multiply \(ax+by=e\) by \(d\), multiply \(cx+dy=f\) by \(b\), and subtract the second resulting equation from the first. The \(y\)-terms cancel, leaving $$ (ad-bc)x=ed-bf, $$ so \(\Delta x=\Delta_x\). Next, multiply \(cx+dy=f\) by \(a\), multiply \(ax+by=e\) by \(c\), and subtract the second resulting equation from the first. The \(x\)-terms cancel, leaving $$ (ad-bc)y=af-ec, $$ so \(\Delta y=\Delta_y\). If \(\Delta\ne0\), division gives the displayed formulas, and these equations show that any solution must have those values.

It remains to verify that the values do satisfy both original equations. Using the definitions, $$ a\Delta_x+b\Delta_y =a(ed-bf)+b(af-ec) =ead-abf+abf-bec =e(ad-bc)=e\Delta, $$ and $$ c\Delta_x+d\Delta_y =c(ed-bf)+d(af-ec) =ced-cbf+adf-cde =f(ad-bc)=f\Delta. $$ Therefore, for \(x=\Delta_x/\Delta\) and \(y=\Delta_y/\Delta\), the left sides of the original equations are \(e\) and \(f\), respectively. Existence is verified, and the earlier derivation shows that any solution must equal these values. Thus the solution is unique. \(\square\)

The theorem gives a precise condition for using the quotient formulas: the coefficient determinant must be nonzero. Each determinant in a numerator is computed directly from its displayed matrix; it is not obtained by replacing a row or by changing the order of the equations.

Solving a System Step by Step

Worked Example: A Unique Solution with Positive Fractions

Solve the system $$ \begin{aligned} 2x+3y&=8,\\ x-y&=1. \end{aligned} $$

The coefficient matrix and right-hand side are \(\begin{bmatrix}2&3\\1&-1\end{bmatrix}\) and \(\begin{bmatrix}8\\1\end{bmatrix}\). Compute the coefficient determinant: $$ \Delta=2(-1)-3(1)=-2-3=-5. $$ Since \(-5\ne0\), Cramer’s rule applies. Replacing the first column gives $$ \Delta_x=\det\begin{bmatrix}8&3\\1&-1\end{bmatrix} =8(-1)-3(1)=-8-3=-11. $$ Replacing the second column gives $$ \Delta_y=\det\begin{bmatrix}2&8\\1&1\end{bmatrix} =2(1)-8(1)=2-8=-6. $$ Therefore $$ x=\frac{-11}{-5}=\frac{11}{5},\qquad y=\frac{-6}{-5}=\frac{6}{5}. $$

Check: Substitution into the first equation gives \(2(11/5)+3(6/5)=22/5+18/5=40/5=8\). Substitution into the second gives \(11/5-6/5=5/5=1\). Both equations hold.

Worked Example: A System with Negative Coefficients

Solve $$ \begin{aligned} 3x-2y&=7,\\ 5x+y&=1. \end{aligned} $$

Here \(\mathbf{A}=\begin{bmatrix}3&-2\\5&1\end{bmatrix}\) and the right-hand side is \(\begin{bmatrix}7\\1\end{bmatrix}\). The coefficient determinant is $$ \Delta=3(1)-(-2)(5)=3+10=13. $$ It is nonzero. The replacement determinants are $$ \Delta_x=\det\begin{bmatrix}7&-2\\1&1\end{bmatrix} =7(1)-(-2)(1)=7+2=9 $$ and $$ \Delta_y=\det\begin{bmatrix}3&7\\5&1\end{bmatrix} =3(1)-7(5)=3-35=-32. $$ Thus \(x=9/13\) and \(y=-32/13\).

Check: In the first equation, \(3(9/13)-2(-32/13)=27/13+64/13=91/13=7\). In the second, \(5(9/13)+(-32/13)=45/13-32/13=13/13=1\). The values satisfy both equations.

What Happens When the Coefficient Determinant Is Zero?

If \(\Delta=0\), the quotients in Cramer’s rule are undefined. This does not by itself tell us whether the system has no solution or many solutions. The following result describes the possibilities for any two-variable system over \(\mathbb{R}\).

Theorem: If \(\Delta=0\), then the system has either no solutions or infinitely many solutions; it cannot have exactly one solution.

Proof. Regard a pair \((u,v)\) as a column of two numbers. We show that when \(\Delta=0\), there is a nonzero column \(\mathbf{z}\) for which \(\mathbf{A}\mathbf{z}=\mathbf{0}\). If the first coefficient row \((a,b)\) is nonzero, choose \(\mathbf{z}=\begin{bmatrix}-b\\a\end{bmatrix}\). This column is nonzero, and $$ \mathbf{A}\mathbf{z} =\begin{bmatrix}-ab+ab\\-bc+ad\end{bmatrix} =\begin{bmatrix}0\\\Delta\end{bmatrix} =\mathbf{0}. $$ If the first row is zero but the second row \((c,d)\) is nonzero, choose \(\mathbf{z}=\begin{bmatrix}-d\\c\end{bmatrix}\). It is nonzero, and both rows of \(\mathbf{A}\mathbf{z}\) are zero. If both rows are zero, \(\mathbf{z}=\begin{bmatrix}1\\0\end{bmatrix}\) is a nonzero column with \(\mathbf{A}\mathbf{z}=\mathbf{0}\).

If the system has a solution \(\mathbf{u}\), then for every real number \(t\), $$ \mathbf{A}(\mathbf{u}+t\mathbf{z}) =\mathbf{A}\mathbf{u}+t\mathbf{A}\mathbf{z} =\begin{bmatrix}e\\f\end{bmatrix}. $$ Because \(\mathbf{z}\ne\mathbf{0}\), distinct values of \(t\) give distinct solutions, so there are infinitely many. If the system has no solution, it has zero solutions. These cases exhaust the possibilities, proving that there cannot be exactly one solution. \(\square\)

Worked Example: A Singular System with Infinitely Many Solutions

Consider $$ \begin{aligned} 2x+4y&=6,\\ x+2y&=3. \end{aligned} $$

The coefficient determinant is $$ \Delta=2(2)-4(1)=4-4=0. $$ The replacement determinants are $$ \Delta_x=\det\begin{bmatrix}6&4\\3&2\end{bmatrix} =6(2)-4(3)=12-12=0 $$ and $$ \Delta_y=\det\begin{bmatrix}2&6\\1&3\end{bmatrix} =2(3)-6(1)=6-6=0. $$ The quotients would be \(0/0\), which is undefined, so Cramer’s rule does not produce values for \(x\) and \(y\). Instead, the first equation is twice the second. Let \(y=t\), where \(t\) is any real number. The second equation then gives \(x=3-2t\).

Check: With \(x=3-2t\) and \(y=t\), the first left side is \(2(3-2t)+4t=6-4t+4t=6\), and the second is \(3-2t+2t=3\). Every real \(t\) gives a solution, so there are infinitely many.

Worked Example: A Singular System with No Solution

Now consider $$ \begin{aligned} 2x+4y&=6,\\ x+2y&=4. \end{aligned} $$

The coefficient determinant is again $$ \Delta=2(2)-4(1)=4-4=0. $$ The replacement determinants are $$ \Delta_x=\det\begin{bmatrix}6&4\\4&2\end{bmatrix} =6(2)-4(4)=12-16=-4 $$ and $$ \Delta_y=\det\begin{bmatrix}2&6\\1&4\end{bmatrix} =2(4)-6(1)=8-6=2. $$ The quotients are undefined because their common denominator is zero. To determine whether a solution exists, double the second equation: it becomes \(2x+4y=8\), whereas the first equation requires \(2x+4y=6\). These cannot both hold.

Check: Subtracting the doubled second equation from the first would require \(0=6-8=-2\), a contradiction. Thus this system has no solution.

Common Mistake: Reversing a Replacement Determinant

A frequent sign error is to calculate the determinant for \(y\) in the wrong order. In the first worked example, the correct replacement matrix is \(\begin{bmatrix}2&8\\1&1\end{bmatrix}\), so \(\Delta_y=2(1)-8(1)=-6\). A mistaken reversal gives \(8(1)-2(1)=6\), producing the incorrect value \(y=6/(-5)=-6/5\). Keeping the replacement column in the second position fixes the sign.

Correction check: Combining the mistaken \(y=-6/5\) with the correct \(x=11/5\) gives \(2(11/5)+3(-6/5)=22/5-18/5=4/5\), not \(8\). The error is caught by substituting into the original equations. Checking both equations is part of solving the system, not an optional extra.

A Reliable Checklist

1
Write the coefficient matrix.
Place the \(x\)-coefficients in the first column and the \(y\)-coefficients in the second. Keep the right-hand side as its own column.
2
Compute \(\Delta\).
Use \(ad-bc\) for \(\begin{bmatrix}a&b\\c&d\end{bmatrix}\). If \(\Delta=0\), stop: the quotient formulas do not apply.
3
Replace one column at a time.
Use the right-hand side in the first column for \(\Delta_x\), and in the second column for \(\Delta_y\).
4
Divide and verify.
When \(\Delta\ne0\), calculate \(x=\Delta_x/\Delta\) and \(y=\Delta_y/\Delta\), then substitute both values into both equations.

Cramer’s rule is especially transparent for two variables because each numerator and denominator is a single \(2\times2\) determinant. Its condition is just as important as its formulas: a nonzero coefficient determinant guarantees exactly one solution, while a zero determinant means the quotient method cannot decide the system by division. In the singular case, checking the equations themselves distinguishes inconsistency from infinitely many solutions.

Check Your Understanding

For each calculation, keep the replacement-column order explicit and use substitution to check any proposed solution.

  1. For \(x+2y=5\) and \(3x-y=4\), compute \(\Delta\), \(\Delta_x\), and \(\Delta_y\), then solve by Cramer’s rule.
  2. For \(2x-y=1\) and \(4x-2y=2\), compute all three determinants and describe the solution set.
  3. For \(x+3y=2\) and \(2x+6y=5\), explain why the system has no solution.
  4. State the condition under which the two Cramer quotient formulas give the unique solution.
  5. In a system with \(\Delta=0\), why can a solution not be unique?

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon