Table of Content

### Derivative

The definition of the derivative of a function is given next. We start with an example illustrating the idea behind the formal definition.

##### Example 0.

The graph below shows how far a cyclist gets from his starting point.

a) Look at the red line. We can see that in three hours, the cyclist moved $$20$$km. The average speed of the whole trip is $$6.6$$ km/h.
b) Now look at the green line. We can see that during the third hour the cyclist moved $$10$$km further. That makes the average speed of that time interval $$10$$ km/h.
Notice that the slope of the red line is $$20/3 \approx 6.6$$ and that the slope of the blue line is $$10$$. These are the same values as the corresponding average speeds.
c) Look at the blue line. It is the tangent of the curve at the point $$x=2h$$. Using the same principle as with average speeds, we conclude that after two hours of the departure, the speed of the cyclist was $$30/2$$ km/h $$= 15$$ km/h.

Now we will proceed to the general definition:

##### Definition: Derivative

Let $$(a,b)\subset \mathbb{R}$$. The derivative of function $$f\colon (a,b)\to \mathbb{R}$$ at the point $$x_0\in (a,b)$$ is $f'(x_0):=\lim_{h\to 0} \frac{f(x_0+h)-f(x_0)}{h}.$ If $$f'(x_0)$$ exists, then $$f$$ is said to be differentiable at the point $$x_0$$.

Note: Since $$x = x_0+h$$, then $$h=x-x_0$$, and thus the definition can also be written in the form $f'(x_0):=\lim_{x\to x_0} \frac{f(x)-f(x_0)}{x-x_0}.$

The derivative can be denoted in different ways: $f'(x_0)=Df(x_0) =\left. \frac{df}{dx}\right|_{x=x_0}, \ \ f'=Df =\frac{df}{dx}.$

Interpretation. Consider the curve $$y = f(x)$$. Now if we draw a line through the points $$(x_0,f(x_0))$$ and $$(x_0+h, f(x_0+h))$$, we see that the slope of this line is $\frac{f(x_0+h)-f(x_0)}{x_0+h-x_0} = \frac{f(x_0+h)-f(x_0)}{h}.$ When $$h \to 0$$, the line intersects with the curve $$y = f(x)$$ only in the point $$(x_0, f(x_0))$$. This line is the tangent of the curve $$y=f(x)$$ at the point $$(x_0,f(x_0))$$ and its slope is $\lim_{h\to 0} \frac{f(x_0+h)-f(x_0)}{h},$ which is the derivative of the function $$f$$ at $$x_0$$. Hence, the tangent is given by the equation $y=f(x_0)+f'(x_0)(x-x_0).$

Interactivity. Move the point of intersection and observe changes on the tangent line of the curve.

##### Example 1.

Let $$f\colon \mathbb{R} \to \mathbb{R}$$ be the function $$f(x) = x^3 + 1$$. The derivative of $$f$$ at $$x_0 = 1$$ is \begin{aligned}f'(1) &=\lim_{h \to 0} \frac{f(1+h)-f(1)}{h} \\ &=\lim_{h \to 0} \frac{(1+h)^3 + 1 - 1^3 - 1}{h} \\ &=\lim_{h \to 0} \frac{1+3h+3h^2+h^3-1}{h} \\ &=\lim_{h \to 0} \frac{h(3+3h+h^2)}{h} \\ &=\lim_{h \to 0} 3+3h+h^2 \\ &= 3. \end{aligned}

##### Example 2.

Let $$f\colon \mathbb{R} \to \mathbb{R}$$ be the function $$f(x)=ax+b$$. We find the derivative of $$f(x)$$.

Immediately from the definition we get: \begin{aligned}f'(x) &=\lim_{h\to 0} \frac{f(x+h)-f(x)}{h} \\ &=\lim_{h\to 0} \frac{[a(x+h)+b]-[ax+b]}{h} \\ &=\lim_{h\to 0} a \\ &=a.\end{aligned}

Here $$a$$ is the slope of the tangent line. Note that the derivative at $$x$$ does not depend on $$x$$ because $$y=ax+b$$ is the equation of a line.

