This site is a work in progress. New lessons are added regularly. Contact us

Rational Functions

Learning goals

  • Exclude the zeros of the denominator from the domain
  • Graph 1x\tfrac{1}{x} as a hyperbola with two branches
  • Tell a vertical asymptote from a hole by whether the factor cancels
  • Compare degrees to find the horizontal asymptote
  • Read asymptotes x=hx = h and y=ky = k from the shifted form
  • Clear denominators, then discard extraneous candidates

What a rational function is

A rational function is a ratio of two polynomials,

f(x)=p(x)q(x),f(x) = \frac{p(x)}{q(x)},

where q(x)q(x) is not the zero polynomial (otherwise you would be dividing by nothing). The word rational comes from ratio: just as a rational number is one integer over another, a rational function is one polynomial over another. Every polynomial you have already studied is a rational function in disguise, since you can write it over the denominator 11. But the new behavior appears the moment the denominator actually contains the variable.

The simplest genuine example, and the one the whole lesson is built on, is the reciprocal function

f(x)=1x.f(x) = \frac{1}{x}.

It sends 22 to 12\tfrac12, sends 12\tfrac12 to 22, and sends 4-4 to 14-\tfrac14, turning each input into its reciprocal. A few more examples show the range of shapes the definition allows:

x+1x3,2xx29,x2x6x29.\frac{x + 1}{x - 3}, \qquad \frac{2x}{x^2 - 9}, \qquad \frac{x^2 - x - 6}{x^2 - 9}.

The rest of the lesson works out the two features that set rational functions apart from the polynomials of earlier chapters. Those two features are a domain with holes cut out of it, and a graph that runs off toward invisible guide-lines called asymptotes.

Finding the domain

A polynomial accepts every real number, but a rational function is choosier. Wherever the denominator q(x)q(x) equals zero, the rule asks you to divide by zero, and that has no answer. So the domain of a rational function is every real number except the values that make the denominator zero. To find those forbidden inputs, set the denominator equal to zero and solve.

Why dividing by zero has no value#

Division is defined through multiplication. The quotient ab\frac{a}{b} is the number that, multiplied by bb, gives back aa. So ab=c\frac{a}{b} = c means exactly that cb=ac \cdot b = a. Test what this demands when the divisor is zero.

Suppose first that a0a \neq 0, and ask for a0\frac{a}{0}. It would have to be a number cc with c0=ac \cdot 0 = a. But anything times zero is zero,

c0=0a,c \cdot 0 = 0 \neq a,

so no such cc exists. There is simply no number that works.

Suppose instead that a=0a = 0, and ask for 00\frac{0}{0}. Now the requirement c0=0c \cdot 0 = 0 is satisfied by every number cc, since anything times zero is zero. A quotient that could be any number at all pins down nothing, so it cannot be assigned a single value either. Either way, dividing by zero has no sensible answer, which is exactly why every input that makes the denominator zero is thrown out of the domain.

Worked example 1 Find the domain of three rational functions

For each one, set only the denominator to zero, since the numerator never restricts the domain.

For f(x)=x+5x3f(x) = \dfrac{x + 5}{x - 3}, the denominator is zero when x3=0x - 3 = 0, that is x=3x = 3. The domain is every real number except 33.

For g(x)=2x1x2x6g(x) = \dfrac{2x - 1}{x^2 - x - 6}, factor the denominator to find its zeros:

x2x6=(x3)(x+2)=0x=3  or  x=2.x^2 - x - 6 = (x - 3)(x + 2) = 0 \quad \Longrightarrow \quad x = 3 \ \text{ or } \ x = -2.

The domain is every real number except 33 and 2-2.

For h(x)=x+1x2+4h(x) = \dfrac{x + 1}{x^2 + 4}, set x2+4=0x^2 + 4 = 0, which gives x2=4x^2 = -4. No real number has a negative square, so the denominator is never zero, and the domain is all real numbers with nothing to exclude.

Check your understanding

What is the domain of f(x)=x+2x2x12f(x) = \dfrac{x + 2}{x^2 - x - 12}?

Answer choices

The reciprocal function and its hyperbola

To see what a rational graph looks like, plot the reciprocal f(x)=1xf(x) = \frac{1}{x} point by point, keeping in mind that x=0x = 0 is barred from the domain:

xx2-21-112-\tfrac1212\tfrac121122
y=1xy = \tfrac{1}{x}12-\tfrac121-12-2221112\tfrac12

