Unit 2, lesson 33

Graphing Rational Functions

How to combine the domain, holes, intercepts, signs on test intervals and the asymptotes into one accurate sketch of a rational function, including where it crosses a horizontal asymptote.

  • Theory part 65
  • Practice part 66
  • Rational Functions

A graphing calculator draws a rational function by plotting many points and joining them. Near a vertical asymptote it may connect a huge positive value to a huge negative one with a steep segment that is not part of the graph, and it usually cannot show a hole at all. A sketch built from the function’s features has neither problem. Most of this page follows one function,

f(x)=2x2+4x−6x2−x−2.f(x) = \frac{2x^2 + 4x - 6}{x^2 - x - 2}.

Key terms

Domain and holes

Definition Let r=p/qr = p/q, where pp and qq are polynomials and qq is not the zero polynomial. The domain of rr is the set of real numbers xx with q(x)≠0q(x) \neq 0, and it stays the same after any simplification. Factor pp and qq and cancel every common factor to get the reduced form P/QP/Q, in which PP and QQ share no factor of positive degree. If aa is excluded from the domain of rr but Q(a)≠0Q(a) \neq 0, the graph has a hole at the point

(a,P(a)Q(a)).\left(a, \frac{P(a)}{Q(a)}\right).

If Q(a)=0Q(a) = 0, the line x=ax = a is a vertical asymptote.

In plain words Find where the original denominator is zero before you cancel anything. A zero that cancels away leaves one missing point in the graph, and a zero that survives cancellation gives a vertical asymptote.

Example The running function factors as

f(x)=2(x−1)(x+3)(x−2)(x+1).f(x) = \frac{2(x - 1)(x + 3)}{(x - 2)(x + 1)}.

Top and bottom share no factor, so this is already the reduced form. The domain is every real number except −1-1 and 22. There are no holes, and the lines x=−1x = -1 and x=2x = 2 are vertical asymptotes.

Intercepts

Definition The yy-intercept of the graph of rr is the point (0,r(0))(0, r(0)), which exists only when 00 is in the domain. The xx-intercepts are the points (a,0)(a, 0) with aa in the domain and r(a)=0r(a) = 0. In terms of the reduced form P/QP/Q, these are exactly the real zeros of PP that lie in the domain of rr. A number where the original numerator and denominator are both zero is never an xx-intercept, because it is not in the domain. It gives a hole when QQ is not zero there and a vertical asymptote when QQ is zero there. At an xx-intercept the graph crosses the axis when the zero has odd multiplicity in PP and touches the axis without crossing when the multiplicity is even.

In plain words Put x=0x = 0 into the function to see where the graph meets the yy-axis. Set the reduced numerator equal to zero to see where it meets the xx-axis, and throw out any value that is not in the domain.

Example At zero the function gives f(0)=−6/(−2)=3f(0) = -6/(-2) = 3, so the yy-intercept is (0,3)(0, 3). The numerator 2(x−1)(x+3)2(x - 1)(x + 3) is zero at x=1x = 1 and at x=−3x = -3, both in the domain, so the xx-intercepts are (1,0)(1, 0) and (−3,0)(-3, 0). Each zero has multiplicity 11, so the graph crosses the axis at both.

Test intervals

Definition Mark on the number line the real zeros of PP and of QQ from the reduced form. These cut points split the line into open intervals, called test intervals. On each test interval the reduced form P/QP/Q is continuous and never zero, so it keeps one sign there. Its sign at any single test value in the interval is its sign on the whole interval, and rr has that same sign wherever it is defined in the interval.

In plain words A rational function can switch sign only at a zero or at a vertical asymptote. Between those places one test value tells you whether the graph runs above or below the xx-axis.

Example For ff the cut points are −3-3, −1-1, 11 and 22.

IntervalTest valueValue of ffGraph runs
(−∞,−3)(-\infty, -3)−4-45/95/9above the axis
(−3,−1)(-3, -1)−2-2−3/2-3/2below the axis
(−1,1)(-1, 1)0033above the axis
(1,2)(1, 2)3/23/2−18/5-18/5below the axis
(2,∞)(2, \infty)3366above the axis

Every cut point here has multiplicity 11, so the sign flips at each one.

Approaching a vertical asymptote

Definition Let x=ax = a be a vertical asymptote, so that Q(a)=0Q(a) = 0 and P(a)≠0P(a) \neq 0 in the reduced form. As xx approaches aa from either side, ∣r(x)∣\lvert r(x) \rvert grows without bound, and the sign of rr on the neighboring test interval decides the direction. If rr is positive just to the right of aa, then r(x)→∞r(x) \to \infty as x→a+x \to a^+, and if rr is negative there, then r(x)→−∞r(x) \to -\infty as x→a+x \to a^+. The left side works the same way with x→a−x \to a^-. When aa is a zero of QQ of odd multiplicity the two sides go in opposite directions, and when the multiplicity is even they go the same way.

In plain words Next to a vertical asymptote the graph shoots up or down along the line. The test intervals already tell you which way, so no new work is needed.

