In this lesson we will apply the knowledge about the first and second derivative of a function on the problem of plotting the graph of a function.

Testing functions conduct the following procedure:

1.) Find the domain of a function

2.) Examine the symmetry of a function; is it odd, even or periodic

3.) Examine the continuity of a function

4.) Find zeroes of a function

5. ) Find the open intervals where a function is increasing or decreasing and local extrema of a function

6.) Find concavity intervals and inflection points

7.) Find asymptotes of a function

8.) Sketch the graph of a function

**Note**. A line $x=x_0$ is the **vertical asymptote** to the graph of the function $f: \mathbb{R}/\{a\} \to \mathbb{R}$ at point $a$ if

$$\lim_{x \to a^{-}} f(x) = \pm \infty$$

or/and

$$\lim_{x \to a^{+}} f(x) = \pm \infty.$$

A line $y=b$ is the **horizontal asymptote **to the graph of the function $f: \mathbb{R} \to \mathbb{R}$ at point $b$ if

$$\lim_{x \to \pm \infty}f(x) = b.$$

A line $y = ax +b$ is a **slant** or **oblique** asymptote to the graph of the function $f: \mathbb{R} \to \mathbb{R}$ at point $+ \infty$ if

$$\lim_{x \to + \infty} [f(x) – ax – b] =0.$$

A line $y = ax +b$ is a **slant** or **oblique** asymptote to the graph of the function $f: \mathbb{R} \to \mathbb{R}$ at point $- \infty$ if

$$\lim_{x \to – \infty} [f(x) – ax – b] =0.$$

We can show that a line $y= ax +b$ is a slant asymptote to the graph of the function $f: \mathbb{R} \to \mathbb{R}$ at $+ \infty$ if

$$\lim_{x \to + \infty} \frac{f(x)}{x} = a$$

and

$$\lim_{x \to + \infty} [f(x) – ax] = b,$$

and at $- \infty$ if

$$\lim_{x \to – \infty} \frac{f(x)}{x} = a$$

and

$$\lim_{x \to – \infty} [f(x) – ax] = b.$$

The graph of the function $f$ does not contains both horizontal and slant asymptote.

**Example 1**. Draw the graph of the function $f$ if

$$f(x) = x^3 +3x^2 + 2x.$$

**Solution**:

The domain of the given function $f$ is $\mathbb{R}$. The function $f$ is continuous on its entire domain.

The function $f$ it is not neither odd and even. Namely, $f(-x) \neq f(x)$ and $f(-x) \neq – f(x)$.

Zeroes of the given function we finding by solving the equation $f(x)=0$, that is:

$$ x^3 +3x^2 + 2x = 0$$

$$x(x^2 + 3x +2) = 0$$

Solutions of the equation above are $x_1= -2, x_2 = -1$ and $x_3 =0$.

Therefore, zero points of the function $f$ are

$$(-2, 0), (-1, 0), (0,0).$$

Now we calculate the first derivative of the function $f$:

$$f'(x) = 3x^2 + 6x +2.$$

Critical points we finding by solving the equation $f'(x) = 0$, that is

$$3x^2 + 6x +2 = 0.$$

Therefore, the critical points are $x_1 = \frac{-3 – \sqrt{3}}{3}$ and $x_2 = \frac{-3 + \sqrt{3}}{3}$.

The function $f$ has the minimum (global) for $ x_1 = \frac{-3 – \sqrt{3}}{3}$ and the maximum for $x_2 = \frac{-3 + \sqrt{3}}{3}$.

The second derivative of the function $f$ is equal to:

$$f”(x) = 6x +6 = 6(x+1).$$

To find inflection points, we need to solve the equation $f”(x) = 0$:

$$f”(x) = 0 \Longrightarrow x+1 = 0 \Longrightarrow x = -1.$$

Therefore, $x= -1$ is the potential inflection point.

For $ x = -2 \in \left \langle – \infty, -1 \right \rangle$ the second derivative is equal to:

$$f”(-2) = 6(-2 +1) = -6 <0,$$

and for $x= 2 \in \left \langle -1, + \infty \right \rangle$ the second derivative is equal to:

$$f”(2) = 6(2+1) = 18 > 0.$$

