# 5.05 Graphing rational functions

Lesson

## Introduction to rational functions

A rational number is any number that can be expressed as the fraction $\frac{p}{q}$pq of two integers, a numerator $p$p and a non-zero denominator $q$q. Since $q$q may be equal to $1$1, every integer is a rational number. Similarly, a rational function is a function that can be written in the form of a fraction with expressions in the numerator and denominator.

A rational function is a function of the form $y=\frac{P\left(x\right)}{Q\left(x\right)},Q\left(x\right)\ne0$y=P(x)Q(x),Q(x)0, where $P\left(x\right)$P(x) and $Q\left(x\right)$Q(x) are polynomials.

So functions like $y=\frac{x}{x+1}$y=xx+1, $y=\frac{x^2-9}{2x-1}$y=x292x1, $y=5x^3-1=\frac{5x^3-1}{1}$y=5x31=5x311 and $y=\frac{24}{x^2-5x+6}$y=24x25x+6 can all be considered rational functions.

## Vertical and horizontal asymptotes

To understand the graph of a rational function, we must attend to the elephant in the room:

#### Exploration

Let’s compare the functions $f\left(x\right)=x$f(x)=x  and its reciprocal function $g\left(x\right)=\frac{1}{x}$g(x)=1x. We will start by looking at the function as $x$x approaches $\infty$.

$x$x $0$0 $25$25 $50$50 $75$75 $100$100 $125$125
$f\left(x\right)$f(x) $0$0 $25$25 $50$50 $75$75 $100$100 $125$125

As $x$x increases towards positive $\infty$, the function approaches positive $\infty$. Also, as the $y$y is all real positive numbers.

$\frac{1}{x}$1x $0$0 $25$25 $50$50 $75$75 $100$100 $125$125
$f\left(x\right)$f(x) $undefined$undefined $0.040$0.040 $0.020$0.020 $0.013$0.013 $0.01$0.01 $0.008$0.008

As $x$x increases towards positive $\infty$, the function approaches $0$0 but never touches $0$0. Also, $y$y is all real positive numbers except $0$0.

Now, what happens when $x$x decreases towards negative $\infty$.

$x$x $0$0 $-25$25 $-50$50 $-75$75 $-100$100 $-125$125
$f\left(x\right)$f(x) $0$0 $-25$25 $-50$50 $-75$75 $-100$100 $-125$125

As $x$x decreases towards negative $\infty$, the function approaches negative $\infty$. Also, $y$y is all real negative numbers.

$\frac{1}{x}$1x $0$0 $-25$25 $-50$50 $-75$75 $-100$100 $-125$125
$f\left(x\right)$f(x) $undefined$undefined $-0.040$0.040 $-0.020$0.020 $-0.013$0.013 $-0.01$0.01 $-0.008$0.008

As $x$x decreases towards negative $\infty$, the function approaches $0$0 but never touches $0$0. Also, $y$y is all real negative numbers except $0$0.

{insert f(x) = 1/x image that says where As x approaches - infinity etc}

Because the denominator cannot be equal to zero, the function $g\left(x\right)=\frac{1}{x}$g(x)=1x is undefined at $x=0$x=0  and cannot be contained in the domain. As the input values approach zero from the left side (becoming very small, negative values), the function values decrease without bound (in other words, they approach negative infinity). This behavior creates a vertical asymptote, which is a vertical line that the graph approaches but never crosses. In this case, the graph is approaching the vertical line $x=0$x=0  as the input becomes close to zero.

Also, based on the overall behavior and the graph of $g\left(x\right)=\frac{1}{x}$g(x)=1x, we can see that the function, $g\left(x\right)$g(x) , approaches $0$0 but never actually reaches $0$0; it seems to level off as the inputs become large. This behavior creates a horizontal asymptote, a horizontal line that the graph approaches as the input increases or decreases without bound. In this case, the graph is approaching the horizontal line $y=0$y=0

Finding horizontal asymptotes

The method used to find the horizontal asymptote changes depending on how the degrees of the polynomials in the numerator and denominator of the function compare.

• If both polynomials have the same degree, divide the coefficients of the greatest degree terms.

$f\left(x\right)=\frac{2x^3+1}{x^3-5}$f(x)=2x3+1x35

Both are polynomials are $3$3rd degree, therefore the horizontal asymptote is $y=\frac{2}{1}$y=21 or $y=2$y=2.

• If the polynomial in the numerator is a lower degree than the denominator, the $x$x-axis ($y=0$y=0) is the horizontal asymptote.