Note. When $$a=0$$, we get $$f(x) = b$$ and $$f'(x) = 0$$. The derivative of a constant function is zero.

##### Example 3.

Let $$g\colon \mathbb{R} \to \mathbb{R}$$ be the function $$g(x)=|x|$$. Does $$g$$ have a derivative at $$0$$?

Now $g'(x_0)= \begin{cases}+1 & \text{when x_{0}>0} \\ -1 & \text{when x_{0}<0}\end{cases}$

The graph $$y=g(x)$$ has no tangent at the point $$x_0=0$$: $\frac{g(0+h)-g(0)}{h}= \frac{|0+h|-|0|}{h}=\frac{|h|}{h}=\begin{cases}+1 & \text{for h>0}, \\ -1 & \text{for h<0}.\end{cases}$ Thus $$g'(0)$$ does not exist.

Conclusion. The function $$g$$ is not differentiable at the point $$0$$.

Remark. Let $$f\colon (a,b)\to \mathbb{R}$$. If $$f'(x)$$ exists for every $$x\in (a,b)$$ then we get a function $$f'\colon (a,b)\to \mathbb{R}$$. We write:

 (1) $$f(x)$$ = $$f^{(0)}(x)$$, (2) $$f'(x)$$ =  $$f^{(1)}(x)$$ =  $$\frac{d}{dx}f(x)$$, (3) $$f''(x)$$ =  $$f^{(2)}(x)$$ =  $$\frac{d^2}{dx^2}f(x)$$, (4) $$f'''(x)$$ =  $$f^{(3)}(x)$$ =  $$\frac{d^3}{dx^3}f(x)$$, ...

Here $$f''(x)$$ is called the second derivative of $$f$$ at $$x$$, $$f^{(3)}$$ is the third derivative, and so on.

We introduce the notation \begin{eqnarray} C^n\bigl( ]a,b[\bigr) =\{ f\colon \, ]a,b[\, \to \mathbb{R} & \mid & f \text{ is } n \text{ times differentiable on the interval } ]a,b[ \nonumber \\ & & \text{ and } f^{(n)} \text{ is continuous}\}. \nonumber \end{eqnarray} These functions are said to be n times continuously differentiable.

##### Example 4.

The distance moved by a cyclist (or a car) is given by $$s(t)$$. Then the speed at the moment $$t$$ is $$s'(t)$$ and the acceleration is $$s''(t)$$.

##### Linearization and differential
Derivative can also be used to approximate functions. From the definition of the derivative, we get $f'(x_0)\approx \frac{f(x)-f(x_0)}{x-x_0} \Leftrightarrow f(x)\approx f(x_0)+f'(x_0)(x-x_0),$ where the right-handed side is the linearization or the differential of $$f$$ at $$x_0$$. The differential is denoted by $$df$$. The graph of the linearization, $y=f(x_0)+f'(x_0)(x-x_0),$ is the tangent line drawn on the graph of the function $$f$$ at the point $$(x_0,f(x_0))$$. Later, in multi-variable calculus, the true meaning of the differential becomes clear. For now, it is not necessary to get troubled by the details.

### Properties of derivative

Next we give some useful properties of the derivative. These properties allow us to find derivatives for some familiar classes of functions such as polynomials and rational functions.

### Continuity and derivative

If $$f$$ is differentiable at the point $$x_0$$, then $$f$$ is continuous at the point $$x_0$$: $\lim_{h\to 0} f(x_0+h) = f(x_0).$ Why? Because if $$f$$ is differentiable, then we get $f(x_0)+h\frac{f(x_0+h)-f(x_0)}{h} \rightarrow f(x_0)+0\cdot f'(x_0)=f(x_0),$ as $$h \to 0$$.

Note. If a function is continuous at the point $$x_0$$, it doesn't have to be differentiable at that point. For example, the function $$g(x) = |x|$$ is continuous, but not differentiable at the point $$0$$.

### Differentiation Rules

Next we will give some important rules which are often applied in practical problems concerning determination of the derivative of a given function.

Suppose that $$f$$ and $$g$$ are differentiable at $$x$$.

##### A Constant Multiplier

$(cf)'(x) = cf'(x),\ c \in \mathbb{R}$

Proof.

