Sub topic 13
Two unknowns: setting up and solving systems
What you need first
This chapter assumes you can already do the following:
- Define a variable with a meaning and units.
- Translate word phrases into expressions.
- Solve a linear equation in one variable, including parentheses and variables on both sides.
- Work with percents as decimals.
Everything here builds on that routine. The new part is that two quantities are unknown at once, so one equation is no longer enough.
Why one variable sometimes isn't enough
Some problems give you two unknown quantities and two separate facts about them. For example:
> A theater sold 10 tickets. Adult tickets cost $8 and child tickets cost $5. The total was $62. How many of each were sold?
Two facts are stated. The tickets add up to 10, and the money adds up to $62. Each fact is its own equation. A set of equations that must all be true at the same time is a system of equations. A solution is a pair of values that makes every equation true together.
You can sometimes avoid a system by writing one unknown in terms of the other, as the earlier chapters did with 10 - a. That substitution is already a hidden use of the first fact. A system makes it explicit. This is easier to check, and it still works when no clean one-variable shortcut is obvious.
Setting up a system
Follow the same routine as before, with two changes.
- Define two variables, each with a meaning and units. Write them down, for example
a= number of adult tickets,c= number of child tickets. - Find two independent relationships in the wording. Each relationship becomes one equation.
- Solve the system by substitution or elimination.
- Check the pair against the original words, not only against your equations.
Two relationships are independent when neither one is just a restatement of the other. "The total is 10" and "twice the total is 20" give you only one fact.
For the ticket problem, the system is:
- Count:
a + c = 10 - Money:
8a + 5c = 62
Notice that each equation is about one kind of quantity. The first adds up tickets. The second adds up dollars. Mixing the two kinds, such as a + c = 62, is a common setup error.
Method 1: substitution
Substitution means solving one equation for one variable, then replacing that variable in the other equation.
From a + c = 10, get c = 10 - a. Replace c in the money equation:
8a + 5(10 - a) = 62
8a + 50 - 5a = 62
3a + 50 = 62
3a = 12
a = 4Then c = 10 - 4 = 6. This is exactly the one-variable equation from the earlier chapters. Substitution reduces a system to something you already know how to solve.
Use substitution when one equation already has a variable with coefficient 1 or -1, because isolating it creates no fractions.
Method 2: elimination
Elimination means combining the equations so one variable cancels. You can add or subtract equations, and you can multiply an entire equation by a nonzero number first. Multiplying both sides keeps the equation true.
For the tickets, multiply the count equation by 5 so the c terms match:
5a + 5c = 50
8a + 5c = 62Subtract the first from the second:
3a = 12
a = 4Substitute back into either original equation: 4 + c = 10, so c = 6.
Use elimination when both equations have the same form (x term, y term, constant) and the coefficients are easy to match. It is also less likely to produce messy fractions than substitution.
| Situation | Better method |
|---|---|
| One equation reads `y = ...` or `x = ...` | Substitution |
| A variable has coefficient 1 or -1 | Substitution |
| Both equations are written as `ax + by = c` | Elimination |
| Coefficients are equal or opposite | Elimination, with no multiplying needed |
Either method gives the same answer. Pick the one that gives you less arithmetic.
Checking against the words
Substitute into both original statements, in words:
- Tickets: 4 adult + 6 child = 10 tickets. ✓
- Money: 4 × $8 + 6 × $5 = $32 + $30 = $62. ✓
Checking only one equation is not enough. A pair that satisfies one equation and fails the other is not a solution. Also test reasonableness: ticket counts must be whole numbers and not negative. A result such as a = 4.5 or a = -2 means you made an error in the setup or the algebra.
A second example: a boat and a current
> A boat travels 24 km downstream in 2 hours and returns the 24 km upstream in 3 hours. Find the boat's speed in still water and the speed of the current.
Define b = boat speed in still water (km/h) and c = current speed (km/h). Downstream, the current helps, so the speed is b + c. Upstream, it hurts, so the speed is b - c. Use distance = rate × time:
- Downstream:
2(b + c) = 24, sob + c = 12 - Upstream:
3(b - c) = 24, sob - c = 8
The c terms have opposite signs, so add the equations:
2b = 20
b = 10Then 10 + c = 12 gives c = 2. Check: downstream speed is 12 km/h and 12 × 2 = 24 km. Upstream speed is 8 km/h and 8 × 3 = 24 km. ✓
The answer is a boat speed of 10 km/h and a current of 2 km/h.
A third example: mixtures
> How many liters of a 20% acid solution and a 50% acid solution make 12 liters of a 30% solution?
Define x = liters of the 20% solution and y = liters of the 50% solution. One equation tracks volume and the other tracks pure acid:
- Volume:
x + y = 12 - Acid:
0.2x + 0.5y = 0.3(12) = 3.6
Multiply the acid equation by 10 to clear decimals: 2x + 5y = 36. Substitute x = 12 - y:
2(12 - y) + 5y = 36
24 + 3y = 36
y = 4So x = 8. Check the acid: 0.2(8) + 0.5(4) = 1.6 + 2 = 3.6 liters, which is 30% of 12. ✓
Solving and verifying with code
For any system a1·x + b1·y = c1 and a2·x + b2·y = c2, a short function can solve it exactly. The quantity det = a1·b2 - a2·b1 is zero exactly when the two equations do not pin down a single pair. Using Fraction avoids rounding errors.
from fractions import Fraction
def solve_2x2(a1, b1, c1, a2, b2, c2):
"""Solve a1*x + b1*y = c1 and a2*x + b2*y = c2 exactly."""
det = a1 * b2 - a2 * b1
if det == 0:
raise ValueError("no single solution: lines are parallel or identical")
x = Fraction(c1 * b2 - c2 * b1, det)
y = Fraction(a1 * c2 - a2 * c1, det)
return x, y
# Tickets: a + c = 10 and 8a + 5c = 62
a, c = solve_2x2(1, 1, 10, 8, 5, 62)
print(a, c) # 4 6
print(a + c == 10 and 8 * a + 5 * c == 62) # True
# Boat: b + c = 12 and b - c = 8
b, current = solve_2x2(1, 1, 12, 1, -1, 8)
print(b, current) # 10 2
# Mixture: x + y = 12 and 2x + 5y = 36
x, y = solve_2x2(1, 1, 12, 2, 5, 36)
print(x, y) # 8 4The code is a checking tool. In your own work, you still need to define the variables and write the equations from the words. That is the part the program cannot do for you.
When there is no single answer
Some systems do not have exactly one solution.
- No solution.
x + y = 4and2x + 2y = 10. Subtract twice the first equation from the second and you get0 = 2, which is false. The facts contradict each other. In a word problem, this means the data are inconsistent or you mis-set an equation. - Infinitely many solutions.
x + y = 4and2x + 2y = 8. Subtracting gives0 = 0, which is always true. The second equation repeats the first, so you really have only one fact and the problem is underdetermined.
When elimination makes both variables vanish, look at what remains. A false statement means no solution. A true statement means infinitely many.
Common errors in two-variable problems
- Using the same letter for two things. If
xmeans both "adults" and "dollars", the equations will contradict each other. - Adding unlike quantities. An equation must keep the same units on each side. Tickets plus dollars makes no sense.
- Subtracting only part of an equation. In elimination, subtract every term, including the constant and the signs of negative terms.
8a + 5c - (5a + 5c)leaves3a, not3a + 10c. - Multiplying only one side. If you scale an equation, scale both sides.
- Checking only one equation. Verify the pair in both, and in the original words.
Practice
Exercise
A jar holds 15 coins, all dimes and quarters, worth $2.55 in total. How many dimes and how many quarters are there? Define variables, write two equations, solve, and check.
Show answer
Let d = number of dimes and q = number of quarters. Count: d + q = 15. Value in cents: 10d + 25q = 255. Substitute d = 15 - q: 10(15 - q) + 25q = 255, so 150 + 15q = 255, so q = 7. Then d = 8. Check: 8 + 7 = 15 coins, and 8(10) + 7(25) = 80 + 175 = 255 cents = $2.55. There are 8 dimes and 7 quarters.
Exercise
A student writes the system x + y = 6 and 3x + 3y = 20 for a word problem and eliminates x by subtracting 3 times the first equation from the second. What result does this give, and what does it say about the problem?
Show answer
Three times the first equation is 3x + 3y = 18. Subtracting it from 3x + 3y = 20 gives 0 = 2, which is false. The system has no solution, so the two facts contradict each other. The student should reread the problem and look for a mistake in the setup or the numbers.