Therefore, around $x=1$ the second derivative changes sign from negative to positive, so $x=1$ is the inflection point. The function $f$ is concave down on the interval $\left \langle – \infty, -1 \right \rangle$ and concave up on $\left \langle 2, + \infty \right \rangle$.

**The graph of rational functions **

We will describe how to draw the graph of a rational function

$$f(x) = \frac{p_n(x)}{q_m(x)},$$

where $p_n$ is the polynomial of the degree $n$, and $q_m$ polynomial of the degree $m$. We will assume that $p_n$ and $q_m$ does not have the common zeroes.

The second derivative of a rational function is often of the complex shape, therefore, we determine asymptotes to the graph of a rational function.

A rational function has the vertical asymptote in zeroes of the denominator.

A rational function has the horizontal asymptote iff it is the degree of the numerator is less or equal to the degree of the denominator.

If the degree of the numerator is less than the degree of the denominator, then the horizontal asymptote has the equation $y=0$.

If the degree of the numerator is equal to the degree of the denominator, then the horizontal asymptote has the equation $y= \frac{a_n}{b_n}$, where $a_n$ and $b_n$ are leading coefficients of the polynomial in the numerator and denominator.

If the degree of the numerator is greater than the degree of the denominator, whereby if the degree of the numerator is greater for one than the degree of the denominator, then a rational function has an **oblyque** or **slant** asymptote and if the degree of the numerator is greater at least for two than the degree of the denominator then a rational function does not have neither slant and horizontal asymptote.

**Example 2**. Draw the graph of function $f$ if

$$f(x) = \frac{x^2 – 2x +4}{x^2 + x -2}.$$

**Solution**:

The function $f$ is not defined at points $x = -2$ and $x = 1$, therefore, lines $x = -2$ and $x= 1$ are vertical asymptotes of the given function $f$.

The degree of the numerator is equal to the degree of the denominator, that is, the equation of the horizontal asymptote is equal to:

$$y = \frac{1}{1} = 1.$$

The function $f$ is continuous on its entire domain.

The first derivative of the function $f$ is equal to:

$$f'(x) = \frac{(x^2 – 2x +4)’ \cdot (x^2 + x -2) -(x^2 – 2x +4) \cdot (x^2 + x -2)’ }{(x^2 + x – 2)^2} $$

$$ = \frac{3x(x-4)}{(x^2 + x – 2)^2}. $$

Critical points we finding by solving the equation $f'(x) = 0$, that is, critical points are $x=0$ and $x=4$. The value of the function $f$ at these points is equal to:

$$f(0) = -2$$

and

$$f(4) = \frac {2}{3}.$$

Monotone intervals:

$$x \in \left \langle – \infty, -2 \right \rangle \Rightarrow f'(x) > 0,$$

$$x \in \left \langle -2, 0 \right \rangle \Rightarrow f'(x) > 0,$$

$$x \in \left \langle 0, 1 \right \rangle \Rightarrow f'(x) < 0,$$

$$x \in \left \langle 1, 4 \right \rangle \Rightarrow f'(x) < 0,$$

$$x \in \left \langle 4, + \infty \right \rangle \Rightarrow f'(x) > 0.$$

According to the sign of the first derivative, we can see that the function $f$ is increasing on intervals $\left \langle – \infty, -2 \right \rangle, \left \langle -2, 0 \right \rangle$ and $ \left \langle 4, + \infty \right \rangle$ and decreasing on $\left \langle 0, 1 \right \rangle$ and $\left \langle 1, 4 \right \rangle$.

The first derivative changes sign from positive to negative around $x=0$, therefore, the point $\left(0, -2 \right)$ is the local maximum of the function $f$ on the interval $\left \langle -2, 1 \right \rangle$.

The first derivative changes sign from negative to positive around $x= 4$, therefore, the point $\left (4, \frac{2}{3} \right)$ is the local minimum of the function $f$ on the interval $\left \langle 1, + \infty \right \rangle$.

**Example 3.** Draw the graph of the function $f$ if

$$f(x) = \frac{2x – x^2}{x-3}.$$

**Solution**:

The given function $f$ it is not defined for $x=3$, therefore, the line $x=3$ is its vertical asymptote. Zeroes of the function $f$ are $x_1=0$ and $x_2 = 2$.

The degree of the numerator is for one greater than the degree of the denominator, therefore, the function has a slant asymptote:

$$a = \lim_{x \to \pm \infty} \frac{f(x)}{x} $$

