Subsections

# Derivatives

## Purpose

The purpose of this lab is to teach you how to use Maple to find and plot tangent lines.

## Background

### The Maple D and diff commands

These commands can be summarized as follows.
• The D operator acts on a function to produce the derivative of that function.
• The diff command acts on an expression and differentiates that expression with respect to a variable specified by the user.

When you use the D operator to compute the derivative of a function, the result is also a function, as shown below.

> D(f);

If you provide a label, then you get a function you can use later in the session,
> df := D(f);

However, this is usually not necessary. See the examples below.

If you want to evaluate the derivative at a specific value of or just get the expression for the derivative, you can use the following forms of the D operator.

> D(f)(2);
> D(f)(x);

This last form is the one to use for plotting, as shown below.
> plot(D(f)(x),x=-2..2);


Suppose you want to find the equaton of the line tangent to the graph of at the point . This can be done in Maple using the point slope form of a line as shown below.

> tanline := D(f)(5)*(x-5)+f(5);
> plot([f(x),tanline],x=0..10);


The D operator cannot be used on expressions, for example trying to use it to differentiate the expresssion we defined above results in an error.

> D(p);

If you recall that Maple uses f(x) to refer to the expresssion that is used to define , then the following error shouldn't surprise you.
> D(f(x));


To differentiate expressions, you need to use the diff command. Here is an example.

> diff(p,x);

The diff command can also be applied to functions as shown below.
> diff(f(x),x);

Note, however, that the result of the diff command is an expression, not a function. This means that computing the value of the derivative at a specific value of requires you to use the subs command as follows:
> der := diff(p,x);
> subs(x=Pi/2,der);

Suppose you want to find the equaton of the line tangent to the graph of at the point . This can be done in Maple using the point slope form of a line as shown below.
> f:=x->ln(x);
> tanline := D(f)(5)*(x-5)+f(5);
> plot([f(x),tanline],x=0..10);


## Exercises

1. Find the equation of the line tangent to the graph of the function at . When calculating the derivative at a point, use the command. Include a plot of the function and the tangent line on the same graph over the interval .

2. The tangent line to a function at a particular value of x intersects the graph of the function at least once, at the point of tangency. However, the tangent line may intersect the graph at other points. In this problem, we investigate whether the tangent line at one point can also be tangent to the graph at another point. For example, consider the function

Show that the tangent line to at is also tangent to the graph at by finding the equation of both lines and plotting on the same graph as the function. Use plotting ranges and .

Next, suppose we change the function slightly.

Is it still possible to find two different values of such that the tangent lines coincide? The answer is yes. Find them and plot the function and tangent line on the same graph over the interval .

3. Find the equation of the tangent line to

at the point . Find another point on the graph that has the same slope as this point. Find the equation of the line tangent to at this point. Plot the function and both tangent lines on the same graph.