Example The values of ff are negative on (−3,−1)(-3, -1) and positive on (−1,1)(-1, 1), so

f(x)→−∞ as x→−1−,f(x)→∞ as x→−1+.\begin{gathered} f(x) \to -\infty \text{ as } x \to -1^-, \\[0.4em] f(x) \to \infty \text{ as } x \to -1^+. \end{gathered}

Around x=2x = 2 the values are negative on (1,2)(1, 2) and positive on (2,∞)(2, \infty), so the graph falls toward −∞-\infty on the left of the line and comes down from ∞\infty on the right. A quick check agrees, since f(1.9)≈−30.4f(1.9) \approx -30.4 and f(2.1)≈36.2f(2.1) \approx 36.2.

Approaching a horizontal or slant asymptote

Definition Let y=ℓ(x)y = \ell(x) be the horizontal asymptote y=Ly = L or the slant asymptote y=mx+by = mx + b of the graph of r=P/Qr = P/Q. Subtracting LL in the horizontal case, or dividing PP by QQ in the slant case, shows that for every xx in the domain of rr

r(x)−ℓ(x)=R(x)Q(x),r(x) - \ell(x) = \frac{R(x)}{Q(x)},

where RR is a polynomial with deg⁡R<deg⁡Q\deg R < \deg Q. When RR is not the zero polynomial, this fraction keeps one sign for all large positive xx and one sign for all large negative xx. The graph approaches the asymptote from above as x→∞x \to \infty if the sign for large positive xx is positive, and from below if it is negative. The sign for large negative xx decides the side as x→−∞x \to -\infty in the same way.

In plain words Look at the leftover fraction between the function and its asymptote. Its sign far out tells you on which side of the line the graph runs, and the two ends can differ.

Example The degrees of the numerator and denominator of ff are equal and the leading coefficients are 22 and 11, so y=2y = 2 is the horizontal asymptote. Then

f(x)−2=2x2+4x−6−2(x2−x−2)x2−x−2=6x−2x2−x−2.\begin{aligned} &f(x) - 2 \\[0.4em] &\enspace = \frac{2x^2 + 4x - 6 - 2(x^2 - x - 2)}{x^2 - x - 2} \\[0.8em] &\enspace = \frac{6x - 2}{x^2 - x - 2}. \end{aligned}

For large positive xx the top and bottom are both positive, so the graph lies above y=2y = 2, and indeed f(10)=117/44≈2.66f(10) = 117/44 \approx 2.66. For large negative xx the top is negative and the bottom positive, so the graph lies below the line, and f(−10)=77/54≈1.43f(-10) = 77/54 \approx 1.43.

Crossing a horizontal asymptote

Definition A horizontal asymptote describes the graph only as x→∞x \to \infty or x→−∞x \to -\infty, so the graph may cross it at moderate values of xx. Let r=P/Qr = P/Q be in reduced form and not constant, with horizontal asymptote y=Ly = L. The graph meets the line y=Ly = L exactly at the points (a,L)(a, L) where aa is in the domain of rr and

P(a)−L Q(a)=0.P(a) - L\,Q(a) = 0.

The polynomial P−LQP - LQ is not the zero polynomial and has degree less than deg⁡Q\deg Q, so there are at most deg⁡Q−1\deg Q - 1 such points. Near such an aa the difference r(x)−Lr(x) - L has the sign of P(x)−L Q(x)P(x) - L\,Q(x) times the fixed sign of Q(a)Q(a), so the graph crosses the line at (a,L)(a, L) when aa is a zero of odd multiplicity of P−LQP - LQ, and it touches the line without crossing when the multiplicity is even. The graph meets a slant asymptote in the same way, at the real zeros of the remainder RR that lie in the domain. A vertical asymptote x=ax = a is never crossed by the graph of a rational function, because aa is not in its domain.

In plain words Set the function equal to the height of the asymptote and solve. Each solution in the domain is a point where the graph meets the line, even though far out the graph only approaches it.

Example For xx in the domain of ff, the equation f(x)=2f(x) = 2 means

2x2+4x−6=2(x2−x−2).2x^2 + 4x - 6 = 2(x^2 - x - 2).

The x2x^2 terms cancel and 6x=26x = 2, so x=1/3x = 1/3, which is in the domain. The graph crosses y=2y = 2 at the point (1/3,2)(1/3, 2). This matches the previous section, where the numerator 6x−26x - 2 of f(x)−2f(x) - 2 changes sign exactly at x=1/3x = 1/3. On (−1,1)(-1, 1) the graph comes down from ∞\infty, passes through (0,3)(0, 3), crosses the asymptote at (1/3,2)(1/3, 2) and reaches the xx-axis at (1,0)(1, 0).

Putting the graph together

Definition A sketch of a rational function r=p/qr = p/q is complete when it shows

  1. the domain, with every hole drawn as an open dot,
  2. the intercepts,
  3. the sign of rr on each test interval,
  4. each vertical asymptote, with the direction of the graph on both sides of it,
  5. the horizontal or slant asymptote, the side from which the graph approaches it at each end, and any points where the graph crosses it.