$$ = \lim_{x \to \pm \infty} \frac{\frac{2x – x^2}{x-3}}{x}$$

$$= \lim_{x \to \pm \infty} \frac{2x – x^2}{x^2 – 3x}$$

$$ = -1,$$

$$b= \lim_{x \to \pm \infty} [f(x) – ax] $$

$$= \lim_{x \to \pm \infty}\left( \frac{2x – x^2}{x-3} + x \right)$$

$$ = \lim_{x \to \pm \infty} \frac{-x}{x-3}$$

$$ = -1.$$

We obtained that the line $y= -x -1$ is a slant asymptote of the function $f$.

The first derivative of the function $f$ is equal to:

$$f'(x) = \frac{(2x – x^2)’ \cdot (x-3) – (2x – x^2) \cdot (x-3)’}{(x-3)^2}$$

$$= \frac{(2-2x) \cdot (x-3) – (2x – x^2) \cdot 1}{(x-3)^2}$$

$$ = \frac{-x^2 + 6x -6}{(x-3)^2}\\

Critical points we obtain by solving the equation $f'(x) =0$, that is, critical points are $x= 3 – \sqrt{3}$ and $x= 3 + \sqrt{3}$.

The values of the function $f$ at critical points are $f\left ( 3 – \sqrt{3} \right) = -4 + 2 \sqrt{3}$ and $f\left ( 3 + \sqrt{3} \right) = – 2\sqrt{3} -4$.

The function $f$ in the neighborhood of the vertical asymptote will have the opposite signs, because the denominator $x-3$ changes the sign from the left and from the right of the point $3$.

**Example 4**. Draw the graph of the function $f$ if

$$f(x) = e^{\frac{1}{x}}.$$

**Solution**:

The function $f$ it is not defined for $x=0$. Therefore, we will examine limits from the left and from the right of the function $f$ at $x=0$:

$$\lim_{x \to 0^{-}} e^{\frac{1}{x}} = 0,$$

$$\lim_{x \to 0^{+}}e^{\frac{1}{x}} = + \infty.$$

The line $x = 0$ is the vertical asymptote of the function $f$.

The horizontal asymptote we finding by evaluate the following limit:

$$\lim_{x \to \pm \infty} e^{\frac{1}{x}}= 1,$$

that is, the line $y=1$ is the horizontal asymptote of the function $f$.

The first derivative of the function $f$ is equal to:

$$f'(x) = e^{\frac{1}{x}} \cdot \left (- \frac{1}{x^2} \right).$$

The first derivative is less than zero $\forall x \in \mathbb{R}/ \{0\}$, therefore, the function $f$ is decreasing on each interval from the domain of the function $f$. The first derivative is not equal to zero for any $x$ from the domain of the function $f$. Therefore, the function $f$ does not contains local extrema.

The second derivative is equal to:

$$f”(x) = e^{\frac{1}{x}} \cdot \frac{1}{x^4} + e^{\frac{1}{x}} \cdot \left(\frac{2}{x^3} \right)$$

$$= e^{\frac{1}{x}} \cdot \frac{1}{x^3} \left(\frac{1}{x} +2 \right ).$$

The second derivative is equal to zero for $x = – \frac{1}{2}$, that is, this is the potential inflection point.

Concavity intervals:

$$x \in \left \langle – \infty, -\frac{1}{2} \right \rangle \Rightarrow f”(x) < 0,$$

$$x \in \left \langle – \frac{1}{2}, 0 \right \rangle \Rightarrow f”(x) >0, $$

$$x \in \left \langle 0, + \infty \right \rangle \Rightarrow f”(x) > 0.$$

According to the sign of the second derivative we can see that the function $f$ is concave up on the interval $\left \langle – \frac{1}{2}, 0 \right \rangle$ and on $\left \langle 0, + \infty \right \rangle$. The function $f$ is concave down on the interval $\left \langle – \infty, – \frac{1}{2} \right \rangle$.

The second derivative of the function $f$ changes sign from negative to positive around $x= – \frac{1}{2}$ and the value of the function $f$ at this point is equal to $f\left( – \frac{1}{2} \right) = \frac{1}{e^2}$. Therefore, the point $\left ( -\frac{1}{2}, \frac{1}{e^2} \right)$ is the inflection point.