Suppose that $$f$$ is differentiable at $$x$$. We determine: $(cf)'(x),$ where $$c\in \mathbb{R}$$ is a constant.

\begin{aligned}\frac{(cf)(x+h)-(cf)(x)}{h} \ & \ = \ \frac{cf(x+h)-cf(x)}{h} \\ & \ = \ c \ \frac{f(x+h)-f(x)}{h}\end{aligned}

As $$h\to 0$$, we get $c \ \frac{f(x+h)-f(x)}{h} \to c f'(x).$

$$\square$$

##### The Sum Rule

$(f+g)'(x) = f'(x) + g'(x)$

Proof.

Suppose that $$f$$ and $$g$$ are differentiable at $$x$$. We determine $(f+g)'(x).$

By the definition: \begin{aligned}\frac{(f+g)(x+h)-(f+g)(x)}{h} \ & \ = \ \frac{[f(x+h)+g(x+h)]-[f(x)+g(x)]}{h} \\ & \ = \ \frac{f(x+h)-f(x)}{h}+\frac{g(x+h)-g(x)}{h}\end{aligned}

When $$h\to 0$$, we get $\frac{f(x+h)-f(x)}{h}+\frac{g(x+h)-g(x)}{h}\to \ f'(x)+g'(x)$

$$\square$$

##### The Product Rule

$(fg)'(x) = f'(x)g(x) + f(x)g'(x)$

Proof.

Suppose that $$f,g$$ and are differentiable at $$x$$. We determine $(fg)'(x).$ \begin{aligned}\frac{(fg)(x+h)-(fg)(x)}{h} & = \frac{f(x+h)g(x+h)-f(x)g(x)}{h} \\ & = \frac{f(x+h)g(x+h)-f(x)g(x+h)+f(x)g(x+h)-f(x)g(x)}{h} \\ & = \frac{f(x+h)-f(x)}{h}\ g(x+h)+f(x)\ \frac{g(x+h)-g(x)}{h}\end{aligned}

When $$h\to 0$$, we get $\frac{f(x+h)-f(x)}{h}g(x+h)+f(x)\frac{g(x+h)-g(x)}{h}\to f'(x)g(x)+f(x)g'(x).$

$$\square$$

##### The Power Rule

$\frac{d}{dx} x^n = nx^{n-1} \text{, } n \in \mathbb{Z}$

Proof.

For $$n\ge 1$$ we repeteadly apply the product rule, and obtain \begin{aligned}\frac{d}{dx}x^n \ & = \frac{d}{dx}(x\cdot x^{n-1}) \\ & = (\frac{d}{dx}x)x^{n-1}+x\frac{d}{dx}x^{n-1} \\ & \stackrel{dx/dx=1}{=} x^{n-1}+x\frac{d}{dx}x^{n-1} \\ & = x^{n-1}+x\left( x^{n-2}+x\frac{d}{dx}x^{n-2}\right) \\ & = \ldots \\ & = \sum_{k=0}^{n-1} x^{n-1} \\ & = nx^{n-1}.\end{aligned}

The case of negative $$n$$ is obtained from this and the product rule applied to the identity $$x^n \cdot x^{-n} = 1$$.

From the power rule we obtain a formula for the derivative of a polynomial. Let $P(x)=a_n x^{n}+a_{n-1}x^{n-1}+\ldots+ a_1 x + a_0,$ where $$n\in \mathbb{N}$$. Then $\frac{d}{dx}P(x)=na_nx^{n-1}+(n-1)a_{n-1}x^{n-2}+\ldots +2 a_2 x+a_1.$

$$\square$$

##### The Reciprocal Rule

$\Big(\frac{1}{f}\Big)'(x) = - \frac{f'(x)}{f(x)^2} \text{, } f(x) \neq 0$

Proof.

Suppose that $$f$$ is differentiable at $$x$$ and $$f(x)\neq 0$$. We determine $(\frac{1}{f})'(x).$

From the definition we obtain: \begin{aligned}\frac{(1/f)(x+h)-(1/f)(x)}{h} & = \frac{1/f(x+h)-1/f(x)}{h} \\ & = \frac{\frac{f(x)}{f(x)f(x+h)}-\frac{f(x+h)}{f(x)f(x+h)}}{h} \\ & = \frac{f(x)-f(x+h)}{h}\frac{1}{f(x)f(x+h)}\end{aligned}

