Sub topic 8
Solving by elimination
This chapter assumes you can solve one-variable linear equations, work with negative numbers and fractions, and check an ordered pair by substituting it into an equation. You should also know what a system of two linear equations is and what its solution means. Here you will learn elimination: combine the two equations so that one variable disappears, solve for the other, then recover the first.
The idea behind elimination
A system such as 2x + y = 7 and x - y = 2 asks for one pair (x, y) that makes both equations true. Each equation has two unknowns, so neither can be solved alone. Elimination builds a new equation with only one unknown by adding or subtracting the two equations.
This is valid because of a basic fact about equations. If A = B and C = D, then A + C = B + D. Adding two true equations gives another true equation. Any pair (x, y) that satisfies both original equations must therefore satisfy their sum.
The method also does not lose information. If you keep one original equation and the sum, you can recover the other original equation by subtracting. The new system has exactly the same solutions as the old one. Multiplying both sides of an equation by a nonzero number also keeps its solutions. Scaling and adding are the only two moves elimination uses.
The procedure
- Write both equations in standard form, Ax + By = C, with the variables lined up in columns.
- Pick a variable to eliminate. Choose the one whose coefficients are already opposites or are easiest to match.
- Multiply one or both equations by nonzero numbers so that the chosen variable has opposite coefficients. If the coefficients are equal instead, you can subtract.
- Add the equations. The chosen variable cancels.
- Solve the resulting one-variable equation.
- Substitute that value into either original equation and solve for the other variable.
- Check the pair in both original equations.
Case 1: coefficients are already opposites
Take the system 2x + y = 7 and x - y = 2. The y terms are +y and -y, so adding the equations eliminates y at once.
System: 2x + y = 7
x - y = 2
Add the equations (the y terms cancel):
3x = 9 -> x = 3
Substitute x = 3 into x - y = 2:
3 - y = 2 -> y = 1
Check: 2(3) + 1 = 7 and 3 - 1 = 2. Solution: (3, 1)The solution is the single point (3, 1) where the two lines cross. You could have substituted x = 3 into either original equation. Pick the one with the simpler arithmetic.
Case 2: you must scale one equation
Sometimes one equation is a multiple of the other's coefficients. In 3x + 2y = 12 and x - 2y = 0, adding already works. Consider instead 2x + 3y = 8 and x + y = 3. No variable cancels as written, but multiplying the second equation by -2 gives -2x - 2y = -6. Adding it to the first equation gives y = 2. Then x = 3 - 2 = 1.
Only one equation needed scaling here, because the x coefficients (2 and 1) have a simple relationship. When one coefficient divides the other, scale the one equation. Otherwise scale both.
Case 3: you must scale both equations
For 2x + 3y = 13 and 5x - 2y = 4, no single multiplier matches the coefficients. Aim for the least common multiple of the coefficients in one column. The y coefficients are 3 and -2, and their least common multiple is 6. Multiply the first equation by 2 and the second by 3.
System: 2x + 3y = 13
5x - 2y = 4
Multiply the first equation by 2 and the second by 3:
4x + 6y = 26
15x - 6y = 12
Add:
19x = 38 -> x = 2
Substitute into 2x + 3y = 13:
4 + 3y = 13 -> y = 3
Check: 5(2) - 2(3) = 4. Solution: (2, 3)You could eliminate x instead by multiplying by 5 and 2. That leads to coefficients 10 and 10 and requires subtraction. It reaches the same answer, with more room for sign mistakes.
Subtracting instead of adding
When the coefficients of a variable are equal, not opposite, you can subtract one equation from the other. Take 4x + 3y = 5 and 6x + 5y = 9. To eliminate x, multiply the first by 3 and the second by 2:
12x + 9y = 15
12x + 10y = 18
Subtract the first from the second:
(12x - 12x) + (10y - 9y) = 18 - 15
y = 3
Substitute into 4x + 3y = 5:
4x + 9 = 5 -> x = -1
Check: 6(-1) + 5(3) = -6 + 15 = 9. Solution: (-1, 3)Subtraction is equivalent to multiplying one equation by -1 and then adding. Many learners find the add-only version safer. If you prefer it, multiply one equation by the negative of the multiplier you would otherwise use, so that opposite coefficients appear and you can always add.
Answers that are not whole numbers
Elimination often produces fractions. Consider x + 2y = 4 and 3x + 2y = 5. The y coefficients are equal. Subtracting the first equation from the second gives 2x = 1, so x = 1/2. Substituting into the first equation gives 1/2 + 2y = 4, so 2y = 7/2 and y = 7/4. Check in the other equation: 3(1/2) + 2(7/4) = 3/2 + 7/2 = 5. The solution is (1/2, 7/4).
A fractional answer is not a sign of error. If you are unsure, check it in both original equations. Using the original equations is important, because a mistake in your scaled copies would otherwise go unnoticed.
When both variables cancel
Sometimes adding or subtracting eliminates both variables together. What remains is a statement with no variables, and it tells you what kind of system you have.
No solution (parallel lines):
y = 2x + 1
y = 2x - 3
Setting the right sides equal: 2x + 1 = 2x - 3 -> 1 = -3, which is false.
Infinitely many solutions (same line):
x + y = 3
2x + 2y = 6
The second equation is 2 times the first. Eliminating gives 0 = 0, which is always true.- A false statement such as 1 = -3 means the lines are parallel and distinct. No pair satisfies both equations.
- A true statement such as 0 = 0 means the equations describe the same line. Every point on the line is a solution.
Do not report "x = 0" or "no answer" just because a variable vanished. Read the leftover statement. The false and always-true cases are covered in more detail in the next chapter.
Common errors
| Error | Example | Fix |
|---|---|---|
| Multiplying only part of an equation | Turning 2x + 3y = 13 into 4x + 3y = 26 | Multiply every term on both sides, including the constant |
| Sign error when subtracting | 10y - 9y read as 10y + 9y, or 18 - 15 written as 18 + 15 | Write the subtraction with parentheses, or add the negative of the equation |
| Adding when coefficients are equal | Adding 12x and 12x gives 24x, so x is not eliminated | Subtract, or scale one equation by -1 first |
| Stopping after one variable | Reporting x = 2 as the answer | Substitute back and state the full ordered pair |
| Checking only one equation | A wrong y can still satisfy the equation you used for substitution | Check both original equations |
| Variables not aligned | Leaving 3x = 12 - 2y without rearranging | Rewrite as 3x + 2y = 12 before combining |
Choosing which variable to eliminate
Both variables can be eliminated, and both routes give the same solution. Use these rules of thumb:
- Prefer a variable that already has opposite coefficients, as in Case 1.
- Otherwise prefer the variable with the smaller least common multiple of coefficients. For 2x + 3y = 13 and 5x - 2y = 4, x gives 10 and y gives 6, so eliminate y.
- Prefer a variable where one coefficient is 1 or -1, because scaling then touches only one equation.
Checking your work with code
You can verify hand-worked answers with a short program that applies elimination to the general system a1x + b1y = c1 and a2x + b2y = c2. Multiplying the first equation by b2 and the second by b1, then subtracting, eliminates y. Doing the same for x gives the matching formula for y. The shared coefficient (a1b2 - a2b1) is zero exactly when the lines are parallel or identical.
from fractions import Fraction
def eliminate(a1, b1, c1, a2, b2, c2):
"""Solve a1*x + b1*y = c1 and a2*x + b2*y = c2 by elimination.
Returns ("unique", x, y), ("none",), or ("infinite",).
Assumes each equation has at least one nonzero coefficient.
"""
# Multiply eq1 by b2 and eq2 by b1, then subtract: y cancels.
coeff_x = a1 * b2 - a2 * b1
rhs_x = c1 * b2 - c2 * b1
# Multiply eq1 by a2 and eq2 by a1, then subtract: x cancels.
coeff_y = b1 * a2 - b2 * a1
rhs_y = c1 * a2 - c2 * a1
if coeff_x == 0:
# Both variables cancel; the leftover statements decide the case.
if rhs_x == 0 and rhs_y == 0:
return ("infinite",) # leftover is 0 = 0
return ("none",) # leftover is false, like 0 = 4
x = Fraction(rhs_x, coeff_x)
y = Fraction(rhs_y, coeff_y)
return ("unique", x, y)
print(eliminate(2, 3, 13, 5, -2, 4)) # ('unique', Fraction(2, 1), Fraction(3, 1))
print(eliminate(4, 3, 5, 6, 5, 9)) # ('unique', Fraction(-1, 1), Fraction(3, 1))
print(eliminate(1, 2, 4, 3, 2, 5)) # ('unique', Fraction(1, 2), Fraction(7, 4))
print(eliminate(-2, 1, 1, -2, 1, -3)) # ('none',)
print(eliminate(1, 1, 3, 2, 2, 6)) # ('infinite',)Each line prints the result shown in its comment. The first three match the worked examples above. The last two match the parallel and same-line systems, after rewriting y = 2x + 1 and y = 2x - 3 as -2x + y = 1 and -2x + y = -3. The use of Fraction keeps answers exact, so 7/4 does not turn into 1.75 with rounding error.
Summary
Elimination converts a two-variable problem into a one-variable problem by adding scaled copies of the equations. The key steps are to align the equations in standard form, make one variable's coefficients opposites, add, solve, substitute back, and check in both original equations. If both variables vanish, a false leftover means no solution and a true leftover means infinitely many.
Exercise
Solve by elimination and check your answer: 3x + 2y = 16 and 5x - 4y = 6.
Show answer
The y coefficients are 2 and -4, so multiply the first equation by 2 to get 6x + 4y = 32. Add it to the second equation: 11x = 38 is wrong to expect, so recompute: 6x + 5x = 11x and 32 + 6 = 38, giving x = 38/11. Substituting gives y = (16 - 3(38/11))/2 = (176/11 - 114/11)/2 = 31/11. Check in the second equation: 5(38/11) - 4(31/11) = 190/11 - 124/11 = 66/11 = 6. Check in the first: 3(38/11) + 2(31/11) = 114/11 + 62/11 = 176/11 = 16. The solution is (38/11, 31/11).
Exercise
Use elimination on 2x - 6y = 4 and -x + 3y = -2. What does the result tell you about the system?
Show answer
Multiply the second equation by 2 to get -2x + 6y = -4. Adding it to the first equation gives 0 = 0, which is always true. Both variables cancelled and the leftover statement is true, so the equations describe the same line and the system has infinitely many solutions.
Exercise
A student solves 2x + 3y = 13 and 5x - 2y = 4 by multiplying the first equation by 2 and the second by 3, but writes the first result as 4x + 3y = 26. What went wrong, and what happens to the final answer?
Show answer
The student multiplied only the 2x term and the constant, and skipped the 3y term. The correct result is 4x + 6y = 26. With 4x + 3y = 26, adding to 15x - 6y = 12 does not cancel y, so the elimination fails. The y terms become -3y, not zero, and the equation cannot be solved for x alone. Always multiply every term on both sides.