The points fall into two separate pieces, called branches. For positive inputs both coordinates are positive, so that branch lives in the upper-right quadrant. For negative inputs both coordinates are negative, so the other branch sits in the lower-left. The two branches never join, because to pass from one to the other the curve would have to cross x=0x = 0, and there is no point there. This two-branch curve is a hyperbola.

Look at what happens at the edges, described in plain words rather than symbols. As xx grows very large in size, say x=100x = 100 or x=1000x = 1000, the reciprocal 1x\frac{1}{x} becomes very small, 0.010.01 then 0.0010.001, creeping toward zero without ever equalling it. So far out to the left and right the curve snuggles down against the x-axis. The horizontal line the graph approaches this way is a horizontal asymptote, and here it is the line y=0y = 0.

Now let xx get very close to 00, say x=0.01x = 0.01. Then 1x=100\frac{1}{x} = 100, and at x=0.001x = 0.001 it is 10001000: the closer xx creeps to zero, the more violently 1x\frac{1}{x} shoots up (or down, for small negative xx). The curve rises along the y-axis without bound, hugging it ever more tightly but never landing on it, since x=0x = 0 is not allowed. The vertical line the graph races along like this is a vertical asymptote, and here it is the line x=0x = 0.

The hyperbola y equals 1 over x with the axes as its asymptotesTwo branches of y equals 1 over x, in the first and third quadrants, each approaching the x-axis and the y-axis without meeting them.xy-3-2-112331-1-3(1, 1)(-1, -1)y = 1/xx = 0y = 0
The graph of y equals 1 over x is a hyperbola with two branches. For large x in either direction the curve flattens toward the x-axis, so y equals 0 is a horizontal asymptote; as x approaches 0 the curve shoots up or down along the y-axis, so x equals 0 is a vertical asymptote. The curve approaches both axes but never touches them, because x equals 0 is barred and 1 over x is never 0.

An asymptote is any straight line that the graph approaches more and more closely as you follow it outward. It is not part of the graph; it is a guide-line that describes where the curve is headed. Every rational function has this kind of edge behavior, and reading it off the formula is the goal of the next two sections.

Vertical asymptotes and holes

The reciprocal blew up at x=0x = 0 because that is where its denominator vanished. The same thing happens in general, but with one twist: not every zero of the denominator produces an asymptote. What matters is whether the troublesome factor also lives in the numerator.

Why a leftover factor blows the graph up, and a canceling one does not#

Suppose the denominator is zero at x=ax = a, so it has a factor of xax - a. Two cases split apart.

In the first case xax - a divides the denominator but not the numerator. Then as xx moves very close to aa, the factor xax - a becomes a tiny number near zero. So the whole denominator is tiny, while the numerator, with no factor of xax - a to shrink it, settles on some nonzero value NN. A fixed nonzero number divided by an ever-smaller number produces an ever-larger result: dividing by 0.0010.001 multiplies the size by a thousand, dividing by 0.0000010.000001 by a million. So the output grows without bound in size, positive on one side and negative on the other, and the curve races along the vertical line

x=a,x = a,

which is therefore a vertical asymptote.

In the second case xax - a divides both, and cancelling clears every copy of it from the denominator. After canceling, the function agrees, at every input except x=ax = a itself, with a simpler rational function that has a perfectly finite value at aa. Nothing blows up, because the shrinking denominator is matched by a shrinking numerator. The only leftover damage is that x=ax = a is still forbidden from the original domain, so the graph is that simpler curve with exactly one point removed. That missing point is a hole. The rule is clean, once you cancel as far as it will go and look at what is left. In that fully canceled form, a factor still sitting in the denominator gives an asymptote, and one with no copy left there gives a hole.

Worked example 2 Find the vertical asymptotes of f(x)=x+4(x1)(x+2)f(x) = \dfrac{x + 4}{(x - 1)(x + 2)}

The denominator is zero at x=1x = 1 and x=2x = -2. Check whether either factor also cancels with the numerator x+4x + 4.

At x=1x = 1 the numerator is 1+4=51 + 4 = 5, and at x=2x = -2 it is 2+4=2-2 + 4 = 2. Neither is zero, so neither factor cancels, and both survive in the denominator.

x=1andx=2x = 1 \quad \text{and} \quad x = -2

