The Mean Value Theorem (MVT) is proved by writing the equation of a function giving the (directed) length of a segment from the given function to the line between the endpoints as you can see here. Since the function and the line intersect at the endpoints of the interval this function satisfies the hypotheses of Rolle’s theorem and so the MVT follows directly. This means that the derivative of the distance function is zero at the points guaranteed by the MVT. Therefore, these values must also be the location of the local extreme values (maximums and minimums) of the distance function on the open interval. *

Here is an exploration with three similar examples that use this idea to foreshadow the MVT. You, of course, can use your own favorite function. Any differentiable function may be used, in which case a CAS calculator may be helpful. Answers are at the end.

First example:

Consider the function $f(x)=x+2\sin (\pi x)$ defined on the closed interval [–1,3]

1. Write the equation of the line through the endpoints of the function.
2. Write an expression for h(x) the vertical distance between f(x) and the line found in part 1.
3. Find the x-coordinates of the local extreme values of h(x) on the open interval (–1,3).
4. Find the slope of f(x) at the values found in part 3.
5. Compare your answer to part 4 with the slope of the line. Is this a coincidence?

Second example: slightly more difficult than the first.

Consider the function $f\left( x \right)=1+x+2\cos \left( x \right)$ defined on the closed interval $\left[ {\tfrac{\pi }{2},\tfrac{{9\pi }}{2}} \right]$

1. Write the equation of the line through the endpoints of the function.
2. Write an expression for h(x) the vertical distance between f(x) and the line found in part 1.
3. Find the x-coordinates of the local extreme values of h(x) on the open interval $\left( {\tfrac{\pi }{2},\tfrac{{9\pi }}{2}} \right)$
4. Find the slope of f(x) at the values found in part 3.
5. Compare your answer to part 4 with the slope of the line. Is this a coincidence?

Third example: In case you think I cooked the numbers

Consider the function $\displaystyle f(x)={{x}^{3}}$ defined on the closed interval $\displaystyle [-4.5]$

1. Write the equation of the line thru the endpoints of the function.
2. Write an expression for h(x) the vertical distance between f(x) and the line found in part 1.
3. Find the x-coordinates of the local extreme values of h(x) on the open interval $\displaystyle (-4,5)$
4. Find the slope of f(x) at the values found in part 3.
5. Compare your answer to part 4 with the slope of the line. Is this a coincidence?

First example:

1. y = x
2. $\displaystyle h(x)=f(x)-y(x)=\left( {x+2\sin (\pi x)} \right)-\left( x \right)=2\sin (\pi x)$
3. ${h}'\left( x \right)=2\pi \cos \left( {\pi x} \right)=0$ when x = –1/2, ½, 3/2 and 5/2
4. $\displaystyle {f}'\left( x \right)=1+2\pi \cos \left( {\pi x} \right)$, the slope = 1 at all four points
5. They are the same. Not a coincidence.

Second example:

1. The endpoints are $\left( {\tfrac{\pi }{2},1+\tfrac{\pi }{2}} \right)$ and $\left( {\tfrac{{9\pi }}{2},1+\tfrac{{9\pi }}{2}} \right)$; the line is $y=x+1$
2. $h\left( x \right)=f\left( x \right)-y\left( x \right)=\left( {1+x+2\cos (x)} \right)-\left( {x+1} \right)=2\cos \left( x \right)$
3. ${h}'\left( x \right)-2\sin (x)=0$ when $x=\pi ,2\pi ,3\pi ,\text{ and }4\pi$
4. ${f}'\left( x \right)=1-2\sin \left( x \right)$, at the points above the slope is 1.
5. They are the same. Not a coincidence.

Third example:

1. The endpoints are (-4, -64) and (5, 125), the line is $\displaystyle y=125+21(x-5)=21x+20$
2. $\displaystyle h(x)={{x}^{3}}-21x-20$
3. $\displaystyle {h}'(x)=3{{x}^{2}}-21=0$ when $\displaystyle x=\sqrt{7},-\sqrt{7}$
4. $\displaystyle {f}'\left( {\pm \sqrt{7}} \right)=3{{\left( {\pm \sqrt{7}} \right)}^{2}}=21$
5. They are the same. Not a coincidence.

* It is possible that the derivative is zero and the point is not an extreme value. This is similar to the situation with a point of inflection when the first derivative is zero but does not change sign.