How to graph a rational function
A rational function is one polynomial divided by another. To graph it, find what it can’t do first, the holes and asymptotes, then plot intercepts and a few points in each region it is split into.
The method
- Factor the top and bottom.
- Find holes: a factor that cancels leaves a hole at that x.
- Find vertical asymptotes: where the reduced bottom is zero.
- Find the horizontal or slant asymptote by comparing degrees.
- Find intercepts: the top equals zero for x-intercepts, and x = 0 for the y-intercept.
- Test a point in each region between vertical asymptotes, to see if the graph is above or below the axis.
- Sketch a smooth curve in each region, following the asymptotes.
A worked example
Graph f(x) = (x² − x − 2)/(x² − 1).
- Factor: (x − 2)(x + 1) / ((x − 1)(x + 1)).
- Hole: x + 1 cancels. The reduced form is (x − 2)/(x − 1), which at x = −1 gives 3/2, so there is a hole at (−1, 3/2).
- Vertical asymptote: x = 1.
- Horizontal asymptote: the degrees match, and the leading coefficients are both 1, so y = 1.
- Intercepts: the x-intercept is x = 2, and the y-intercept is f(0) = 2.
- Test points: f(3) = 1/2, and f(1.5) = −1, so right of the asymptote the graph comes up from below. f(0) = 2 and f(−3) = 5/4 show it is above y = 1 on the left.
When there is a slant asymptote
If the top’s degree is one more than the bottom’s, divide to get a slant asymptote. y = (x² + 1)/x equals x + 1/x, so the graph follows the line y = x for large x. The asymptote calculator finds all of these from your function, and the asymptotes guide explains the rules.
What happens near a vertical asymptote
The sign of the function tells you whether it heads to +∞ or −∞. A factor with an odd power, like (x − 1), flips the sign across the asymptote, so the curve goes up on one side and down on the other, as 1/x does. A factor with an even power, like (x − 1)², keeps the same sign on both sides, as 1/x² does.
Frequently asked questions
What is a rational function?
How do you find the holes in a rational function?
How do you find the domain of a rational function?
Can a rational function cross its horizontal asymptote?
Keep going
Every figure on this page opens in ihateDesmos, where you can drag sliders and watch the graph respond.