are therefore vertical asymptotes. Near x=1x = 1, for instance, the numerator stays close to 55 while the denominator shrinks toward zero. So the fraction grows without bound, and the curve shoots off along the line x=1x = 1.

Worked example 3 Locate the hole and the asymptote of f(x)=x2x6x29f(x) = \dfrac{x^2 - x - 6}{x^2 - 9}

Factor the top and bottom completely and see what cancels:

f(x)=x2x6x29=(x3)(x+2)(x3)(x+3).f(x) = \frac{x^2 - x - 6}{x^2 - 9} = \frac{(x - 3)(x + 2)}{(x - 3)(x + 3)}.

The factor x3x - 3 appears on both the top and the bottom, so it cancels, leaving

f(x)=x+2x+3(x3).f(x) = \frac{x + 2}{x + 3} \qquad (x \neq 3).

Because x3x - 3 cancelled, x=3x = 3 gives a hole, not an asymptote. Its height is the value of the reduced form there,

3+23+3=56,\frac{3 + 2}{3 + 3} = \frac{5}{6},

so the hole sits at (3,56)\left(3, \tfrac{5}{6}\right). The other factor, x+3x + 3, does not cancel, so x=3x = -3 is a genuine vertical asymptote. Both 33 and 3-3 are still excluded from the domain, but for very different graphical reasons. The hole at x=3x = 3 is a single missing point, and the asymptote at x=3x = -3 is a line the curve flees along.

The graph of (x squared minus 4) over (x minus 2) is the line y equals x plus 2 with a hole at 2 comma 4A straight line of slope 1 passing where y equals x plus 2, drawn solid except for an open circle at the point 2 comma 4 that marks the removed point.xy-2224hole (2, 4)y = x + 2
A hole, not an asymptote. Since (x squared minus 4) over (x minus 2) factors as (x minus 2)(x plus 2) over (x minus 2), the factor x minus 2 cancels and the graph is just the line y equals x plus 2, but with the single point at x equals 2 removed. The open circle at (2, 4) marks that hole. Nothing blows up, because the shrinking denominator is cancelled by a shrinking numerator.

Check your understanding

The graph of f(x)=x4x216f(x) = \dfrac{x - 4}{x^2 - 16} has a hole at which point?

Answer choices

Horizontal asymptotes and end behavior

Vertical asymptotes describe what the graph does near a forbidden input. The horizontal asymptote describes the opposite edge: what height the graph settles toward as xx runs far out to the left and right. The whole question turns on a single idea you can check by hand: when xx is huge, a polynomial is ruled by its highest-power term.

Take x=1000x = 1000 in x2+5xx^2 + 5x. The square term is x2=1,000,000x^2 = 1{,}000{,}000, while 5x=5,0005x = 5{,}000 is a thousand times smaller and barely nudges the total. The larger xx becomes, the more completely the top-power term dwarfs everything else. So for the purpose of the far-out behavior, you may compare a rational function’s top and bottom by their leading terms alone. Let nn be the degree of the numerator and mm the degree of the denominator. Three cases result.

If n<mn < m, the denominator’s top power outgrows the numerator’s, so you are dividing a slower-growing quantity by a faster-growing one, and the ratio is squeezed toward zero. The horizontal asymptote is

y=0.y = 0.

If n=mn = m, the top and bottom grow at the same rate, and each is dominated by its leading term. Writing the leading coefficients as aa (top) and bb (bottom), the ratio settles toward

y=ab.y = \frac{a}{b}.

If n>mn > m, the numerator grows faster than the denominator, so the fraction grows without bound in size and never levels off. There is no horizontal asymptote. In the special case where the numerator is exactly one degree higher, the graph instead lines up far out with a slanted line called a slant asymptote. You find that line by dividing the polynomials, but the main fact to remember is that a top-heavy fraction has no horizontal asymptote at all.

Worked example 4 Find the horizontal asymptote in each degree case

Compare the degree of the top with the degree of the bottom.

For f(x)=3x+2x21f(x) = \dfrac{3x + 2}{x^2 - 1}, the top has degree 11 and the bottom degree 22, so n<mn < m. The bottom wins for large xx, dragging the ratio toward zero:

y=0.y = 0.

For g(x)=4x2x2x2+7g(x) = \dfrac{4x^2 - x}{2x^2 + 7}, the degrees are equal at 22, so the leading terms decide. The leading coefficients are 44 on top and 22 on the bottom:

y=42=2.y = \frac{4}{2} = 2.

You can sanity-check this by plugging in x=100x = 100: the top is about 4(10000)=400004(10000) = 40000 and the bottom about 2(10000)=200002(10000) = 20000, a ratio near 22, exactly as predicted.

For h(x)=x3+1x25h(x) = \dfrac{x^3 + 1}{x^2 - 5}, the top has the higher degree, 33 against 22, so n>mn > m. The fraction grows without bound and there is no horizontal asymptote.

Check your understanding

What is the horizontal asymptote of f(x)=6x2+13x2xf(x) = \dfrac{6x^2 + 1}{3x^2 - x}?

Answer choices

x-intercepts and shifting the hyperbola

A fraction equals zero only when its numerator equals zero (and its denominator does not). So to find where a rational graph crosses the x-axis, set the numerator to zero and solve. Then discard any solution that also makes the denominator zero, since that input is not even in the domain. For f(x)=x3x+1f(x) = \dfrac{x - 3}{x + 1} the numerator is zero at x=3x = 3, and since the denominator there is 3+1=403 + 1 = 4 \neq 0, the x-intercept is (3,0)(3, 0).

Reading a transformed reciprocal is just as direct. Every function of the form

f(x)=axh+kf(x) = \frac{a}{x - h} + k

is the basic hyperbola 1x\frac{1}{x} shifted and scaled, using the same moves you applied to other graphs. The xhx - h in the denominator shifts the graph right by hh, which drags the vertical asymptote from x=0x = 0 over to x=hx = h. The +k+k on the outside lifts the whole graph up by kk, carrying the horizontal asymptote from y=0y = 0 up to y=ky = k. The factor aa stretches the branches, and a negative aa flips them across the horizontal asymptote. So the two asymptotes cross at the point (h,k)(h, k), the new center of the hyperbola.

The shifted hyperbola y equals 1 over (x minus 2) plus 1 with asymptotes x equals 2 and y equals 1A hyperbola centered at 2 comma 1, its two branches approaching the dashed vertical line x equals 2 and the dashed horizontal line y equals 1 without touching them.xy134-123(2, 1)x = 2y = 1y = 1/(x-2) + 1
Shifting the hyperbola. The rule y equals 1 over (x minus 2), plus 1 takes the reciprocal graph and slides it right 2 and up 1. The vertical asymptote moves from x equals 0 to the dashed line x equals 2, and the horizontal asymptote moves from y equals 0 to the dashed line y equals 1. The two asymptotes cross at the new center (2, 1), and the two branches hug them just as before.

Worked example 5 Analyze f(x)=2x+13f(x) = \dfrac{2}{x + 1} - 3

Match the rule to the form f(x)=axh+kf(x) = \dfrac{a}{x - h} + k. Writing x+1x + 1 as x(1)x - (-1) gives h=1h = -1, and the constant is k=3k = -3, with a=2a = 2.

The vertical asymptote sits where the denominator is zero, at x=1x = -1, and the horizontal asymptote is the added constant, y=3y = -3. The center of the hyperbola is where they cross, (1,3)(-1, -3).

Now read off the intercepts. The y-intercept comes from x=0x = 0:

f(0)=20+13=23=1,f(0) = \frac{2}{0 + 1} - 3 = 2 - 3 = -1,

so the graph crosses the y-axis at (0,1)(0, -1). The x-intercept comes from setting f(x)=0f(x) = 0:

2x+1=32=3(x+1)x=13,\frac{2}{x + 1} = 3 \quad \Longrightarrow \quad 2 = 3(x + 1) \quad \Longrightarrow \quad x = -\frac{1}{3},

so the graph crosses the x-axis at (13,0)\left(-\tfrac{1}{3}, 0\right). With the two asymptotes and these two crossings, the shape is completely pinned down.

Set that example on the figure below and watch it assemble itself: a=2a = 2, then step the inside shift down to h=1h = -1, then the outside shift down to k=3k = -3. The two dashed lines are the asymptotes, and they carry the graph with them.

Two things are worth doing deliberately once it is there. First, watch the expression while you move the inside shift. At h=1h = -1 the rule reads x+1x + 1 underneath, and the graph has gone left; the sign you see and the direction it travels disagree, every time. That disagreement is the whole reason the worked example rewrote x+1x + 1 as x(1)x - (-1) before reading off hh. Second, drive aa down through zero. Negative values flip both branches across the horizontal asymptote, and at a=0a = 0 there is no hyperbola left at all: the rule collapses to the flat line y=ky = k. That line is still missing its point at x=hx = h, because a division by zero stays undefined no matter what you multiply it by.

