# Mean value theorem and first derivative test

## 2812 days ago by chrisphan

html("<h1>Example 1</h1>Consider the function $f(x) = 1/x$ on the interval $[1, 4]$. Note $$\\frac{f(4) - f(1)}{4 - 1} = -\\frac{1}{4}.$$ By the mean value theorem, there exists a point $c \in [1,4]$<br />such that $f'(c) = -1/4$. We can actually find such a $c$ in this case: $c = 2$.") f = lambda x: 1/x g = lambda x: (-1/4) * (x - 2) + f(2) show(plot(f, 0.01, 5, rgbcolor=(1, 0, 0)) + line([(1, f(1)), (4, f(4))]) + plot(g, 1.25, 2.75, rgbcolor=(0, 0.5, 0)) + point((2, f(2)), size=40), xmin = 0, xmax = 5 , ymin=0, ymax=1.2)

# Example 1

Consider the function f(x) = 1/x on the interval [1, 4]. Note
\frac{f(4) - f(1)}{4 - 1} = -\frac{1}{4}.
By the mean value theorem, there exists a point c \in [1,4]
such that f'(c) = -1/4. We can actually find such a c in this case: c = 2.

# Example 1

Consider the function f(x) = 1/x on the interval [1, 4]. Note
\frac{f(4) - f(1)}{4 - 1} = -\frac{1}{4}.
By the mean value theorem, there exists a point c \in [1,4]
such that f'(c) = -1/4. We can actually find such a c in this case: c = 2.

html("<h1>Example 2</h1>Any two functions with the same derivatives<br />everywhere will have the same graph except shifted vertically.") f = lambda x: (1/10)*(x-2)*(x-1)*(x+3)*(x+5) g = lambda x: f(x) + 6 df = lambda x: 1/10*(x - 2)*(x - 1)*(x + 3) + 1/10*(x - 2)*(x - 1)*(x + 5) + 1/10*(x - 2)*(x + 3)*(x + 5) + 1/10*(x - 1)*(x + 3)*(x + 5) def tanlines(a): dx = 0.5 return plot(lambda x: df(a)*(x - a) + f(a), a-dx, a+dx) + plot(lambda x: df(a)*(x - a) + g(a), a-dx, a+dx) + point([(a, f(a)), (a, g(a))], size=40) plts = plot(f, -5.5, 3, rgbcolor=(0.75, 0, 0)) + plot(g, -5.5, 3, rgbcolor=(0, 0.5, 0)) frms = [plts + tanlines(a) for a in srange(-5.5, 3, 0.25)] anim = animate(frms, xmin = -5.5, xmax = 3, ymin = -3, ymax= 15) show(anim)

# Example 2

Any two functions with the same derivatives
everywhere will have the same graph except shifted vertically.

# Example 2

Any two functions with the same derivatives
everywhere will have the same graph except shifted vertically.
html("<h1>Example 3</h1>Let $f(x) = 2x^3 - 3x^2 - 12x + 4$. Then $f'(x) = 6x^2 - 6x - 12$.<br />") f = lambda x: 2*x^3 - 3*x^2 - 12*x + 4 df = lambda x: 6*x^2 - 6*x - 12 pltsf = plot(f, -2.5, -1, rgbcolor=(0, 0.75, 0)) + plot(f, -1, 2, rgbcolor=(0.75, 0, 0))+ plot(f, 2, 3.5, rgbcolor=(0, 0.75, 0)) pltsdf = plot(df, -2.5, -1, rgbcolor=(0, 0.75, 0)) + plot(df, -1, 2, rgbcolor=(0.75, 0, 0))+ plot(df, 2, 3.5, rgbcolor=(0, 0.75, 0)) html("Here is a plot of $y = f'(x)$, showing where the function is negative and positive:") show(pltsdf) html("Here is a plot of $y = f(x)$. When $f'(x) < 0$, $f$ is decreasing.<br />When $f'(x) > 0$, $f$ is increasing.") show(pltsf) html("Also, you can use where the derivative changes signs to find the local extrema.<br/>There is a local max at $x = -1$ and a local min at $x = 2$.")

# Example 3