$g\left(x\right)=\frac{1}{2x-1}$g(x)=12x1

The numerator is a $0$0  degree polynomial and the denominator is a $1$1st degree, therefore the horizontal asymptote is $y=0$y=0.

$h\left(x\right)=\frac{2x^3+1}{x+1}$h(x)=2x3+1x+1

The numerator is a $3$3 rd degree polynomial and the denominator is a $1$1st degree, therefore there is no horizontal asymptote.

• If the polynomial in the numerator is a higher degree than the denominator, there is no horizontal asymptote.

#### Worked examples

##### question 1

Sketch a graph of the following rational function: $y=\frac{x}{x+2}$y=xx+2.

Think: The denominator of a fraction cannot be equal to zero; therefore, we must set the denominator equal to zero to find the vertical asymptote. Therefore, the vertical asymptote is $x=-2$x=2 . Because the numerator and denominator have the same degree, the horizontal asymptote is $y=1$y=1.

Do: First, graph the asymptotes.

{insert image of the two asymptotes using different colors}

Second, find and plot $x$x-intercept and $y$y-intercepts.

$x$x-intercept

 $y$y $=$= $\frac{x}{x+2}$xx+2​ (Given) $0$0 $=$= $\frac{x}{x+2}$xx+2​ (Substitute $y=0$y=0) $0$0 $=$= $x$x (Multiply $x+2$x+2 on both sides)

Notice, the denominator vanishes.

$y$y-intercept

 $y$y $=$= $\frac{x}{x+2}$xx+2​ (Given) $y$y $=$= $\frac{0}{0+2}$00+2​ (Substitute $x=0$x=0) $y$y $=$= $0$0 (Simplify)

{insert image of the point(s) on graph with asymptotes}

Third, select $x$x values to the left of asymptote (i.e., $-4$4). We already have a number to the right (the $x$x- intercept). Sketch graph.

{insert image graph of $y=\frac{x}{x+2}$y=xx+2}

##### Question 2

Find the $x$x-intercepts for the function: $y=\frac{x^3-5x^2+6}{x}$y=x35x2+6x.

Think: When finding the $x$x - intercept, set $y=0$y=0. After we multiply both sides by $x$x, we are left with $x^2-5x+6=0$x25x+6=0. This means that all of the function's $x$x intercepts are found by solving this quadratic equation.

Do:

 $x^2-5x+6$x2−5x+6 $=$= $0$0 $\left(x-2\right)\left(x-3\right)$(x−2)(x−3) $=$= $0$0 $\therefore$∴     $x$x $=$= $2$2 or   $x$x $=$= $3$3

##### Question 3

Sketch the graph of $y=\frac{x-1}{x}$y=x1x

Think: The denominator of a fraction cannot be equal to zero; therefore, we must set the denominator equal to zero to find the vertical asymptote. Therefore, the vertial asymptote is $x=0$x=0. Because the numerator and denominator have the same degree, the horizontal asymptote is $y=1$y=1.

Do:

##### Question 4

Graph the rational function $y=\frac{24}{x^2-5x+6}$y=24x25x+6. Clearly label the asymptotes.

Think:  The denominator of a fraction cannot be equal to zero; therefore, we must set the denominator equal to zero to find the vertical asymptote. Therefore, the vertical asymptote is $x^2-5x+6=0$x25x+6=0. When factored, the vertical asymptotes are $x=2$x=2 and $x=3$x=3 . Because the numerator has no degree and denominator is a $2$2 nd degree polynomial, the horizontal asymptote is $y=0$y=0.

Do:  First, graph the asymptotes.

Second, find the $x$x - and $y$y - intersects and graph.

$x$x-intersect

 $y$y $=$= $\frac{24}{x^2-5x+6}$24x2−5x+6​ (Given) $0$0 $=$= $\frac{24}{x^2-5x+6}$24x2−5x+6​ (Substitute $y=0$y=0) $0$0 $\ne$≠ $24$24

There is no $x$x-intersect.

$y$y-intersect

 $y$y $=$= $\frac{24}{x^2-5x+6}$24x2−5x+6​ (Given) $y$y $=$= $\frac{24}{(0)^2-5(0)+6}$24(0)2−5(0)+6​ (Substitute $x=0$x=0) $y$y $=$= $\frac{24}{6}$246​ (Simplify) $y$y $=$= $4$4 (Simplify)

Third, select $x$x values to the left of asymptote. Sketch graph.

$x$x $1$1 $2.2$2.2 $2.4$2.4 $2.8$2.8 $4$4 $5$5
$y$y $12$12 $-150$150 $-100$100 $-150$150 $12$12 $4$4

