Rational Equations
A rational equation has the variable in a denominator, for example . The standard method clears every fraction at once by multiplying both sides by the least common denominator, which leaves a polynomial equation. The catch is that this step can create extraneous solutions, numbers that solve the new equation but make a denominator of the original zero. Checking is not optional here.
The method
- Factor the denominators and note the excluded values (where any denominator is 0).
- Multiply every term on both sides by the LCD (finding the LCD).
- Solve the resulting polynomial equation.
- Reject any solution that is an excluded value; check the rest in the original equation.
A linear example
An example that becomes quadratic
Neither is excluded, and both check: ✓, and ✓. Solving the quadratic used factoring; the quadratic formula works too.
Extraneous solutions
The only candidate makes the denominators zero, so the equation has no solution. Why did it appear? Multiplying both sides by is multiplying by 0 when , and multiplying by 0 makes any equation "true". The new equation has a root the old one never had.
Note: Only multiplying by an expression that can be zero creates extraneous roots. Multiplying by a nonzero number (like the 2 in the first example) never does, but checking is cheap, so always check.
Proportions
An equation of the form can be solved by cross-multiplying, (Proportions), which is the same as multiplying by the LCD :
Both are allowed (only is excluded).
Work and rate problems
If a job takes hours, the rate is of the job per hour, and rates add when people (or machines) work together. A build server A finishes a test suite in 6 minutes alone. With a second server B the two finish in 4 minutes. How long would B take alone?
Solving in Python
SymPy's solve returns only solutions valid in the original equation, so it drops extraneous ones. A small manual loop shows both the candidates and the rejections:
import sympy as sp
x = sp.symbols("x")
eq = sp.Eq(1/x + 1/(x + 2), sp.Rational(5, 12))
print("solve:", sp.solve(eq, x))
bad = sp.Eq(x/(x - 2) + 1, 2/(x - 2))
print("solve:", sp.solve(bad, x))
# by hand: multiply by the LCD, then test every candidate against it
lcd = x - 2
cleared = sp.cancel((bad.lhs - bad.rhs) * lcd)
print("cleared equation:", cleared, "= 0")
for c in sp.solve(cleared, x):
print("candidate", c, "->", "extraneous" if lcd.subs(x, c) == 0 else "valid")solve: [-6/5, 4]
solve: []
cleared equation: 2*x - 4 = 0
candidate 2 -> extraneous
In software
- Throughput. The combined rate of parallel workers is the sum of their rates . Capacity planning ("how many servers to finish the batch in 10 minutes?") is a rational equation.
- Division-by-zero guards. Extraneous roots are the algebra version of a classic bug: a formula is rearranged, the new code returns an answer, and nobody notices that the original formula was undefined at that input. Validate solutions against the original constraint.
- Camera optics. Solving the thin-lens equation for the image distance (used for depth-of-field effects in renderers) is a rational equation; an object placed exactly at the focal length () has no solution, and the code must handle that case.
Exercises
Exercise 1: Linear
Solve .
Answer
Solution
Exercise 2: Cross-multiply
Solve .
Answer
Solution
Exercise 3: Watch for extraneous roots
Solve .
Answer
No solution (the candidate is extraneous).
Solution
Exercise 4: Becomes quadratic
Solve .
Answer
(the candidate is extraneous).
Solution
import sympy as sp
x = sp.symbols("x")
print(sp.solve(sp.Eq(x/(x - 1) - 2/(x + 1), 4/(x**2 - 1)), x))[2]
Exercise 5: Two pipes
One pipe fills a tank in 3 hours; a drain empties it in 5 hours. With both open, how long does the empty tank take to fill? Check with code.
Answer
7.5 hours
Solution
import sympy as sp
t = sp.symbols("t", positive=True)
print(sp.solve(sp.Eq(sp.Rational(1, 3) - sp.Rational(1, 5), 1/t), t))[15/2]
Test yourself
What is an extraneous solution of a rational equation?
- A solution that is irrational
- A candidate that makes a denominator of the original equation zero
- A solution of the LCD
- A negative solution
Solve .
- no solution
Alice paints a fence in 4 h, Bob in 12 h. Together?
- 8 h
- 16 h
- 2 h
- 3 h