Laboratory 4
Mean Value Theorem
(due 11/10)

Introduction

In this laboratory, we introduce an important theorem from calculus, known as the mean value theorem or, sometimes, as Lagrange's mean value theorem. Its statement is given below. 

Theorem. Let f be a continuous function on the closed interval [a,b] that is differentiable at all points of the open interval (a,b). Then there exists a number c∈(a,b) such that
(1)		f'(c)=((f(b)-f(a))/(b-a)).

4.1. The Meaning of the Mean Value Theorem

The two sides of equation (1) are the slopes of two straight lines. The ratio on the right side is the slope of the line through the points (a,f(a)) and (b,f(b)), that is, the line connecting the two endpoints of the graph y=f(x), a≤x≤b. The derivative on the left side, on the other hand, is the slope of the tangent line to the same graph at some point (c,f(c)). So the theorem states that there is a point on the graph where the slope of the tangent line equals the slope of the line connecting the endpoints of the graph. 

For seeing examples, the command MVTvisual produces an interactive plot containing: the graph y=f(x) for a≤x≤b in black; the secant line connecting (a,f(a)) and (b,f(b)) in red; and the tangent line at the point (c,f(c)) of the graph in blue. The number c can change dynamically within a≤c≤b. Initially, c is set equal to a. The graph is initially y=(x^2)sin(2x), 1≤x≤5. Evaluate both of the cells below to use MVTvisual.

MVTvisual:=Manipulate[
Module[{func},
Clear[x];
Clear[e];
e=Exp[1];
func[x_,formula_]=Function[x,formula];
Module[{f=func[x,expr],m},
m=(f[b]-f[a])/(b-a);
line[x_]:=f[a]+m*(x-a);
Column[{TraditionalForm@Text@Style[Row[{"Secant line slope = ",m, ", c = ",c, ", f'(c) = ",f'[c]}],14],Show[Plot[{f[x],f[a]+m*(x-a),f[c]+f'[c]*(x-c)},{x,a,b},
ImageSize->{600,325},PlotRange->h,PlotStyle->{Black,Red,Blue}]]},Center]]],
{{expr,x^2*Sin[2x],"f(x)="},ControlType -> InputField},
{{a,1,"x min"},ControlType -> InputField },
{{b,5,"x max"},ControlType -> InputField },
{{h,18,"height"},ControlType->InputField},
{{c,a,"c"},a,b,Appearance->"Labeled" }]

MVTvisual

After some experimentation we see that, when c≈1.47, the blue and red lines appear parallel; hence, their slopes must be (almost) equal. Therefore, we have found that, for the function f(x)=(x^2)sin(2x), 
			f'(1.47)≈((f(5)-f(1))/(5-1)).

The mean value theorem basically says that this is not a coincidence. Since the function f(x)=(x^2)sin(2x) is continuous and differentiable on the whole real line, the mean value theorem ensures that when we replace the interval [1,5] by any other closed interval [a,b], we will be able to find a number c in that new interval such that the tangent line to the graph at c will be parallel to the secant line through (a,f(a)) and (b,f(b)). 

Here are a few pairs of intervals [a,b] and ponts c∈(a,b) that one may discover using the above procedure (for f(x) = (x^2)sin(2x)):
	c≈1.40 is acceptable for the interval [0,5];
	c≈1.26 is acceptable for the interval [-2,3];
	c≈4.125 is acceptable for the interval [3,6].
	
The theorem does not say where in the interval c may be located. In general, there is no way to predict c. Indeed, there may be more than one point c in the given interval that satisfies equation (1). For example, experimentation with the slider in the above example reveals that there are three possible candidates for c in (1,5): c≈1.47, c≈2.41 and c≈4.10.

Experiment 4.1

For each of the following functions, use the command visualMVT[] to produce a dynamic plot of the function on the given interval [a,b] together with the secant line through the endpoints of the graph and the tangent line at a "moving point" x=c. Then use that dynamic plot from to find approximately the points c∈(a,b) that satisfy the conclusion of the mean value theorem. If there is more than one such point, list all the possibilities in your answer.
(a) f(x)=(x^2) (e^(-x/2)), a=-0.5, b=3, h = 2;		(b) f(x)=((x+1)/(x-1))-2.5,a=2, b=3, h = 1;
(c) f(x)=(((x+(1/x)))^x), a=0.5, b=2, h = 8;    		(d) f(x) =cos((e^x) - 1), a=-5, b=1, h = 2.

4.2  Obtaining Better Approximations of c.

The built-in command FindRoot will allow us to find a more precise value of the point c satisfying the equation (1). In the example discussed in Section 8.1, we saw that the approximate values of c such that 
f'(c)=((f(5)-f(1))/(5-1)) are c≈1.47, c≈2.41 and c≈4.10. We now use these approximate values to get better approximations.

Clear[a,b,m,f]
f[x_]:=x^2*Sin[2x]
a=1;b=5;
m=(f[b]-f[a])/(b-a);

The command FindRoot takes an equation we need to solve and an initial guess as parameters. In our case, the equation is f'(x)=c, and the initial guesses have been obtained in Section 8.1.

FindRoot[f'[x]==m,{x,1.47}]
FindRoot[f'[x]==m,{x,2.41}]
FindRoot[f'[x]==m,{x,4.10}]

Experiment 4.2

For each of the following functions, use the results of Experiment 8.1 and the command FindRoot to determine the points c∈(a,b) that satisfy the conclusion of the mean value theorem. If there is more than one such point, list all the possibilities in your answer.
(a) f(x)=(x^2) (e^(-x/2)), a=-0.5, b=3, h = 2;		(b) f(x)=((x+1)/(x-1))-2.5,a=2, b=3, h = 1;
(c) f(x)=(((x+(1/x)))^x), a=0.5, b=2, h = 8;    		(d) f(x) =cos((e^x) - 1), a=-5, b=1, h = 2.

Credits

These laboratories were created by Raouf Boules, Geoff Goodson, Ohoe Kim and Mike O'Leary for use in the Calculus courses of Towson University. Commercial use is prohibited without permission of the authors. Non-commercial use is permitted, provided this credit section is retained.