Let f(x) = 2x^3 - 3x^2 - 12x + 4. Then f'(x) = 6x^2 - 6x - 12.
Here is a plot of y = f'(x), showing where the function is negative and positive:
Here is a plot of y = f(x). When f'(x) < 0, f is decreasing.
When f'(x) > 0, f is increasing.
Also, you can use where the derivative changes signs to find the local extrema.
There is a local max at x = -1 and a local min at x = 2.

# Example 3

Let f(x) = 2x^3 - 3x^2 - 12x + 4. Then f'(x) = 6x^2 - 6x - 12.
Here is a plot of y = f'(x), showing where the function is negative and positive:
Here is a plot of y = f(x). When f'(x) < 0, f is decreasing.
When f'(x) > 0, f is increasing.
Also, you can use where the derivative changes signs to find the local extrema.
There is a local max at x = -1 and a local min at x = 2.

# Example 7

Let
f(x) = x^3+1
Then
f'(x) = 3x^2
Here is a plot of y = f'(x), showing where the function is negative and positive:
Here is a plot of y = f(x). When f'(x) < 0, f is decreasing.
When f'(x) > 0, f is increasing.
Also, you can use where the derivative changes signs to find the local extrema.
There are no local extrema.

# Example 7

Let
f(x) = x^3+1
Then
f'(x) = 3x^2
Here is a plot of y = f'(x), showing where the function is negative and positive:
Here is a plot of y = f(x). When f'(x) < 0, f is decreasing.
When f'(x) > 0, f is increasing.
Also, you can use where the derivative changes signs to find the local extrema.
There are no local extrema.
html("<h1>Example 7</h1>Let $$f(x) = \\frac{3x+1}{x^2+2}. Then$$f'(x) = \\frac{-3x^2 - 2x + 6}{(x^2+2)^2}") f = lambda x: (3*x+1)/(x^2 + 2) df = lambda x: (-3*x^2 - 2*x + 6)/(x^2 + 2)^2 a = (sqrt(19)-1)/3 b = (-sqrt(19) - 1)/3 pltsf = plot(f, b, a, rgbcolor=(0, 0.75, 0)) + plot(f, -4, b, rgbcolor=(0.75, 0, 0)) + plot(f, a, 4, rgbcolor=(0.75, 0, 0)) pltsdf = plot(df, b, a, rgbcolor=(0, 0.75, 0)) + plot(df, -4, b, rgbcolor=(0.75, 0, 0)) + plot(df, a, 4, rgbcolor=(0.75, 0, 0)) html("Here is a plot of $y = f'(x)$, showing where the function is negative and positive:") show(pltsdf) html("Here is a plot of $y = f(x)$. When $f'(x) < 0$, $f$ is decreasing.<br />When $f'(x) > 0$, $f$ is increasing.") show(pltsf) html("Also, you can use where the derivative changes signs to find the local extrema.<br/>The local max is at $x =" + latex(a) + "$ and the local min is at $x = " + latex(b) + "$.")

# Example 7

Let
f(x) = \frac{3x+1}{x^2+2}
Then
f'(x) = \frac{-3x^2 - 2x + 6}{(x^2+2)^2}
Here is a plot of y = f'(x), showing where the function is negative and positive:
Here is a plot of y = f(x). When f'(x) < 0, f is decreasing.
When f'(x) > 0, f is increasing.
Also, you can use where the derivative changes signs to find the local extrema.
The local max is at x =\frac{1}{3} \, \sqrt{19} - \frac{1}{3} and the local min is at x = -\frac{1}{3} \, \sqrt{19} - \frac{1}{3}.

# Example 7

Let
f(x) = \frac{3x+1}{x^2+2}
Then
f'(x) = \frac{-3x^2 - 2x + 6}{(x^2+2)^2}
Here is a plot of y = f'(x), showing where the function is negative and positive:
Here is a plot of y = f(x). When f'(x) < 0, f is decreasing.
When f'(x) > 0, f is increasing.
Also, you can use where the derivative changes signs to find the local extrema.
The local max is at x =\frac{1}{3} \, \sqrt{19} - \frac{1}{3} and the local min is at x = -\frac{1}{3} \, \sqrt{19} - \frac{1}{3}.