Notice, additional points were selected between the asymptotes to determine the shape of the function with restrictions.

Sketch

Reflect: Notice, the denominator is a quadratic expression and the function behaves as a quadratic when restricted by both vertical asymptotes. Let's explore this phenomenon using the graphic calculator. Graph the following rational function and discuss with a classmate whether a parabola will always appear:

$y=\frac{1}{x^2}$y=1x2

$y=\frac{1}{x^2+1}$y=1x2+1



$y=\frac{-4x}{x^2-25}$y=4xx225

$y=\frac{-4x^2}{x^2-25}$y=4x2x225

Think about the impact the numerator has on the graph of the rational function. Take note of the degree of the numerator and the denominator. Does that have an impact on the graph?

#### Practice questions

##### Question 5

Consider the function $f\left(x\right)=\frac{x}{x\left(x-5\right)}$f(x)=xx(x5)

1. State the equation of the vertical asymptote.

##### Question 6

Consider the function

$y=\frac{15x}{5x^2+4}$y=15x5x2+4

1. State the equation of the horizontal asymptote.

##### Question 7

Graph the function $f\left(x\right)=\frac{2x-6}{x+4}$f(x)=2x6x+4 on the axes below:

1. Loading Graph...

## Even and odd multiplicity

The multiplicity of a root is determined by the number of times the associated factor is repeated. For a root at $x=a$x=a with multiplicity $2$2 corresponds to the repeated factor $\left(x-a\right)^2$(xa)2 in $P\left(x\right)$P(x).  The multiplicity is represented in the graph by being a turning point of the graph on the $x$x-axis.

Multiplicity of a root
• Multiplicity $1$1: Function has no repeating roots. Graph passes through the root of the function.

• Multiplicity $2$2: Function has root(s) that repeat twice. Graph touches the root at a turning point of the function. Looks like a parabola at root; opposite sides of the root are moving in the same direction.

• Multiplicity $3$3: Function has root(s) that repeat $3$3 times. Graph touches the root at a turning point of the function. Looks opposites sides of the root are moving in different directions.

For rational functions we must pay attention to whether the multiplicity is even or odd. This is based on the degree of the denominator and whether the denominator multiplicity. For example, the following function has an odd multiplicity:

$y=\frac{1}{x+1}$y=1x+1,

because the degree of the denominator is $1$1 and the denominator has multiplicity of $1$1 for $(x+1)^1$(x+1)1.

Likewise, the following function has an even multiplicity:



because the degree of the denominator is $2$2. and the denominator has multiplicity of $2$2 for $(x+1)^2$(x+1)2.

Now, graphically, odd multiplicity rational functions open on opposite sides of the asymptotes (graph located in top right and bottom left or graph located in bottom right and top left). When the rational function has an even multiplicity, then the graph opens on the same side of the asymptotes (graph located in the top right and top left or graph located in bottom right and bottom left).

Graphing odd and even multiplicity
• Even Multiplicity: The curve on both sides of the discontinuity rises (or falls) in the same direction.
• Odd Multiplicity: The curve rises (or falls) in opposite directions.

Is there a connection between the multiplicity of roots and the odd and even multiplicity of rational functions?

#### Worked examples

##### QUESTION 8

Sketch the rational function given by $y=\frac{2}{x^2-4x+4}$y=2x24x+4.

Think: Notice, we can factor the denominator. Factoring is the first step when applicable. The denominator has a degree of $2$2, however we will not know if it has an even multiplicity until the denominator is factored.

Do: First, factor the denominator.

$x^2-4x+4$x24x+4

$(x-2)^2$(x2)2

The function has an even multiplicity because the degree of the denominator is $2$2 and the denominator can be rewritten to show that $(x-2)(x-2)$(x2)(x2).

Second, find the vertical and horizontal asymptotes and graph.

vertical asymptote: $x=2$x=2

horizontal asymptote: $y=0$y=0, because the degree of the numerator is less than the degree of the denominator.

Third, find $x$x- and $y$y- intercepts and graph.

$x$x-intercept

 $y$y $=$= $\frac{2}{x-2}^2$2x−2​2 (Given-factored denominator) $0$0 $=$= $\frac{2}{x-2}^2$2x−2​2 (Substitute $y=0$y=0) $0$0 $\ne$≠ $2$2 (Multiply $(x-2)^2$(x−2)2 on both sides)

There is no $x$x-intercept. We can skip this part when the horizontal asymptote is $y=0$y=0.