Because $$f$$ is differentiable at $$x$$ we get $\frac{f(x)-f(x+h)}{h}\frac{1}{f(x)f(x+h)}=-f'(x)/f(x)^2,$ as $$h\to 0$$.

$$\square$$

##### The Quotient Rule

$(f/g)'(x) = \frac{f'(x)g(x)-f(x)g'(x)}{g(x)^2},\ g(x) \neq 0$

Proof.

Suppose that $$f,g$$ are differentiable at $$x$$ and $$g(x)\neq 0$$. Then \begin{aligned}(f/g)'(x) & = \Big( f \cdot \frac{1}{g}\Big) '(x) \\ & = f'(x)\frac{1}{g(x)}-f(x)\frac{g'(x)}{g(x)^2} \\ & = \frac{f'(x)g(x)-f(x)g'(x)}{g(x)^2}.\end{aligned}

$$\square$$

##### Example 1.

$\frac{d}{dx}(x^{2006}+5x^3+42)=\frac{d}{dx}x^{2006}+5\frac{d}{dx}x^3+42\frac{d}{dx}1=2006x^{2005}+5\cdot 3x^2.$

##### Example 2.

\begin{aligned}\frac{d}{dx} [(x^4-2)(2x+1)] &= \frac{d}{dx}(x^4-2) \cdot (2x+1) + (x^4-2) \cdot \frac{d}{dx}(2x + 1) \\ &= 4x^3(2x+1) + 2(x^4-2) \\ &= 8x^4+4x^3+2x^4-4 \\ &= 10x^4+4x^3-4.\end{aligned}

Note. We can check the answer by deriving it in another way: $\frac{d}{dx} [(x^4-2)(2x+1)] = \frac{d}{dx} (2x^5 +x^4 -4x -2) = 10x^4 +4x^3 -4.$

##### Example 3.

For $$x \neq 0$$ we get $\frac{d}{dx} \frac{3}{x^3} = 3 \cdot \frac{d}{dx} \frac{1}{x^3} = -3 \cdot \frac{\frac{d}{dx} x^3}{(x^3)^2} = -3 \cdot \frac{3x^2}{x^6}= - \frac{9}{x^4}.$

Note. There is another way of solving the problem above by noticing that $$\frac{1}{x^3} = x^{-3}$$ and differentiating it as a power: $\frac{d}{dx} \ \frac{3}{x^3} = 3 \cdot \frac{d}{dx} x^{-3} = 3 \cdot (-3x^{-4})= - \frac{9}{x^4}$

##### Example 4.

\begin{aligned}\frac{d}{dx} \frac{x^3}{1+x^2} & = \frac{(\frac{d}{dx}x^3)(1+x^2)-x^3\frac{d}{dx}(1+x^2)}{(1+x^2)^2} \\ & = \frac{3x^2(1+x^2)-x^3(2x)}{(1+x^2)^2} \\ & = \frac{3x^2+x^4}{(1+x^2)^2}.\end{aligned}

##### Rolle's Theorem

