Discussion
In the preceding section we studied the concept of the derivative of a function at a point, or at a finite number of points. Suppose that a function f has a derivative at each point in I , some interval , then we can define a new function f', the derivative function, with domain this interval I .
Definition
In the preceding section we used the Maple V commands diff and subs to calculate the derivative of a function at a point. We can also use these same commands to define the derivative function. We will now illustrate a number of ways to use Maple to create a derived function. For example, if
is given we can define the derivedfunction as follows.
> f := x -> ln(x);
> fprime := x->subs(t=x,diff(f(t),t));
Here we have used the notation
fprime
for f' since the apostrophe is unacceptable to Maple V. Now using Maple V we can plot the function along with its derived function on the same graph. Observe that in the Maple V output there appears a symbol
. This is Maple V's notation for the
, which is a standard notation for differentiation. The following notations are commonly used in calculus and in this text as equivalents:
f' =
(f) =
= D(f).
Now using Maple V we can plot the function along with its derived function on the same graph.
> plot1 := plot({f(x),fprime(x)},x=0.5..5):
> plot2 := plots[textplot]({[1,1.5,`y=D(ln x)`],[3,1.5,`y=ln x`]}
> ,align = RIGHT):
> plots[display]({plot1,plot2});
Note: It is more convenient and probably better to define fprime using unapply .
> fprime := unapply(diff(f(x),x),x);
> plot1 := plot({f(x),fprime(x)},x=0.5..5):
> plot2 := plots[textplot]({[1,1.5,`y=D(ln x)`],[3,1.5,`y=ln x`]}
> ,align = RIGHT):
> plots[display]({plot1,plot2});
If you prefer, you can also define fprime by using the Maple V D operator. Basically the command D ( f ) returns the derivative of f. Thus the following Maple V input will also return the derived function, and the same plot commands used above will result in the same figure as above.
The difference between diff and D is that diff differentiates a formula and returns a formula, while D differentiates a function and returns a function. The following Maple V segment suggests some of the differences.
> diff(sin(x),x);
> D(sin);
> D(sin)(x);
> D(sin(x));
Extracting Information About a Function From Its Derivative
We know that the value of the derivative of f at a point is equal to the slope of f at that point. This suggests that the knowledge that f' is positive at a point implies that f is increasing. This is not difficult to see from the definition. For example, suppose that f'(a) > 0 then for h small enough the difference quotient
.
This means that for small h we can conclude that the sign of f(a+h)-f(a) and h are the same. It follows that if h>0 then f(a+h)>f(a) and if h<0 then f(a+h)<f(a). The last statement implies that f is increasing near a.
Similarly, if f'(a) < 0 then f is decreasing near a.
If f'(a) > 0, then f is increasing over an interval containing a in its interior.
If f'(a) < 0, then f is decreasing over an interval containing a in its interior.
One word of warning here is that the interval containing a, mentioned in the last statement, might be very small. Later in this section we will show that if f' is positive throughout an interval, then f is increasing throughout that interval.
On the other hand, what can be said if f'(a)=0? This implies that the tangent line has 0 slope and hence the tangent line is parallel to the x-axis. What does this tell us? It turns out that there are several cases. Consider the graph of the function f(x) =
in the interval [-1,1]. We obtain its graph using Maple V.
> plot(x^3*(x^2-1),x=-1..1);
Inspection of the graph suggests that there are three points where the tangent line is parallel to the x- axis:
(1) A point a in the interval (-1,0), which is near x=-0.77.
(2) A point b near x=0.
(3) A point c in the interval (0,1), which is near x=0.77.
Referring to this plot, we see that the function f has positive slope in the intervals [-1,a) and (c,1]. Thus the derivative f' is positive over these two intervals. Moreover, the function f has negative slope everywhere in the open interval (a,c) except at the point x=b. Thus f' is negative over this interval except at x=b where it is zero. It appears that f attains a maximum value at x=a, a point where f' changes sign from positive to negative while passing through x=a from left to right. It appears that f attains a minimum value at x=c, a point where f' changes sign from negative to positive while passing through x=c from left to right. Note that the derivative does not change sign at x=b and the function f has neither a maximum or a minimum value there.
Clearly, the numbers a,b and c , the zeros of f', are important. We have found that Maple V is an excellent tool for locating zeros. So let's locate them.
> zeros := fsolve(diff(x^3*(x^2-1),x),x);
The preceding Maple V output suggests that the three points where f' is zero, a,b and c, are approximately equal to 0, -.7745966692, and .7745966692, respectively. The previous paragraph suggests that f has maximum at x=-.7745966692 and a minimum at x=.7745966692.
The point here is that it appears that we can use the derivativefunction to deduce qualitative information about the original function. For example, suppose that we have the graph of the derivative. What can we find out about the graph of the original function?
> plot(diff(x^3*(x^2-1),x),x=-1..1);
We see that f' is positive in the intervals [-1,a), (c,1], and negative in the interval (a,c) except at x=b=0, where it is zero.
Before leaving this example let us illustrate how you can plot both the function and its derivative on the same graph.
> plot({x^3*(x^2-1),diff(x^3*(x^2-1),x)},x=-1..1,y=-0.5..0.5);
Recall that a function which is defined and continuous on a closed interval attains its maximum and minimum values. If a function is defined and differentiable on an interval then it must also be continuous. If you look at the graph of a differentiable function you should notice that the tangent line appears to have 0 slope at its extreme values, i.e values where the function has a maximim or a minimum, that occur inside an interval.
Let us suppose that f is a differentiable function which is defined on an open interval and suppose f attains a (local) maximum at some point a in the interval. This means that for all h sufficiently small f(a+h)<= f(a), or f(a+h)-f(a) <= 0. Now if f'(a)>0 we know that f(a+h)-f(a) has the same sign as h for all sufficiently small h. But this contradicts the fact that f(a+h)-f(a) is one sign for all sufficiently small h. A similar contradiction occurs if we assume f'(a)<0. We have proved that if a is in an interval a is a local maximum of f then f'(a)=0. It follows by a similar argument that f'(a)=0 if a is a local minimum.
Thus if we are given a differentiable function f defined on a closed interval [a,b], and are required to find the extreme values, then we need only test the points in the interior of [a,b] where the derivative is zero and the end points.
A Method for Finding Extreme Values:
In particular if f' does not vanish the extreme values occur at the end points.
Example 2.2.1: Locate the extreme values for the function
f(x) =
on the interval [0,
].
Solution: To get an idea of the complexity involved of this problem let's define and plot f.
> f := x-> exp(-x)*cos(5*x);
> plot(f(x),x=0..3);
A study of the graph of f in the last plot indicates that there are four points where f' vanishes: at values of x near the points 0.6, 1.2, 1.85, and 2.5. To find these points to greater accuracy we find the zeros of f' in the interval (0,3). We denote f' by fprime in the following Maple V segment and plot its graph.
> fprime := D(f);
> plot(fprime(x),x=0..3);
The last plot reinforces the conjecture made above that the zeros of f' in the interval [0,3] occur near the four points 0.6, 1.2, 1.85, and 2.5. We now use fsolve to find these zeros to 10 places of accuracy. Recall that sometimes it is necessary to help fsolve find the zeros by specifying intervals. First we define a list of ranges in which we think the zeros will occur.
> L := [0..1,1..1.5,1.5..2,2..2.6];
Next we use a combination of fsolve and map to find the zeros with one more line.
> zeros := seq(fsolve(fprime(x)=0,x,M),M=L);
Now we can evaluate f at the zeros and the end points.
> map(x->evalf(f(x)),[0,zeros,3]);
>
The last Maple V output lists the functional values of f at the points in the sequence {1., -.5441938383, .2903209320, -.1548827598, .08262810794, -.03782263406 }. We conclude that the absolute maximum of f on the interval occurs at x=0 and is equal to 1. The absolute minimum of f occurs at x = 0.5888394187 and is equal to -0.5441938383.
We now state a result which is known as Rolle's Theorem.
Suppose the f is defined and continuous on a closed interval [a,b] and is differentiable on the open interval (a,b), and suppose that f(a)=f(b), then there is a point c in the open interval such that f'(c)=0.
The validity of Rolle's Theorem follows from the facts that a continuous function on a closed interval attains both its maximum and minimum values and if one of these extreme values occurs at an interior point c then f'(c)=0. Unless f is constant, the unique value of f at the end points can't be both a maximum and a minimum, so there must be an interior extreme value if f is non-constant. If f is constant then f' is zero at all points in the open interval (a,b).
Rolle's Theorem can be used to prove the following statements. These are extensions of analogous statements concerning the signs of f' at a point.
________________________________________
| If f' > 0 on an interval I , then f is increasing on I .|
| If f' < 0 on an interval I , then f is decreasing on I .|
The results in the box follow from the fact that if f is not monotone in the interval
I
, then there are points
and
in
I
such that
. Thus by Rolle's Theorem f' must vanish at some point of the interval. But the hypotheses imply that f' never vanishes in
I
.
Suppose that f is defined and continuous on the closed interval [a,b], and differentiable on the open interval (a,b). Then if we apply Rolle's Theorem to the function
we can conclude the following.
The Mean Value Theorem
f(b) - f(a) = f'(c)(b-a).
Suppose f is defined and differentiable in an interval I and a is an interior point of I . We have seen that if f has an extreme value at x=a, then necessarily f'(a)=0. Is there an analytic way to decide whether x=a is a (local) maximum or (local) minimum without actually evaluating f at all the points in a small interval about a? The answer is yes. As an example, suppose that f is a function with a graph like the one we have already done for the function
and which is shown again below.
Suppose also that the graph of f' is the following:
From the graph of f and the analysis that we have already performed we know that f has two local maxima in the open interval (0,3): one near x=1.22 and one near x=2.47. There are two local minima: one near x=0.59 and one near x=1.85. These extreme values occur at the zeros of f'. Study the graph of f'in the last figure, and observe that at the points where the local maxima occur f' is in an interval in which f' is decreasing from positive to negative values. On the other hand, the local minima occur at points where f' is increasing from negative to positive. Now, think about this problem for a general f. Suppose that we know that f' is decreasing from positive to negative values at an interior point x=a as x varies from left to right through a and with f'(a)=0. Then f(a) must take on a local maximum value, since in an interval to the left of a, f is increasing and to the right of a, f decreases. Similarly if the derivative f' increases from negative to positive as x varies from left to right through a, then f(a) must be a local minimum value. The following summarizes this discussion.
Conditions for Local Extreme Values
If f'(a)=0 and f'(x) < 0 for all values of x less than but near to a, and f'(x)>0 for all values of x greater than but near to a, then the function f has a local minimum at x=a.
Let f be defined and differentiable in an interval
I
. Then we have the derivative function f' which has domain
I
. Since this is a real valued function it can be analyzed using the tools of calculus. We have already drawn graphs of some derived functions. We can also ask whether the derivative functions have limits, are continuous, or, in particular are differentiable. Let's consider the function
which we considered earlier in this section. We use Maple V to compute not only the derivative of f but the derivative of the derivative function, f''.
> f := x->x^3*(x^2-1);
Maple V output is suppressed, through the use of the colon, in the next two statements since, for this problem, we are not actually interested in what the formulas for f' and f'' look like.
> fprime := D(f):
> fprimeprime := D(fprime):
We have used fprime and fprimeprime for f' and f'' respectively. Other equivalent Maple V statements for computing f'' would be:
> fprimeprime := D(D(f)):
> fprimeprime := (D@@2)(f):
Now we will plot f, f ' and f'' all together.
> plot({f,fprime,fprimeprime},-1..1,-4..4);
>
Compare the last Maple V plot, (graphs of f, f' and f'' ), with previous plots , (graph of f ), and (graphs of f, and f'). You should be able to identify each of the three curves in the last plot. The negative zero of f' is a point where the local maximum occurs for f. Note that f' is decreasing through this zero. Note also that f'' is negative at this point. This could have been predicted since when f'', the derivative function of f', is negative in an interval we know that f' is decreasing in that interval. Thus we could have predicted that this zero of f' would be a local maximum of f. Note also that if f'' is positive in an interval, then f' is increasing. Thus if f'' is positive at a point where f' is zero then f is a local minimum.
More Conditions for Local Extreme Values (The Second Derivative Test)
Example 2.2.2: Find the local extreme values for the function
in the interval [0,10].
Solution: By Applying Maple V along with the foregoing discussion this problem can be dealt with quite nicely. First enter the function.
> f := x->x^3-18*x^2+96*x;
The places to look for extrema are those points where f' vanishes.
> cpoints := solve(D(f)(x)=0,x);
Thus the derivative f' vanishes at x=4 and x=8. We want to make sure that these are the only zeros of f' in the interval [0,10]. One way to lend credence to this is to examine the graph of f'.
> plot(D(f)(x),x=0..10);
The graph indicates that there are only two zeros of f' in the interval. Now let's check the sign of f'' at these points.
> d2 := map((D@@2)(f),[cpoints]);
> map(f,[cpoints]);
Thus the function f has a local minimum at x=8 with f(8)=128, and a local maximum at x=4 with value f(4)=160.
Now let's plot a graph of f in the interval (0,10) to confirm these conclusions geometrically.
> plot(f(x),x=0..10);
>
We have seen that the sign of the second derivative at a point where the first derivative vanishes can be used to classify the point as to whether it is a relative maximum or minimum. What can be determined about the sign of the derivative f' if we know the sign of the second derivative f'' over an interval? In particular, we can easily conclude the following about f' in an interval if we know the sign of f'' in that interval.
If the second derivative f'' > 0 on an interval I , then the first derivative f' is increasing on I .
If the second derivative f'' < 0 on an interval I , then the first derivative f' is decreasing on I .
What does this tell us about the function f? If f' is increasing in an interval, then the slope of the curve y=f(x) is getting larger as x increases through the interval
i.e
., the graph of the curve always lies above its tangent. We illustrate this with a plot of the function
along with its tangent lines at points (
i
,
) where i=-4,-3,..,3,4.
We end this worksheet with plot of f(x) = x^2 along with its tangent lines
at points (
) where i = -4, -3, ... 3, 4.
> P := seq(plot({x^2,(2*t)*(x-t)+t^2},x=-4..4,y=-2..16),t=-4..4):
> plots[display]({seq(P[i],i=1..9)});
>
The last plot illustrates a typical situation in which the second derivative is positive on an interval. When the graph of y=f(x) is curving upward like in the figure, i.e ., always lies above its tangent line throughout an interval, we say that it is concave up on the interval. Similarly, if the graph of the curve y=f(x) is curving downward i.e ., always lies below its tangent throughout an interval, we say the that it is concave down . Thus we can conclude the following:
If the second derivative f'' > 0 on an interval I , then f is concave u p on I .
If the second derivative f'' < 0 on an interval I , then f is concave down on I .
As was mentioned in the proof of Rolle's Theorem, a constant function defined on an interval has a derivative which is identically zero. Do you see why? Now what happens if the first derivative f' is zero at all points in an interval? Can it be non constant? Suppose f' is zero throughout an interval
I
. Let
and
be in
I
with
, then the Mean Value Theorem implies that there is a number c in the interval (
) such that
=f'(c)(
)=0.
This means that every two points in I have the same value, i.e ., f is a constant function.
If the first derivative f' = 0, on an interval I , then f is constant on I .