Sub topic 14
Putting it together: graphing a rational function
This chapter combines the earlier pieces into one repeatable routine for sketching a rational function from its formula. It assumes you can factor polynomials, simplify and cancel rational expressions, find a function's domain, and find zeros, intercepts, holes and asymptotes. Each step below uses one of those skills.
The routine
Work in this order. Each step uses the factored form of the function.
- Factor the numerator and denominator completely.
- Find the domain. Every real zero of the original denominator is excluded.
- Cancel common factors. Each cancelled factor gives a hole at its zero.
- Using the reduced form, find the vertical asymptotes (zeros of the reduced denominator) and the x-intercepts (zeros of the reduced numerator).
- Find the y-intercept, f(0), if 0 is in the domain.
- Find the horizontal or slant asymptote by comparing degrees.
- Build a sign chart from the zeros and asymptotes, then plot a few extra points.
Worked example
Graph
f(x) = (2x² + 2x − 4) / (x² − x − 6).
Step 1: factor. The numerator is 2(x + 2)(x − 1). The denominator is (x − 3)(x + 2). So
f(x) = 2(x + 2)(x − 1) / ((x − 3)(x + 2)).
Step 2: domain. The denominator is zero at x = 3 and x = −2. The domain is all real numbers except −2 and 3.
Step 3: holes. The factor x + 2 cancels. The reduced form is
g(x) = 2(x − 1) / (x − 3).
The graph of f is the graph of g with a hole at x = −2. Its height is g(−2) = 2(−3)/(−5) = 6/5. The hole is at (−2, 6/5).
Step 4: asymptotes and x-intercepts. The reduced denominator is zero at x = 3, so x = 3 is a vertical asymptote. The reduced numerator is zero at x = 1, so (1, 0) is an x-intercept.
Step 5: y-intercept. f(0) = −4 / −6 = 2/3, so the point is (0, 2/3).
Step 6: end behavior. The degrees are equal (2 and 2). The horizontal asymptote is the ratio of leading coefficients, y = 2/1 = 2.
Step 7: sign chart. Rewrite g as 2 + 4/(x − 3). This is the reduced form divided out, since 2(x − 1) = 2(x − 3) + 4. It shows how g approaches 2: it is below 2 when x < 3 and above 2 when x > 3.
The only places g can change sign are x = 1 (a zero) and x = 3 (an asymptote).
| Interval | Sign of 2(x − 1) | Sign of x − 3 | Sign of g |
|---|---|---|---|
| x < 1 | negative | negative | positive |
| 1 < x < 3 | positive | negative | negative |
| x > 3 | positive | positive | positive |
Near the asymptote, g goes to −∞ as x approaches 3 from the left and to +∞ from the right. On the far left the graph sits just below y = 2 and is positive, so it rises toward 2 from below. On the far right it falls toward 2 from above. The sketch is two branches. The left branch passes through (0, 2/3) and (1, 0) and then dives to −∞ at x = 3. The right branch comes down from +∞ and flattens toward y = 2. The hole at (−2, 6/5) is drawn as an open circle on the left branch.
You can check each piece with a computer algebra system.
from sympy import symbols, fraction, cancel, gcd, solve, limit, oo
x = symbols('x')
f = (2*x**2 + 2*x - 4) / (x**2 - x - 6)
num, den = fraction(f)
common = gcd(num, den) # x + 2
g = cancel(f) # reduced form
rnum, rden = fraction(g)
print("excluded:", solve(den, x)) # [-2, 3]
print("holes at x =", solve(common, x)) # [-2]
print("hole height:", g.subs(x, -2)) # 6/5
print("vertical asymptotes:", solve(rden, x)) # [3]
print("x-intercepts:", solve(rnum, x)) # [1]
print("y-intercept:", f.subs(x, 0)) # 2/3
print("horizontal asymptote:", limit(f, x, oo)) # 2Asymptote rules at a glance
Compare the degree of the numerator (n) with the degree of the denominator (d) in the reduced form.
| Case | End-behavior asymptote |
|---|---|
| n < d | Horizontal, y = 0 |
| n = d | Horizontal, y = ratio of leading coefficients |
| n = d + 1 | Slant, y = quotient from long division |
| n > d + 1 | No line. The graph follows a polynomial curve |
A graph can never cross a vertical asymptote, because the function is undefined there. It can cross a horizontal or slant asymptote at finite x-values. The asymptote describes behavior as x goes to ±∞, not what happens in the middle. To test for a crossing, set f(x) equal to the asymptote's formula and solve. In the example, 2(x − 1)/(x − 3) = 2 has no solution, so the graph never crosses y = 2.
Common errors
- Using the original denominator for asymptotes. A zero that cancels gives a hole, not an asymptote. Use the reduced form for asymptotes and intercepts, and the original form for the domain.
- Forgetting the hole's height. A hole needs a y-coordinate. Substitute its x-value into the reduced form, never into the original.
- Treating an x-intercept as valid without checking the domain. If a zero of the numerator also zeros the denominator, it has cancelled and gives a hole instead.
- Assuming the sign always flips at a vertical asymptote. The sign changes only if the factor has an odd multiplicity. For f(x) = 1/(x − 2)², the graph goes to +∞ on both sides. A factor with an even multiplicity also touches the x-axis instead of crossing it when it appears in the numerator.
- Reading the horizontal asymptote from a non-reduced fraction with unequal degrees. Cancel first, then compare degrees. After cancelling, degrees can change.
Slant asymptote variant
For f(x) = (x² + 1)/(x − 1), the numerator degree is one more than the denominator degree. Long division gives x² + 1 = (x − 1)(x + 1) + 2, so f(x) = x + 1 + 2/(x − 1). The slant asymptote is y = x + 1. There is a vertical asymptote at x = 1, no x-intercept (x² + 1 has no real zeros), and a y-intercept at f(0) = −1. The same seven steps apply. Only step 6 changes.
Exercise
Graph g(x) = (x² − 4) / (x² − 1) using the routine. State the domain, holes, vertical asymptotes, intercepts, horizontal asymptote, and the sign of g on each interval.
Show answer
Factored, g(x) = (x − 2)(x + 2) / ((x − 1)(x + 1)). Nothing cancels, so there are no holes. The domain excludes −1 and 1. The vertical asymptotes are x = −1 and x = 1. The x-intercepts are (−2, 0) and (2, 0). The y-intercept is g(0) = −4/−1 = 4, so (0, 4). The degrees are equal, so the horizontal asymptote is y = 1. The sign is positive for x < −2, negative on (−2, −1), positive on (−1, 1), negative on (1, 2), and positive for x > 2. Unlike the worked example, this graph does cross its horizontal asymptote if g(x) = 1 has a solution, but x² − 4 = x² − 1 gives −4 = −1, so it never crosses y = 1.
Exercise
For h(x) = (x² − 9) / (x − 3), find the domain, hole, intercepts and any asymptotes, and describe the graph in one sentence.
Show answer
Factored, h(x) = (x − 3)(x + 3)/(x − 3). The domain excludes x = 3. The factor x − 3 cancels, so the reduced form is x + 3 and the hole is at (3, 6). The x-intercept is (−3, 0) and the y-intercept is (0, 3). There is no vertical asymptote, and there is no horizontal or slant asymptote other than the line itself. The graph is the line y = x + 3 with an open circle at (3, 6).