Slide the hyperbola y=axh+ky = \frac{a}{x - h} + k

y = 1/x. Its centre sits at (0, 0), not shifted at all. One branch lies above and to the right of it and the other below and to the left. It never reaches x = 0 or y = 0: those are its asymptotes. A coordinate plane with the graph of 1/x drawn on it, with its centre marked. Two dashed lines mark the values the curve never reaches. Use the controls below the figure to stretch it, or to shift it across or up and down. -6 -4 -2 2 4 6 -6 -4 -2 2 4 6
Stretch a Inside h Outside k

y = 1/x. Its centre sits at (0, 0), not shifted at all. One branch lies above and to the right of it and the other below and to the left. It never reaches x = 0 or y = 0: those are its asymptotes.

A hyperbola on a coordinate plane, drawn with the two dashed lines it approaches but never reaches. The inside shift carries the vertical one sideways, the outside shift carries the horizontal one up and down, and the coefficient stretches the two branches or flips them over.

Solving a rational equation

To solve an equation that has variables in a denominator, clear the fractions by multiplying every term by a common denominator. Then solve the polynomial equation that remains, and finally throw out any candidate that makes an original denominator zero. That last step is not optional. Multiplying by an expression that could be zero can introduce a false solution, an extraneous one, exactly as squaring did for radical equations.

Worked example 6 Solve two rational equations, one of which has an extraneous solution

First solve 3x+1=2x4\dfrac{3}{x + 1} = \dfrac{2}{x - 4}. Multiply both sides by (x+1)(x4)(x + 1)(x - 4) to clear the denominators, which leaves a linear equation:

3(x4)=2(x+1)3x12=2x+2x=14.3(x - 4) = 2(x + 1) \quad \Longrightarrow \quad 3x - 12 = 2x + 2 \quad \Longrightarrow \quad x = 14.

The value x=14x = 14 makes neither denominator zero, so it is genuine, and the only solution is x=14x = 14.

Now solve xx2=2x2+3\dfrac{x}{x - 2} = \dfrac{2}{x - 2} + 3. Multiply every term by x2x - 2:

x=2+3(x2)x=3x4x=2.x = 2 + 3(x - 2) \quad \Longrightarrow \quad x = 3x - 4 \quad \Longrightarrow \quad x = 2.

Before celebrating, check the candidate against the original denominators. Here x=2x = 2 makes x2=0x - 2 = 0, so it was never in the domain. The candidate is extraneous, and the equation has no solution. The multiplication step manufactured it, which is why every answer must be tested in the original equation.

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Free Response Questions (FRQ)

Longer questions in parts, to be worked out on paper. Progressive hints, the answer on its own so you can check yourself and try again, then the full worked solution, plus a rubric to mark your own work against.

Free response Work it out on paper 5 questions Start →
More practice (optional)

Extra sets, as hard as the Challenge set. Each one opens on its own page.

More resources (optional)

Other explanations of this lesson, if you want a second take.

A bit of history (Optional)

The curve y=1xy = \frac{1}{x} once guarded a puzzle nobody could solve. Look at the region trapped between the curve and the x-axis. Start at x=1x = 1 and stop wherever you please. How much area is in there? Areas under circles and straight lines had been measured since ancient times. This region resisted every method anyone tried on it.

The answer came in the 1640s. It was found by a Flemish mathematician named Gregoire de Saint-Vincent, and it surprised everyone. He noticed that the areas grow in a strange way. Take the slab from 11 to 22. Then take the slab from 22 to 44, and then the one from 44 to 88. Each has exactly the same area as the one before it. Multiply the stopping point by a fixed number, and you always add a fixed amount of area.

That should sound familiar. Turning multiplication into addition is just what a logarithm does. A student of Saint-Vincent’s said so out loud a few years later. The area from 11 out to a number bb is the natural logarithm of bb. Nobody had put a logarithm into the problem. It was sitting under the curve, waiting.

So the reciprocal is not the plain example it looks like. The first rational function in this lesson is the one whose branches taught you what an asymptote is. It holds the logarithms you met chapters ago.