If $$f$$ is differentiable at a local extremum $$x_0\in \, ]a,b[$$, then $$f'(x_0)=0$$.

Proof (idea).

The one-sided limits of the difference quotient have different signs at a local extremum. For example, for a local maximum it holds that \begin{eqnarray} \frac{f(x_0+h)-f(x_0)}{h} = \frac{\text{negative} }{\text{positive}}&\le& 0, \text{ when } h>0, \nonumber \\ \frac{f(x_0+h)-f(x_0)}{h} = \frac{\text{negative}}{\text{negative}}&\ge& 0, \text{ when } h<0 \nonumber \end{eqnarray} and $$|h|$$ is so small that $$f(x_0)$$ is a maximum on the interval $$[x_0-h,x_0+h]$$.

##### L'Hospital's Rule

There are many different versions of this rule, but we present only the simplest one. Let us assume that $$f(x_0)=g(x_0)=0$$ and the functions $$f,g$$ are differentiable on some interval $$]x_0-\delta,x_0+\delta[$$. If $\lim_{x\to x_0}\frac{f'(x)}{g'(x)}$ exists, then $\lim_{x\to x_0}\frac{f(x)}{g(x)}=\lim_{x\to x_0}\frac{f'(x)}{g'(x)}.$

Proof (idea).

In the special case $$g'(x_0)\neq 0$$ the proof is simple: $\frac{f(x)}{g(x)}=\frac{f(x)-f(x_0)}{g(x)-g(x_0)} = \frac{\bigl( f(x)-f(x_0)\bigr) /(x-x_0)}{\bigl( g(x)-g(x_0)\bigr) /(x-x_0)} \to \frac{f'(x_0)}{g'(x_0)}.$ In the general case we need the so-called generalized mean value theorem, which states that $\frac{f(x)}{g(x)} = \frac{f'(c)}{g'(c)}$ for some $$c\in \, ]x_0,x[$$. Here we have the same point $$c$$ both in the numerator and the denominator, so we do not even need the continuity of the derivatives!

### Derivatives of Trigonometric Functions

In this section, we give differentiation formulas for trigonometric functions $$\sin$$, $$\cos$$ and $$\tan$$.

##### Derivative of Sine

$\sin'(t)=\cos(t)$

Proof.

##### Derivative of Cosine

$\cos'(t)= - \sin(t)$

Proof.

This follows in a similar way as the derivative of Sine, but more easily from the identity $$\cos(t)=\sin(\pi/2-t)$$ and the Chain rule to be introduced in the following section.

$$\square$$

##### Derivative of Tangent

$\tan'(t) = \frac{1}{\cos^2(t)}=1+\tan^2 t.$

Proof.

Because $\tan(t)=\frac{\sin(t)}{\cos(t)},$ from the quotient rule we obtain $\tan'(t)=\frac{\sin'(t)\cos(t)-\sin(t)\cos'(t)}{\cos^2(t)}=\frac{\cos^2(t)+\sin^2(t)}{\cos^2(t)}=\begin{cases}\frac{1}{\cos^2(t)} & \\ 1+\tan^2 t.\end{cases}$

$$\square$$

##### Example 1.

$\frac{d}{dx} (3 \sin(x)) = 3 \sin'(x) = 3 \cos(x).$

##### Example 2.

$\frac{d}{dx} \cos^2 (x) = \cos'(x) \cdot \cos(x) + \cos(x) \cdot \cos'(x) = -2\sin(x)\cos(x).$

##### Example 3.

\begin{aligned} \frac{d}{dx} \frac{\sin(x) + 1}{\cos(x)} &= \frac{d}{dx} \left( \frac{\sin(x)}{\cos(x)} + \frac{1}{\cos(x)} \right) \\ &= \tan'(x) - \frac{\cos'(x)}{\cos^2(x)} \\ &= \frac{1+\sin(x)}{\cos^2 (x)}.\end{aligned}

### The Chain Rule

In this section we learn a formula for finding the derivative of a composite function. This important formula is known as the Chain Rule.

##### The Chain Rule.

Let $$f\colon \mathbb{R}\to \mathbb{R}$$, $$g\colon \mathbb{R}\to \mathbb{R}$$ and $$f \circ g \colon \mathbb{R}\to \mathbb{R}$$.

Let $$g$$ be differentiable at the point $$x$$ and $$f$$ at $$g(x)$$. Then $\frac{d}{dx}f(g(x))=f'(g(x))g'(x).$

Proof.

Consider

\begin{aligned}\frac{f(g(x+h))-f(g(x))}{h} &= \frac{f(g(x+h))-f(g(x))}{h} \ \frac{g(x+h)-g(x)}{g(x+h)-g(x)} \\ &= \frac{f(g(x+h))-f(g(x))}{g(x+h)-g(x)} \ \frac{g(x+h)-g(x)}{h}.\end{aligned}

Now let us write $$k(h):=g(x+h)-g(x)$$. Then $$g(x+h)=g(x)+k(h)$$ and we get $\frac{f(g(x+h))-f(g(x))}{h}=\frac{f(g(x)+k(h))-f(g(x))}{k(h)}\frac{g(x+h)-g(x)}{h}.$