$y$y-intercept

 $y$y $=$= $\frac{2}{x-2}^2$2x−2​2 (Given-factored denominator) $y$y $=$= $\frac{(2}{(0)-2}^2$(2(0)−2​2 (Substitute $x=0$x=0) $y$y $=$= $\frac{1}{2}$12​ (Simplify)

Fourth, select one $x$x -value to the right of the vertical asymptote and one to the left. The vertical asymptote is $x=2$x=2

$x$x $1$1 $3$3
$y$y $2$2 $2$2

{insert graph of $y=\frac{2}{x^2-4x+4}$y=2x24x+4}

##### Question 9

Sketch the rational function given by $y=\frac{x+3}{x^2-9}$y=x+3x29

Think: Notice, we can factor the denominator. The denominator has degree of $2$2 but will the function have an even multiplicity?

Do: First, factor the numerator and denominator.

$y=\frac{(x+3)}{(x+3)(x-3)}$y=(x+3)(x+3)(x3)

Remove common factors ($x+3$x+3 ) before determining the vertical and horizontal asymptotes.

$y=\frac{1}{x-3}$y=1x3

Second, find the vertical and horizontal asymptotes.

vertical asymptote: $x=3$x=3

horizontal asymptote: $y=0$y=0

The common factor $x+3$x+3 is removed; however there is $x=-3$x=3 is still not part of the domain. There is a "hole" in the graph at this point; which makes the function discontinuous.

Third, find the $x$x- and $y$y-intercept.

$x$x-intercept - There is no x-intercept because the horizontal asymptote is $y=0$y=0

$y$y-intersect

 $y$y $=$= $\frac{1}{x-3}$1x−3​ (Given-factored) $y$y $=$= $\frac{1}{(0)-3}$1(0)−3​ (Substitute $x=0$x=0) $y$y $=$= $\frac{1}{-3}$1−3​ (Simplify)

Third, select $x$x values to the left of asymptote (i.e., $-4$4 one step from vertical asymptote). We already have a number to the right (the $x$x- intercept). Sketch graph.

{insert graph}

##### Question 10

Sketch the rational function given by $y=\frac{x-2}{x\left(x-4\right)}$y=x2x(x4).

Think:  It has a single root of multiplicity at $x=2$x=2 due to the numerator being set equal to zero: $x-2=0$x2=0 . It also has two odd poles at $x=0$x=0 and  $x=4$x=4. due to the denominator being set equal to zero: $x(x-4)=0$x(x4)=0.

Do:  First, find the vertical and horizontal asymptotes and graph.

vertical asymptote: $x=0$x=0 and $x=4$x=4

horizontal asymptote: $y=0$y=0

Second, find the $x$x- and $y$y- intercepts and graph them.

x-intercept - Because there are $2$2  asymptotes, we need to test whether is an $x$x-intercept between the vertical asymptotes

 $y$y $=$= $\frac{x-2}{x(x-4)}$x−2x(x−4)​ (Given) $0$0 $=$= $\frac{x-2}{x(x-4)}$x−2x(x−4)​ (Substitute $y=0$y=0) $0$0 $=$= $x-2$x−2 (Multiply $x(x-4)$x(x−4) on both sides) $x$x $=$= $2$2 (Add $2$2 on both sides)

y-intercept

 $y$y $=$= $\frac{x-2}{x(x-4)}$x−2x(x−4)​ (Given) $y$y $=$= $frac(0)-2(0)((0)-4)$frac(0)−2(0)((0)−4) (Substitute $x=0$x=0) $y$y $=$= $\frac{1}{2}$12​ (Simplify)

Third, sketch by selecting x-values one set to the right and left of the vertical asymptotes.

$x$x $-1$1 $1$1 $3$3 $5$5
$y$y $-\frac{3}{5}$35 $\frac{1}{3}$13 $-\frac{1}{3}$13 $\frac{3}{5}$35

Here is the sketch:

Note also the behavior as $x\rightarrow\pm\infty$x±. Because the degree of $P\left(x\right)$P(x) is less than the degree of $Q\left(x\right)$Q(x), the function approaches $0$0 (and thus the curve approaches the asymptote $y=0$y=0 ) as $x$x becomes more positively large or more negatively large.

##### Question 11

Sketch the rational function given by $y=\frac{1}{x^2}$y=1x2.

Think:  Because the numerator is the constant $1$1, the function has no roots (it cannot cross the $x$x axis). In the numerator we see an even pole at $x=0$x=0

As $x\rightarrow\pm\infty$x±, the curve asymptotically approaches the $x$x axis.

The point $\left(1,1\right)$(1,1) verifies that the curve is above the $x$x-axis.

Do:  Thus the sketch is straightforward:

##### Question 12

Sketch the rational function given by $y=\frac{\left(x-2\right)^3}{x^2-25}$y=(x2)3x225.

Think:  We see a root at $x=2$x=2 of multiplicity $3$3, and, because the denominator factors to $\left(x+5\right)\left(x-5\right)$(x+5)(x5), we know that there are two odd poles at $x=\pm5$x=±5.

The degree of the numerator is one higher than that of the denominator, so there we expect an oblique linear asymptote (The exact equation of the asymptote is difficult to determine, but it is accessible by division and is given by the line $y=x-6$y=x6 ).

Do:  Here is the sketch:

#### Exploration

The following applet allows you to create your own rational function. The equation form for this applet is given by:

$y=\frac{\left(x-a\right)^m\left(x-b\right)^n}{\left(x-c\right)^p\left(x-d\right)^q}$y=(xa)m(xb)n(xc)p(xd)q

where:

• the indices $m$m, $n$n, $p$p and $q$q can be chosen as either $0,1,2$0,1,2 or $3$3
• the constants $a$a$b$b $c$c and $d$d can be chosen as integers in the range $-5\le x\le5$5x5

Note that if you choose $a=c$a=c, $a=d$a=d, $b=c$b=c or $b=d$b=d, there will be common factors in the numerator and denominator of the rational function and this is likely to result in a less complex shape of the curve.

For example you could create functions like:

• $y=\frac{\left(x-3\right)\left(x+3\right)}{x}$y=(x3)(x+3)x
• $y=\frac{\left(x+3\right)}{x^2}$y=(x+3)x2
• $\frac{1}{\left(x-1\right)^3}$1(x1)3
• $y=\frac{\left(x-1\right)\left(x-3\right)^2}{\left(x+1\right)^2\left(x+5\right)}$y=(x1)(x3)2(x+1)2(x+5)

#### Practice questions

##### question 13

Which of the following is the graph of the function $f\left(x\right)=\frac{-3x}{x^2+4x-5}$f(x)=3xx2+4x5?

1. Loading Graph...

A

Loading Graph...

B

Loading Graph...

C

Loading Graph...

D

Loading Graph...

A

Loading Graph...

B

Loading Graph...

C

Loading Graph...

D

## Domain and setting the denominator function to zero

When dealing with the domain of a rational function, we need to locate any points of discontinuity. As these are points where the function is not defined, we simply solve $Q\left(x\right)=0$Q(x)=0 to find them. If there are no solutions to this equation (and it frequently happens), then there are no points of discontinuity and the curve is said to be continuous across its entire domain.

### A cautionary note

In most cases if there is a point of discontinuity, the curve will exhibit asymptotic behavior on either side of it.

As a word of caution however, asymptotic behavior is not always guaranteed.  This is because some of the solutions to $Q\left(x\right)=0$Q(x)=0 may also be solutions to $P\left(x\right)=0$P(x)=0.

Suppose for example we find a value of $x$x, say $x=h$x=h, where both $Q\left(h\right)=0$Q(h)=0 and $P\left(h\right)=0$P(h)=0. In that case, the curve will, at first glance, look to smoothly cross the line $x=h$x=h without any asymptotic behavior at all. However, what actually exists is a "hole" in the curve at $x=h$x=h. See example 8 below for a demonstration of this.

#### Worked examples

##### QUestion 14

Find the domain of the function $y=\frac{x^2}{x^2-1}$y=x2x21

Think:  Here, $Q\left(x\right)=x^2-1$Q(x)=x21

Do:  So, we simply solve the equation $x^2-1=0$x21=0. The solutions are $x=\pm1$x=±1, so there are two discontinuities to deal with. Neither $x=1$x=1, nor $x=-1$x=1 are solutions to $P\left(x\right)=0$P(x)=0, so the curve will exhibit asymptotic behavior around these points.

The domain is thus given formally as $\left\{x:x\in\Re\setminus x=\pm1\right\}${x:xx=±1}. That is to say the domain includes all real numbers except $x=1$x=1 and $x=-1$x=1

Reflect:  Here is the curve showing these discontinuities. Note that domain considerations are only one part of an overall strategy to sketch these functions. Calculus techniques are often needed to ascertain many other features.

##### Question 15

Find the domain of the function $y=\frac{x-1}{x^2-x}$y=x1x2x

Think:  Since $Q\left(x\right)=x^2-x$