Sub topic 2
What a Rational Expression Is and Which Values Are Excluded
This chapter assumes you can factor polynomials (common factors, difference of squares, trinomials), solve linear and quadratic equations, and use function notation. Later chapters on simplifying, graphing and asymptotes all depend on one habit from this chapter: read the excluded values off the original denominator, before you change anything.
Definition
A rational expression is a ratio of two polynomials, written P/Q, where Q is not the zero polynomial. The name comes from "ratio," as in rational numbers.
These are rational expressions:
- (x + 1)/(x − 4)
- (x² − 9)/(x² − 5x + 6)
- 3/(y² + 4)
- x² + 2x. Its denominator is the polynomial 1, so every polynomial is a rational expression.
These are not:
- 1/√x, because √x is not a polynomial.
- 2ˣ/(x + 1), because 2ˣ is not a polynomial.
- (x + 1)/|x|, because |x| is not a polynomial.
A rational expression can contain more than one variable, such as (a + b)/(a − b). This tutorial mostly uses one variable.
Why some values are excluded
Division by zero is undefined. A rational expression P/Q gives a number only when Q is not zero, so any value that makes Q equal zero is an excluded value. The domain is every real number except the excluded values.
The numerator has no effect on the domain. If P(x) = 0 at some x, the expression is simply 0 there, as long as Q(x) ≠ 0.
Finding excluded values
Set the denominator equal to zero and solve. The method has three steps:
- Take the denominator of the expression as originally written.
- Factor it if it is not already factored.
- Set each factor equal to zero and solve.
Take (x² − 9)/(x² − 5x + 6). Factor the denominator: x² − 5x + 6 = (x − 2)(x − 3). Setting each factor to zero gives x = 2 and x = 3. The domain is all real numbers except 2 and 3. In interval notation, that is (−∞, 2) ∪ (2, 3) ∪ (3, ∞).
Checking with SymPy
SymPy is a Python library for algebra. You can use it to confirm a hand calculation. The function fraction splits an expression into numerator and denominator, and solveset with the real numbers as the domain returns only real solutions.
from sympy import symbols, fraction, solveset, S
x = symbols('x')
expr = (x**2 - 9) / (x**2 - 5*x + 6)
num, den = fraction(expr)
print(solveset(den, x, domain=S.Reals)) # {2, 3}Denominators with no real zeros
Some denominators are never zero for real x. For 3/(x² + 4), the denominator satisfies x² + 4 ≥ 4, so it cannot be zero. Nothing is excluded, and the domain is all real numbers.
from sympy import symbols, fraction, solveset, S
x = symbols('x')
expr = (x + 1) / (x**2 + 4)
num, den = fraction(expr)
print(solveset(den, x, domain=S.Reals)) # the empty set: nothing is excludedOver the complex numbers, x² + 4 does have zeros, at ±2i. In this tutorial the domain means real numbers, so those zeros do not matter.
Excluded values come from the original expression
This is the most common error in the whole topic. Compare these two expressions:
- (x² − 9)/(x² − 5x + 6)
- (x + 3)/(x − 2)
After factoring, the first becomes (x − 3)(x + 3) / ((x − 2)(x − 3)). Cancelling the common factor (x − 3) gives the second. The two agree at every x except x = 3, where the first is undefined and the second equals 6.
from sympy import symbols, cancel
x = symbols('x')
original = (x**2 - 9) / (x**2 - 5*x + 6)
simplified = cancel(original)
print(simplified) # (x + 3)/(x - 2)
print(original.subs(x, 3)) # nan: 0/0 is undefined
print(simplified.subs(x, 3)) # 6If you read the excluded values from the simplified form, you find only x = 2 and miss x = 3. The rule is to record the excluded values from the original denominator first, and then simplify. When you write the simplified expression as an equality, state the restriction:
(x² − 9)/(x² − 5x + 6) = (x + 3)/(x − 2), for x ≠ 2 and x ≠ 3.
Cases that need care
Factors with a coefficient. For 1/(2x − 5), set 2x − 5 = 0 and solve to get x = 5/2. You solve for x. You do not read off the number in the factor.
Repeated factors. For 1/(x − 1)², the only excluded value is x = 1. A repeated factor gives the same value once.
Constants in the denominator. For (x + 1)/7, the denominator is never zero, so nothing is excluded.
Variable expressions that look like they might vanish. For 1/(x² − 4x + 4), factoring gives (x − 2)², so the excluded value is x = 2. Factoring first catches this. Plugging in a few numbers would not.
A denominator that factors over the reals but not over the integers. For 1/(x² − 2), the zeros are x = ±√2. Integer factoring does not find them, so use the quadratic formula or solveset.
Nested denominators. If a denominator contains a fraction, such as 1/(1 + 1/x), then x ≠ 0 is excluded, and so is every value that makes the whole denominator zero. Here 1 + 1/x = 0 gives x = −1. Chapter on complex fractions covers this in detail.
Summary table
| Expression | Denominator factored | Excluded values |
|---|---|---|
| 5/(x − 4) | x − 4 | 4 |
| x/(x² − 1) | (x − 1)(x + 1) | −1, 1 |
| 3/(x² + 9) | x² + 9 (no real zeros) | none |
| (x + 2)/(x(x − 5)²) | x(x − 5)² | 0, 5 |
| 1/(2x + 6) | 2(x + 3) | −3 |
Why this matters later
Each excluded value will turn out to be one of two things on a graph. If a factor stays in the denominator after simplifying, its zero gives a vertical asymptote. If a factor cancels, its zero gives a hole. You cannot tell which without the original list of excluded values. The same list also protects you when you solve rational equations, because a solution that lands on an excluded value is extraneous and must be discarded.
Exercise
Find all excluded values of (x² − 1)/(x³ − 4x), and write the domain in interval notation. Then say which excluded values would be missed if you simplified first and read the denominator afterward.
Show answer
Factor the denominator: x³ − 4x = x(x² − 4) = x(x − 2)(x + 2). The excluded values are x = 0, x = 2 and x = −2. The domain is (−∞, −2) ∪ (−2, 0) ∪ (0, 2) ∪ (2, ∞). The numerator x² − 1 = (x − 1)(x + 1) shares no factor with the denominator, so nothing cancels and no values would be missed in this case. The numerator's zeros, x = ±1, are not excluded. At those values the expression equals 0.
Exercise
The expression (x² − 4x + 3)/(x² − 1) simplifies to (x − 3)/(x + 1). What are the excluded values of the original expression, and why is it wrong to say only x = −1 is excluded?
Show answer
Factor both parts: the numerator is (x − 1)(x − 3) and the denominator is (x − 1)(x + 1). The original denominator is zero at x = 1 and x = −1, so both are excluded. The factor (x − 1) cancels, which hides x = 1 in the simplified form, but the original expression is still undefined at x = 1. The correct statement is that the two forms are equal for x ≠ 1 and x ≠ −1.