Problem. What if $$k(h)=0$$? Note that one cannot divide by zero.

Solution. Define $E(k):= \begin{cases}0, & \text{for k=0}, \\ \frac{f(g(x)+k)-f(g(x))}{k}-f'(g(x)), & \text{for k\neq 0},\end{cases}$ so that $\frac{f(g(x+h))-f(g(x))}{h}=[E(k(h))+f'(g(x))]\frac{g(x+h)-g(x)}{h}.$ Now, because $$E$$ is continuous, we get $[E(k(h))+f'(g(x))]\frac{g(x+h)-g(x)}{h}\to f'(g(x))g'(x).$ as $$h\to 0$$.

$$\square$$

##### Example 1.

The problem is to differentiate the function $$(2x-1)^3$$. We take $$f(x) = x^3$$ and $$g(x) = 2x-1$$ and differentiate the composite function $$f(g(x))$$. As $f'(x) = 3x^2 \text{ and } g'(x) = 2,$ we get $\frac{d}{dx} (2x-1)^3 = 3(2x-1)^2 \cdot 2 = 6(4x^2-4x+1) = 24x^2-24x+6.$

##### Example 2.

We need to differentiate the function $$\sin 3x$$. Take $$f(x) = \sin x$$ and $$g(x) = 3x$$, then differentiate the composite function $$f(g(x))$$. $\frac{d}{dx} \sin 3x = \cos 3x \cdot 3 = 3 \cos 3x.$

Remark. Let $$h\colon \mathbb{R}\to \mathbb{R}, g\colon \mathbb{R}\to \mathbb{R}$$ and $$f\colon \mathbb{R}\to \mathbb{R}$$. Now $\frac{d}{dx}f(g(h(x)))=f'(g(h(x)))\frac{d}{dx}g(h(x))=f'(g(h(x)))g'(h(x))h'(x).$ Similarly, one may obtain even more complex rules for composites of multiple functions.

##### Example 3.

Differentiate the function $$\cos^3 2x$$. Take $$f(x) = x^3$$, $$g(x) = \cos x$$ and $$h(x) = 2x$$ and differentiate the composite function $$f(g(h(x)))$$. \begin{aligned}\frac{d}{dx} \cos^3 2x &= 3(\cos 2x)^2 \cdot \frac{d}{dx} \cos 2x \\ &= 3 \cos^2 2x \cdot (-\sin 2x) \cdot 2 \\ &= -6 \sin 2x \cos^2 2x.\end{aligned}

### Extremal Value Problems

We will discuss the Intermediate Value Theorem for differentiable functions, and its connections to extremal value problems.

##### Definition: Local Maxima and Minima

A function $$f\colon A\to \mathbb{R}$$ has a a local maximum at the point $$x_0\in A$$, if for some $$h\gt 0$$ and for all $$x\in A$$ such that $$|x-x_0|\lt h$$, we have $$f(x)\leq f(x_0)$$.

Similarly, a function $$f\colon A\to \mathbb{R}$$ has a local minimum at the point $$x_0\in A$$ , if for some $$h>0$$ and for all $$x\in A$$ such that $$|x-x_0|\lt h$$, we have $$f(x)\geq f(x_0)$$.

A local extreme is a local maximum or a local minimum.

Remark. If $$x_0$$ is a local maximum value and $$f'(x_0)$$ exists, then $\begin{cases}f'(x_0) & =\lim_{h\to 0^{+}}\frac{f(x_0+h)-f(x_0)}{h} \leq 0 \\ f'(x_0) & =\lim_{h\to 0^{-}}\frac{f(x_0+h)-f(x_0)}{h} \geq 0.\end{cases}$ Hence $$f'(x_0)=0$$.

We get:

##### Theorem 1.

Let $$x_0\in [a,b]$$ be a local extremal value of a continuous function $$f\colon [a,b]\to \mathbb{R}$$. Then either

1. the derivative $$f'(x_0)$$ doesn't exist (this includes also cases $$x_0=a$$ and $$x_0=b$$) or

2. $$f'(x_0)=0$$.

##### Example 1.

Let $$f: \mathbb{R} \to \mathbb{R}$$ be defined by $f(x) = x^3 -3x + 1.$ Then $f'(x) = 3x^2-3$ and we can see that at the points $$x_0 = -1$$ and $$x_0 = 1$$ the local maximum and minimum of $$f$$ are obtained, $f'(-1) = 3 \cdot (-1)^2 - 3 = 0 \text{ and } f'(1) = 3 \cdot 1^2 - 3 = 0.$

##### Finding the global extrema

In practice, when we are looking for the local extrema of a given function, we need to check three kinds of points:

1. the zeros of the derivative

2. the endpoints of the domain of definition (interval)

3. points where the function is not differentiable

If we happened to know beforehand that the function has a minimum/maximum, then we start off by finding all the possible local extrema (the points described above), evaluate the function at these points and pick the greatest/smallest of these values.

##### Example 2.

Let us find the smallest and greatest value of the function $$f\colon [0,2]\to \mathbf{R}$$, $$f(x)=x^3-6x$$. Since the function is continuous on a closed interval, then it has a maximum and a minimum. Since the function is differentiable, it is sufficient to examine the endpoints of the interval and the zeros of the derivative that are contained in the interval.

The zeros of the derivative: $$f'(x)=3x^2-6=0 \Leftrightarrow x=\pm \sqrt{2}$$. Since $$-\sqrt{2}\not\in [0,2]$$, we only need to evaluate the function at three points, $$f(0)=0$$, $$f(\sqrt{2})=-4\sqrt{2}$$ and $$f(2)=-4$$. From these we can see that the smallest value of the function is $$-4\sqrt{2}$$ and the greatest value is $$0$$, respectively.

Next we will formulate a fundamental result for differentiable functions. The basic idea here is that the change on an interval can only happen, if there is change at some point on the inverval.

##### Theorem 2.

(The Intermediate Value Theorem for Differentiable Functions). Let $$f\colon [a,b]\to \mathbb{R}$$ be continuous in the interval $$[a,b]$$ and differentiable in the interval $$(a,b)$$. Then $f'(x_0)=\frac{f(b)-f(a)}{b-a}$ for some $$x_0\in (a,b).$$

Proof.

Let $$f$$ be continuous in the interval $$[a,b]$$ and differentiable in the interval $$(a,b)$$. Let us define $g(x):=f(x)-\frac{f(b)-f(a)}{b-a}(x-a)-f(a).$

Now $$g(a)=g(b)=0$$ and $$g$$ is differentiable in the interval $$(a,b)$$. According to Rolle's Theorem, there exists $$c\in(a,b)$$ such that $$g'(c)=0$$. Hence $f'(c)=g'(c)+\frac{f(b)-f(a)}{b-a}=\frac{f(b)-f(a)}{b-a}.$

$$\square$$

This result has an important application:

##### Theorem 3.

Let $$f\colon (a,b)\to \mathbb{R}$$ be a differentiable function. Then

1. If for all $$x\in (a,b) \ \ f'(x)\geq 0$$, then $$f$$ is increasing,

2. If for all $$x\in (a,b) \ \ f'(x)\leq 0$$, then $$f$$ is decreasing.

Proof.

Suppose that $$a \lt x_1 \lt x_2 \lt b$$.

Then by Theorem 2 there exists $$x_0\in (x_1,x_2)$$ such that $f'(x_0)=\frac{f(x_2)-f(x_1)}{x_2-x_1}.$

It follows that $$f(x_2)-f(x_1)=f'(x_0)(x_2-x_1)$$.

Hence we may conclude that $$f$$ is increasing for $$f'(x_0)\geq 0$$ and decreasing for $$f'(x_0)\leq 0$$.

##### Example 3.

For the polynomial $$f(x) = \frac{1}{4} x^4-2x^2-7$$ the derivative is $f'(x) = x^3-4x = x(x^2-4) = 0,$ when $$x=0$$, $$x=2$$ or $$x=-2$$. Now we can draw a table:

$$x<-2$$ $$-2 \lt x \lt 0$$ $$0 \lt x \lt 2$$ $$x>2$$
$$x$$ $$<0$$ $$<0$$ $$>0$$ $$>0$$
$$x^2-4$$ $$>0$$ $$<0$$ $$<0$$ $$>0$$
$$f'(x)$$ $$<0$$ $$>0$$ $$<0$$ $$>0$$
$$f(x)$$ decr. incr. decr. incr.
##### Example 4.

We need to find a rectangle so that its area is $$9$$ and it has the least possible perimeter.

Let $$x\ (>0)$$ and $$y\ (>0)$$ be the sides of the rectangle. Then $$x \cdot y = 9$$ and we get $$y=\frac{9}{x}$$. Now the perimeter is $2x+2y = 2x+2 \frac{9}{x} = \frac{2x^2+18}{x}.$ In which point does the function $$f(x) = \frac{2x^2+18}{x}$$ get its minimum value? Function $$f$$ is continuous and differentiable, when $$x>0$$ and using the quotient rule, we get $f'(x) = \frac{4x \cdot x-(2x^2+18) \cdot 1}{x^2} = \frac{2x^2-18}{x^2}.$ Now $$f'(x) = 0$$, when \begin{aligned}2x^2-18 &= 0 \\ 2x^2 &= 18 \\ x^2 &= 9 \\ x &= \pm 3\end{aligned} but we have defined that $$x>0$$ and therefore are only interested in the case $$x=3$$. Let's draw a table:

$$x<3$$ $$x>3$$
$$f'(x)$$ $$<0$$ $$>0$$
$$f(x)$$ decr. incr.

As the function $$f$$ is continuous, we now know that it attains its minimum at the point $$x=3$$. Now we calculate the other side of the rectangle: $$y=\frac{9}{x}=\frac{9}{3}=3$$.

Thus, the rectangle, which has the least possible perimeter is actually a square, which sides are of the length $$3$$.

##### Example 5.

We must make a one litre measure, which is shaped as a right circular cylinder without a lid. The problem is to find the best size of the bottom and the height so that we need the least possible amount of material to make the measure.

Let $$r > 0$$ be the radius and $$h > 0$$ the height of the cylinder. The volume of the cylinder is $$1$$ dm$$^3$$ and we can write $$\pi r^2 h = 1$$ from which we get $h = \frac{1}{\pi r^2}.$

The amount of material needed is the surface area $A_{\text{bottom}} + A_{\text{side}} = \pi r^2 + 2 \pi r h = \pi r^2 + \frac{2 \pi r}{\pi r^2} = \pi r^2 + \frac{2}{r}.$

Let function $$f: (0, \infty) \to \mathbb{R}$$ be defined by $f(r) = \pi r^2 + \frac{2}{r}.$ We must find the minimum value for function $$f$$, which is continuous and differentiable, when $$r>0$$. Using the reciprocal rule, we get $f'(r) = 2\pi r -2 \cdot \frac{1}{r^2} = \frac{2\pi r^3 - 2}{r^2}.$ Now $$f'(r) = 0$$, when \begin{aligned}2\pi r^3 - 2 &= 0 \\ 2\pi r^3 &= 2 \\ r^3 &= \frac{1}{\pi} \\ r &= \frac{1}{\sqrt[3]{\pi}}.\end{aligned}

Let's draw a table:

$$r<\frac{1}{\sqrt[3]{\pi}}$$ $$r>\frac{1}{\sqrt[3]{\pi}}$$
$$f'(r)$$ $$<0$$ $$>0$$
$$f(r)$$ decr. incr.

As the function $$f$$ is continuous, we now know that it gets its minimum value at the point $$r= \frac{1}{\sqrt[3]{\pi}} \approx 0.683$$. Then $h = \frac{1}{\pi r^2} = \frac{1}{\pi \left(\frac{1}{\sqrt[3]{\pi}}\right)^2} = \frac{1}{\frac{\pi}{\pi^{2/3}}} = \frac{1}{\sqrt[3]{\pi}} \approx 0.683.$

This means that it would take least materials to make a measure, which is approximately $$2 \cdot 0.683$$ dm $$= 1.366$$ dm $$\approx 13.7$$ cm in diameter and $$0.683$$ dm $$\approx 6.8$$ cm high.