On each interval of the domain the graph is then drawn as one unbroken smooth curve that agrees with all of these facts, with a few extra plotted points wherever the shape is unclear.

In plain words Each step adds one fact about the graph. Together they fix the overall shape, so the drawing becomes a matter of connecting what you already know.

Example Take

h(x)=x3−xx2−2x−3=x(x−1)(x+1)(x−3)(x+1).\begin{aligned} h(x) &= \frac{x^3 - x}{x^2 - 2x - 3} \\[0.8em] &= \frac{x(x - 1)(x + 1)}{(x - 3)(x + 1)}. \end{aligned}

The domain excludes −1-1 and 33. The factor x+1x + 1 cancels, leaving the reduced form x(x−1)/(x−3)x(x - 1)/(x - 3), so there is a hole at x=−1x = -1 with height (−1)(−2)/(−4)=−1/2(-1)(-2)/(-4) = -1/2, and x=3x = 3 is a vertical asymptote. The graph passes through the origin, which is the yy-intercept, and the xx-intercepts are (0,0)(0, 0) and (1,0)(1, 0).

The cut points 00, 11 and 33 give the signs. The test values h(−2)=−6/5h(-2) = -6/5, h(1/2)=1/10h(1/2) = 1/10, h(2)=−2h(2) = -2 and h(4)=12h(4) = 12 show that hh is negative on (−∞,0)(-\infty, 0), positive on (0,1)(0, 1), negative on (1,3)(1, 3) and positive on (3,∞)(3, \infty). So h(x)→−∞h(x) \to -\infty as x→3−x \to 3^- and h(x)→∞h(x) \to \infty as x→3+x \to 3^+.

Division gives x2−x=(x−3)(x+2)+6x^2 - x = (x - 3)(x + 2) + 6, so for xx in the domain

h(x)=x+2+6x−3.h(x) = x + 2 + \frac{6}{x - 3}.

The slant asymptote is y=x+2y = x + 2. The leftover fraction is positive for x>3x > 3 and negative for x<3x < 3, so the graph runs above the line on the far right and below it on the far left. The fraction is never zero, so the graph never crosses the slant asymptote.

Putting it together, the graph comes in from the lower left just under the line y=x+2y = x + 2, rises through the open dot at (−1,−1/2)(-1, -1/2) to the origin, makes a small hump above the axis between 00 and 11, and drops through (1,0)(1, 0) down along x=3x = 3. To the right of x=3x = 3 it comes down from ∞\infty, turns, and then follows y=x+2y = x + 2 from above.

Check yourself

  1. Where does the graph of the function below cross its horizontal asymptote?
r(x)=3x2−xx2+1r(x) = \frac{3x^2 - x}{x^2 + 1}
Show the answer

The degrees are equal and the leading coefficients are 33 and 11, so the horizontal asymptote is y=3y = 3. Subtracting it gives

r(x)−3=3x2−x−3(x2+1)x2+1=−x−3x2+1.\begin{aligned} r(x) - 3 &= \frac{3x^2 - x - 3(x^2 + 1)}{x^2 + 1} \\[0.8em] &= \frac{-x - 3}{x^2 + 1}. \end{aligned}

The denominator is never zero, and the numerator −x−3-x - 3 is zero only at x=−3x = -3, where it changes sign. So the graph crosses its asymptote exactly once, at (−3,3)(-3, 3).

  1. Describe the graph of the function below near x=1x = 1 and far out to the left and to the right.
r(x)=x+2(x−1)2r(x) = \frac{x + 2}{(x - 1)^2}
Show the answer

The denominator is positive for every x≠1x \neq 1 and the numerator is close to 33 near x=1x = 1, so r(x)→∞r(x) \to \infty from both sides of the vertical asymptote x=1x = 1. The degree of the numerator is smaller, so y=0y = 0 is the horizontal asymptote. The function has the sign of x+2x + 2, so the graph approaches y=0y = 0 from above as x→∞x \to \infty and from below as x→−∞x \to -\infty. It crosses this asymptote once, at the xx-intercept (−2,0)(-2, 0).

  1. Find the holes, intercepts and asymptotes of the function below.
r(x)=x2+2xx2−4r(x) = \frac{x^2 + 2x}{x^2 - 4}
Show the answer

Factoring gives

r(x)=x(x+2)(x−2)(x+2),r(x) = \frac{x(x + 2)}{(x - 2)(x + 2)},

so the domain excludes −2-2 and 22. The reduced form is x/(x−2)x/(x - 2). It equals −2/(−4)=1/2-2/(-4) = 1/2 at −2-2, so there is a hole at (−2,1/2)(-2, 1/2), and x=2x = 2 is the vertical asymptote. The only intercept is the origin. The horizontal asymptote is y=1y = 1, and the graph never crosses it, since x=x−2x = x - 2 has no solution.

How this lesson connects

Where this leads in Calculus