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
and a point
in the domain of
. How can we find the
tangent line
to the graph of
at the point (
,
) 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]);
The black curve is the graph of the function
, where
, and the red line is the tangent line to the graph of
at at
. You can see on the picture what is meant by a tangent line: it is the line which intersects the graph of
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
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
, 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);
>
s := x-> f(1) + m*(x - 1) ;
>
plot([f(x),s(x)], x=-1..4, colour=[black,red]);
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;
>
SecantLine := (a,b) -> f(a) + ( (f(b)-f(a)) / (b-a) ) * (x-a);
>
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));
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
fixed, and replace the value
with
. 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);
>
f := x-> 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 (
,
) and (
,
) is
, and we write
Slope of the tangent line at (
,
) =
.
The symbol to the right of the equals sign is read as "the limit as
goes to 0", and indicates that we are to consider what happens to the next expression as
becomes very small (close to 0). Of course, we can never put
, becase then we would be dividing by 0; the point is that the quotient behaves nicely when
is very small (presumably because the numerator is also small when
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
-axis so that its position at any time
is given by the expression
. For example, we might have
, or
. (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
, using the elementary formula "Distance = Rate times Time". The distance travelled during the interval
is
, and dividing by the elapsed time gives
Average velocity during the time interval
=
.
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 ;
>
av(s,1,5);
(You should check this result by hand.) Of course, our problem is not to compute the average velocity over some time interval
, but to compute the instantaneous velocity at some time
. The solution is to compute the average velocities over shorter and shorter time intervals near
. 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);
Experiment with a few more intervals, and convince yourself that the average velocity over a short time interval near
is very close to 2. Of course, we can never actually let
:
>
av(s,1,1);
Error, (in av) division by zero
but the point is that the average velocities behave nicely as
approaches
. We say that the average velocities have a
limit
as
approaches
, and it makes sense to define the instantaneous velocity at
to be this limit:
Instantaneous velocity at time
=
.
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
by
, so that
, and the limit becomes
Instantaneous velocity at time
=
.
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
. Here is the picture for the position function
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 ;
>
plot([s(t),s(1)+2*(t-1)], t=-1..3, colour=[black,red]);
>
To summarise: we have seen two uses for the limit
. Its geometric interpretation is the slope of the tangent line to graph of
at the point (
,
). If
represents the position of an object, then this limit represents the instantaneous velocity at time
. These are both examples of the same idea: the limit represents the
instantaneous rate of change
of the function
. Something this useful should be given a name. Our limit is called the
derivative
of
(at
), and is denoted
' (
) . (
Maple
uses the symbol
D(f)
instead of
' .) Since the value of the limit will depend on
, it is actually a function, and we will emphasise this by dropping the subscript and just writing
' (
) =
.
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 ;
>
f1 := D(f);
>
D(f)(.1);
>
D(f)(1);
>
D(f)(0);
>
g := x-> x^2 ;
>
D(g)(1);