Rational functions

A rational function is a fraction of two polynomials:

${r(x)=\dfrac{P(x)}{Q(x)}}$

The denominator ${Q(x)}$ cannot be ${0}$. So the domain of ${r}$ is all real numbers except the zeros of ${Q}$. Near those numbers, and far out to the left and right, the graph of ${r}$ approaches lines called asymptotes. This page shows how to find them and how to sketch the graph.

The graph of ${y=1/x}$

The simplest rational function is ${y=\dfrac{1}{x}}$. Its domain is all ${x\ne 0}$. Look at what happens for small positive ${x}$:

${x}$${0.1}$${0.01}$${0.001}$
${\dfrac{1}{x}}$${10}$${100}$${1000}$

As ${x}$ approaches ${0}$ from the right, ${\dfrac{1}{x}}$ increases without bound. From the left, it decreases without bound. And as ${x}$ gets very large, ${\dfrac{1}{x}}$ approaches ${0}$. For example, ${\dfrac{1}{1000}=0.001}$.

xy
The graph of ${y=\dfrac{1}{x}}$. It approaches the ${y}$-axis near ${x=0}$, and the ${x}$-axis far out.

We use arrows to write this. ${x\to a^+}$ means "${x}$ approaches ${a}$ from the right" (with ${x>a}$). ${x\to a^-}$ means "${x}$ approaches ${a}$ from the left" (with ${x<a}$). So for ${y=\dfrac{1}{x}}$:

${\dfrac{1}{x}\to\infty}$ as ${x\to 0^+}$, and ${\dfrac{1}{x}\to -\infty}$ as ${x\to 0^-}$.

${\dfrac{1}{x}\to 0}$ as ${x\to\infty}$ and as ${x\to-\infty}$.

Asymptotes

An asymptote is a line that a graph approaches more and more closely. There are two main kinds:

The line ${x=a}$ is a vertical asymptote if ${r(x)\to\infty}$ or ${r(x)\to-\infty}$ as ${x\to a^+}$ or ${x\to a^-}$.

The line ${y=b}$ is a horizontal asymptote if ${r(x)\to b}$ as ${x\to\infty}$ or ${x\to-\infty}$.

For ${y=\dfrac{1}{x}}$, the vertical asymptote is ${x=0}$ (the ${y}$-axis), and the horizontal asymptote is ${y=0}$ (the ${x}$-axis).

Example 1: Sketch the graph of ${r(x)=\dfrac{x-1}{x-3}}$.

Solution:

Divide ${x-1}$ by ${x-3}$. The quotient is ${1}$, and the remainder is ${2}$:

${r(x)=1+\dfrac{2}{x-3}}$

So the graph is the graph of ${y=\dfrac{1}{x}}$, after three transformations (see graphs of functions):

  • a vertical stretch by ${2}$,
  • a shift ${3}$ units to the right,
  • a shift ${1}$ unit up.

The asymptotes move with the graph. The vertical asymptote is ${x=3}$, and the horizontal asymptote is ${y=1}$.

The ${x}$-intercept is where the numerator is ${0}$: ${x=1}$. The ${y}$-intercept is ${r(0)=\dfrac{-1}{-3}=\dfrac{1}{3}}$.

xy
The graph of ${r(x)=\dfrac{x-1}{x-3}}$, with the asymptotes ${x=3}$ and ${y=1}$ (dashed).

Vertical asymptotes and holes

A vertical asymptote comes from a zero of the denominator. But first, cancel any factor that the numerator and denominator share:

Write ${r(x)=\dfrac{P(x)}{Q(x)}}$ in lowest terms. Then the vertical asymptotes are the lines ${x=a}$, where ${a}$ is a zero of the denominator.

A canceled factor does not give an asymptote. Instead, it gives a hole: a single missing point in the graph.

Example 2: Find the vertical asymptotes and the holes of

${r(x)=\dfrac{x^2-1}{x^2-x}}$.

Solution:

Factor the numerator and the denominator:

${r(x)=\dfrac{(x-1)(x+1)}{x(x-1)}}$

The domain leaves out ${x=0}$ and ${x=1}$. The factor ${x-1}$ cancels:

${r(x)=\dfrac{x+1}{x}}$, for ${x\ne 1}$.

In lowest terms, the denominator is ${x}$. So ${x=0}$ is a vertical asymptote.

The canceled factor ${x-1}$ gives a hole at ${x=1}$. To find its height, put ${x=1}$ into the simplified form: ${\dfrac{1+1}{1}=2}$. The hole is at ${(1,2)}$.

(1, 2)xy
The graph has a hole at ${(1,2)}$. Its asymptotes are ${x=0}$ (the ${y}$-axis) and ${y=1}$ (dashed).

Horizontal asymptotes

Far out, only the leading terms matter (see polynomial functions and their graphs). So compare the degrees. Let ${n}$ be the degree of the numerator, and ${m}$ the degree of the denominator:

If ${n<m}$, the horizontal asymptote is ${y=0}$.

If ${n=m}$, the horizontal asymptote is ${y=\dfrac{a}{b}}$, where ${a}$ and ${b}$ are the leading coefficients of the numerator and the denominator.

If ${n>m}$, there is no horizontal asymptote.

Why? Take ${r(x)=\dfrac{3x^2-3}{x^2-4}}$, with ${n=m=2}$. Divide the numerator and the denominator by ${x^2}$:

$r(x)=\dfrac{3-\dfrac{3}{x^2}}{1-\dfrac{4}{x^2}}$

As ${x\to\pm\infty}$, the small fractions approach ${0}$. So ${r(x)\to\dfrac{3}{1}=3}$.

Example 3: Find the asymptotes of each function.

(a) ${f(x)=\dfrac{5x+1}{x^2+2}}$

(b) ${g(x)=\dfrac{3x^2-3}{x^2-4}}$

Solution:

(a) The denominator ${x^2+2}$ is never ${0}$. So there is no vertical asymptote. The degree of the numerator is ${1}$, less than ${2}$. So the horizontal asymptote is ${y=0}$.

(b) Factor:

${g(x)=\dfrac{3(x-1)(x+1)}{(x-2)(x+2)}}$

No factor cancels. The denominator is ${0}$ at ${x=2}$ and ${x=-2}$. These are the vertical asymptotes. Both degrees are ${2}$, so the horizontal asymptote is ${y=\dfrac{3}{1}=3}$.

Slant asymptotes

If the degree of the numerator is exactly one more than the degree of the denominator, divide. The quotient is a linear function ${y=mx+b}$, and the remainder part approaches ${0}$ far out. So the graph approaches the line ${y=mx+b}$. This line is called a slant asymptote.

Example 4: Find the asymptotes of ${r(x)=\dfrac{x^2+1}{x-1}}$.

Solution:

The denominator is ${0}$ at ${x=1}$, and the numerator is not. So ${x=1}$ is a vertical asymptote.

The numerator has degree ${2}$, one more than the denominator. Divide with synthetic division, using ${c=1}$ and the coefficients ${1}$, ${0}$, ${1}$. The quotient is ${x+1}$, and the remainder is ${2}$:

${r(x)=x+1+\dfrac{2}{x-1}}$

As ${x\to\pm\infty}$, the fraction ${\dfrac{2}{x-1}}$ approaches ${0}$. So the slant asymptote is ${y=x+1}$.

xy
The graph of ${r(x)=\dfrac{x^2+1}{x-1}}$. Far out, it approaches the slant asymptote ${y=x+1}$.

Graphing rational functions

To sketch the graph of a rational function:

  1. Factor the numerator and the denominator. Cancel common factors, and note any holes.
  2. Intercepts: the ${x}$-intercepts are the zeros of the numerator (in lowest terms). The ${y}$-intercept is ${r(0)}$, if ${0}$ is in the domain.
  3. Asymptotes: find the vertical asymptotes, and the horizontal or slant asymptote.
  4. Test values: the zeros of the numerator and the denominator split the ${x}$-axis into intervals. A test value in each interval shows whether the graph is above or below the axis there.
  5. Sketch the graph. Near each asymptote, follow the side the test values give.

Example 5: Sketch the graph of ${r(x)=\dfrac{3x^2-3}{x^2-4}}$ from Example 3(b).

Solution:

From Example 3(b), we have

${r(x)=\dfrac{3(x-1)(x+1)}{(x-2)(x+2)}}$.

There are no holes. The vertical asymptotes are ${x=\pm 2}$, and the horizontal asymptote is ${y=3}$.

Intercepts: the ${x}$-intercepts are ${1}$ and ${-1}$. The ${y}$-intercept is ${r(0)=\dfrac{-3}{-4}=0.75}$.

Test values: the numbers ${-2}$, ${-1}$, ${1}$, and ${2}$ split the axis into five intervals:

IntervalTest ${x}$${r(x)}$
${(-\infty,-2)}$${-3}$${4.8}$, above
${(-2,-1)}$${-1.5}$${\approx -2.1}$, below
${(-1,1)}$${0}$${0.75}$, above
${(1,2)}$${1.5}$${\approx -2.1}$, below
${(2,\infty)}$${3}$${4.8}$, above

Also, ${r}$ is even, because only even powers of ${x}$ appear. So the graph is symmetric about the ${y}$-axis.

xy
The graph of ${r(x)=\dfrac{3x^2-3}{x^2-4}}$. The dashed lines are the asymptotes ${x=\pm 2}$ and ${y=3}$.

Watch out: A graph never crosses a vertical asymptote, because the function is not defined there. But a graph can cross a horizontal asymptote. The asymptote only describes the far left and the far right.

An application

Example 6: A small company makes phone cases. It pays ${\$500}$ for the machine setup, plus ${\$2}$ for each case. What is the average cost per case when it makes ${x}$ cases? What happens when ${x}$ is very large?

Solution:

The total cost of ${x}$ cases is ${500+2x}$ dollars. The average cost per case is the total cost divided by the number of cases:

${A(x)=\dfrac{500+2x}{x}}$, for ${x>0}$.

For example, for ${100}$ cases, the average cost is

${A(100)=\dfrac{700}{100}=7}$ dollars.

For ${1000}$ cases, it is

${A(1000)=\dfrac{2500}{1000}=2.50}$ dollars.

The numerator and the denominator both have degree ${1}$. So the horizontal asymptote is ${y=\dfrac{2}{1}=2}$. As the company makes more and more cases, the average cost approaches ${\$2}$ per case. The setup cost is shared by more and more cases, so its part becomes small.

Summary