Application Center - Maplesoft

App Preview:

Calculus I: Lesson 4: Definition of the Derivative

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

L4-derivativeDefinition.mws

Calculus I

Lesson 4: Definition of the Derivative

In this worksheet, you will see how to solve two problems: the mathematical problem of finding the tangent line to the graph of a function, and the physical problem of defining the velocity of a moving object. Although these problems might seem unrelated at first, it will turn out that they both lead to the same mathematical concept: the derivative of a function.

> restart;

Suppose we are given a function f and a point x[0] in the domain of f . How can we find the tangent line to the graph of f at the point ( x[0] , f(x[0]) ) on the graph? Here is a picture of the sort of thing we are after. (Concentrate on the picture, and don't worry for now about the commands that produce it.)

> f := x-> x^2:
f1 := D(f):
t := x-> f(1) + f1(1)*(x - 1):

> plot([f(x),t(x)], x=-1..3, colour=[black,red]);

[Maple Plot]

The black curve is the graph of the function f , where f(x) = x^2 , and the red line is the tangent line to the graph of f at at x[0] = .1 . You can see on the picture what is meant by a tangent line: it is the line which intersects the graph of f at the given point, and is "parallel" to the graph at that point. It is important to realise that this is the only information we have about the tangent line. In particular, we do not know that the tangent line will intersect the graph of f a second time.

The tangent line problem, then is to find the equation of a line when we only know one point on the line. Of course, if we also knew the slope of the line, we could write down its equation in point-slope form, so the problem becomes: how do we find the slope of the tangent line?

The solution is to introduce a second point. If we are given two points on the graph of f , we can easily find the equation of the line joining them. (A line joining two points on a graph is called a secant line. ) You should be able to see what the following commands are doing.

> m := (f(3) - f(1))/(3 - 1);

m := 4

> s := x-> f(1) + m*(x - 1) ;

s := proc (x) options operator, arrow; f(1)+m*(x-1)...

> plot([f(x),s(x)], x=-1..4, colour=[black,red]);

[Maple Plot]

We chose x=2 as the second point. Let's examine what happens as this point is chosen closer and closer to the starting point x=1.

> c := 1; left := c-1; right := c+1;

c := 1

left := 0

right := 2

> SecantLine := (a,b) -> f(a) + ( (f(b)-f(a)) / (b-a) ) * (x-a);

SecantLine := proc (a, b) options operator, arrow; ...

> plots[display](plot(f(x), x= -1..4, color = black, thickness=2),
plot({SecantLine(c, c + 2/k) $ k =1..6 }, x= -1..4, color = red));

[Maple Plot]

Since we can draw the secant line through any two points on the graph, we could now hold one of the points fixed and move the other one towards it along the graph. (Try this by editing the commands above: keep the value x = 1 fixed, and replace the value x = 2 with x = 1.5 . Experiment with other values, too.) We can let the two points come as close together as we like, but of course we can never let them become equal, because then our expression for the slope of the line becomes undefined.

Rather than experiment with just a few values, we can animate the whole procedure , and watch what happens as the two points

come together. Here is a Maple procedure which will do this for any function.

The values of a and h give the fixed x -value and the initial h -value. h can be any real number, positive or negative, but gives the best results if its absolute value is relatively small.

The following commands create the various components of the animation.

> animateSecant := proc( f, a, h )
local n, Background, Mover, Secants;

n := 30;

Background:=plots[display](plots[pointplot]({[a,f(a)],[a,0]},symbol=circle),
plot(f(x),x=(a-(h+signum(h)*1))..(a+(h+signum(h)*1)))):
Mover:=plots[display](seq( plots[pointplot]({[a+(n-i)/(n/h), f(a+(n-i)/(n/h))], [ a+(n-i)/(n/h),0]},symbol=circle,color=blue),i=0..n-1),
insequence=true):
Secants:=plots[display](seq( plot((f(a+(n-i)/(n/h))-f(a))/(n-i)*(n/h)*(x-a)+f(a), x=(a-(h+signum(h)*1))..(a+(h+signum(h)*1)),color=blue),i=0..n-1),
insequence=true):

plots[display](Secants,Background,Mover);
end proc:

Now, we are ready to display the animation. Remember, to run the animation just select the plot and use the animation toolbar or the Animation menu.

> animateSecant(f, 1, 3);

[Maple Plot]

> f := x-> 3*(1-x)*x^2 ;

f := proc (x) options operator, arrow; 3*(1-x)*x^2 ...

You can see that as the moving point approaches the fixed one, the secant line swings round and approaches the tangent line.

Presumably, therefore, its slope approaches the slope of the tangent line. We say that the slope of the tangent line is the limit of the slope of the secant line. In symbols, the slope of the secant line through the points ( x[0] , f(x[0]) ) and ( x[0]+h , f(x[0]+h) ) is

(f(x[0]+h)-f(x[0]))/h , and we write

Slope of the tangent line at ( x[0] , f(x[0]) ) = limit((f(x[0]+h)-f(x[0]))/h,h = 0) .

The symbol to the right of the equals sign is read as "the limit as h goes to 0", and indicates that we are to consider what happens to the next expression as h becomes very small (close to 0). Of course, we can never put h = 0 , becase then we would be dividing by 0; the point is that the quotient behaves nicely when h is very small (presumably because the numerator is also small when h is small.)

> restart;

Now let's look at our other problem: how do we define the instantaneous velocity of a moving object? To be precise, let's suppose that we have an object moving along the x -axis so that its position at any time t is given by the expression s(t) . For example, we might have s(t) = t^2 , or s(t) = sin(t) . (How does the object move in these two cases?)

We can start by observing that there is no difficulty in defining the average velocity of the object during some time interval [t[0], t[1]] , using the elementary formula "Distance = Rate times Time". The distance travelled during the interval [t[0], t[1]] is s(t[1])-s(t[0]) , and dividing by the elapsed time gives

Average velocity during the time interval [t[0], t[1]] = (s(t[1])-s(t[0]))/(t[1]-t[0]) .

Here is a simple procedure to compute (decimal approximations to) average velocities:

> av := proc(s,t0,t1) evalf((s(t1) - s(t0))/(t1 - t0)) end proc:

We can now define a position function and compute average velocities.

> s := t-> t^2 ;

s := proc (t) options operator, arrow; t^2 end proc...

> av(s,1,5);

6.

(You should check this result by hand.) Of course, our problem is not to compute the average velocity over some time interval [t[0], t[1]] , but to compute the instantaneous velocity at some time t[0] . The solution is to compute the average velocities over shorter and shorter time intervals near t[0] . Here are some examples with our last position function.

> av(s,1,2); av(s,1,1.5); av(s,1,1.1); av(s,1,1.01);

3.

2.500000000

2.100000000

2.010000000

Experiment with a few more intervals, and convince yourself that the average velocity over a short time interval near t[0] = 1 is very close to 2. Of course, we can never actually let t[1] = t[0] :

> av(s,1,1);

Error, (in av) division by zero

but the point is that the average velocities behave nicely as t[1] approaches t[0] . We say that the average velocities have a limit as t[1] approaches t[0] , and it makes sense to define the instantaneous velocity at t[0] to be this limit:

Instantaneous velocity at time t[0] = limit((s(t[1])-s(t[0]))/(t[1]-t[0]),t[1] = t[0]) .

Now, this is exactly the same limit we saw in the tangent line problem. You can see this with a simple substitution: define a new variable h by h = t[1]-t[0] , so that t[1] = t[0]+h , and the limit becomes

Instantaneous velocity at time t[0] = limit((s(t[0]+h)-s(t[0]))/h,h = 0) .

This suggests that we might be able to interpret the instantaneous velocity as the slope of the tangent line to some graph. In fact, comparing the limits from our two problems, it is clear that the instantaneous velocity is the slope of the tangent line to the graph of the position function s . Here is the picture for the position function s(t) = t^2 that we were using above. You should be able to see that the tangent line at the point (1,1) has slope 2, as we would expect from our calculations of average velocity.

> s := t-> t^2 ;

s := proc (t) options operator, arrow; t^2 end proc...

> plot([s(t),s(1)+2*(t-1)], t=-1..3, colour=[black,red]);

[Maple Plot]

>

To summarise: we have seen two uses for the limit limit((f(x[0]+h)-f(x[0]))/h,h = 0) . Its geometric interpretation is the slope of the tangent line to graph of f at the point ( x[0] , f(x[0]) ). If f represents the position of an object, then this limit represents the instantaneous velocity at time x[0] . These are both examples of the same idea: the limit represents the instantaneous rate of change of the function f . Something this useful should be given a name. Our limit is called the derivative of f (at x[0] ), and is denoted f ' ( x[0] ) . ( Maple uses the symbol D(f) instead of f ' .) Since the value of the limit will depend on x[0] , it is actually a function, and we will emphasise this by dropping the subscript and just writing

f ' ( x ) = limit((f(x+h)-f(x))/h,h = 0) .

For example, here are some derivatives worked out by Maple . Observe that they behave as functions should; in particular, they can be evaluated. (Do any of these values relate to earlier parts of the worksheet?)

> f := x-> 3*(1-x)*x^2 ;

f := proc (x) options operator, arrow; 3*(1-x)*x^2 ...

> f1 := D(f);

f1 := proc (x) options operator, arrow; -3*x^2+6*(1...

> D(f)(.1);

.51

> D(f)(1);

-3

> D(f)(0);

0

> g := x-> x^2 ;

g := proc (x) options operator, arrow; x^2 end proc...

> D(g)(1);

2