> restart;

Partial Derivatives and Tangent Planes

First be sure to execute the following command:

> with(plots):

Cross-sections, partial derivatives and tangent planes

Let's consider a function of two variables and its graph. Since we will want to combine the graph with other graphic elements, we will give the plot a name, "func," and then use the display command to put it on the screen. Use a colon rather than a semicolon when defining "func" to prevent a screenful of garbage. .

> f:=(x,y)->x^2 - x*y^2/4;

[Maple Math]

> func:=plot3d(f(x,y), x=-3..3,y=-3..3,axes = boxed):
display(func);

[Maple Plot]

>

Note how we used the axes=boxed option. Now we look closely at the function f at one specific point. Let's
start with the point (x,y)=(-2,1). We want to understand how z=f(x,y) changes near (-2,1). If we hold y fixed at the value 1 then z can be thought of as function of x alone. In order to picture this function we will draw the plane through (-2,1,f(-2,1)) =(-2,1,9/2) on which the y coordinate is fixed at 1. We give the plot of this plane the name "yconstant", color it yellow, and display it. We use a different form of the
plot3d command, the parametric form to create yconstant. You will learn more about this later.

> yconstant:=plot3d([x,1,z], x=-3..3,z=-3..16,color=yellow):
display(yconstant,axes=boxed);

[Maple Plot]

We can now display the graph of our function f and this plane together:

> display(func,yconstant);

[Maple Plot]

>

Use the mouse to rotate the plot above so that the numbers on the x axis increase from left to right, and so you can clearly see the intersection of the function graph with the yellow y=1 plane. The point (-2,1,9/2) lies on the yellow plane. You can think of the intersection as the graph of the function z= f(x,1). In fact, we can plot the graph of this function which is, of course, what we have called a cross-section of the function f.

> plot(f(x,1),x=-3..3, z=-3..15);

[Maple Plot]

>

The slope at x=-2 appears to be about -1 so that when (x,y)=(-2,1), and y is held fixed at 1, the derivative of z with respect to x is about -1. This is what we call the partial derivative of z with respect to x at (x,y)=(-2,1), which we denote by [Maple Math] or by [Maple Math] . We have Maple calculate the exact value of this partial as follows, calling the resulting value A..

> A:= subs(x=-2, diff(f(x,1),x));

[Maple Math]

Let's now do the same thing, but holding the other variable, x, fixed at -2. We construct the plane with x held fixed at -2 and display it in red together with the graph of the function.

> xconstant:=plot3d([-2,y,z], y=-3..3,z=-3..16,color=red):
display(func,xconstant);

[Maple Plot]

>

Now rotate the picture so that you can see the intersection of the graph with the RED plane and so that the Y-AXIS appears

at the bottom with the numbers increasing. This intersection corresponds to the graph of z=f(-2,y) which we can plot in the usual way:

> plot(f(-2,y), y=-3..3,z=-3..15);

[Maple Plot]

>

The derivative of this function at y=1 appears to be about 1 and indeed, the partial derivative of z with respect to y at (-2,1), which we denote by B= [Maple Math] , or by [Maple Math] , is now computed by Maple as follows.

> B:=subs(y=1, diff(f(-2,y),y));

[Maple Math]

We can combine the slope information we have gathered to draw the tangent plane. Let

> C:=f(-2,1)-A*(-2) - B*1;

[Maple Math]

The equation of the tangent plane to the graph surface at (-2,1,9/2) is

[Maple Math]

Our value for C assures that the plane passes through the point (-2,1,9/2). In general, we can write the equation of the tangent plane at a point (a,b) in the form

[Maple Math]

or

[Maple Math]

where [Maple Math] and [Maple Math] are the partial derivatives with respect to x and y, at the point (a,b). If we multiply out on the right side of the last equation, the constant term is f(a,b) - A*a- B*b, which we call C. Let's plot this plane together with the original graph. We use the view option to keep the tangent plane and the graph in the original box.

> tanplane:=plot3d(A*x+B*y+C, x=-3..3,y=-3..3,view=-3..16,color=blue):
display(func,tanplane);

[Maple Plot]

>

Rotate the graph to see that the blue tangent plane is the closest plane approximation to the graph at the point (-2,1,9/2).

Let's reset the constants A, B, and C so we can use them again. We use these letters in different examples and problems so it's a good idea to execute the following line before starting homework problems.

> A:='A'; B:='B'; C:='C';

[Maple Math]

[Maple Math]

[Maple Math]

Problem 1. Plot the graph of the function [Maple Math] and the plane tangent to it when x=0.3, y=1.2. Use the plotting range x=-2..2, y=-2..2, use axes=boxed, and rotate the plot so you can see that the tangent plane is really tangent. Use Maple do all the calculations.

If we consider the partial derivatives [Maple Math] and [Maple Math] as functions of (x,y) instead of just at one specific point like (-2,1), we get new functions of (x,y). The first of these is found by treating y as a constant and differentiating with respect to x; similarly for the second. Maple can, of course, do incredibly involved computations of this type. Note the syntax we use to find the partial derivative of [Maple Math] with respect to x:

> diff(sin(sqrt(x^2+y^3)/(x*y+1)),x);

[Maple Math]

If, as in the problems above, we wanted the value of the partial at a specific (x,y) value, say (1,4) we could get it by

> subs(x=1,y=4,diff(sin(sqrt(x^2+y^3)/(x*y+1)),x)); evalf(%);

[Maple Math]

[Maple Math]

Differentials

The tangent plane point at (a,b) is the graph of a linear approximation to f(x,y) for (x,y) near (a,b), in the same way as the tangent line is the graph of a linear approximation to a function of one variable, f(x), near a fixed value x=a. Linear functions are easy to compute and to understand, so we can often usefully replace the function with its linear approximation as long as we stay near the specific point (a,b). We saw above that the equation of the tangent plane at (a,b) can be written

[Maple Math]

where [Maple Math] and [Maple Math] . Think of (x,y) near (a,b). Let dx=(x-a) and dy = (y-b). Then x = a + dx and y = b+dy; and the value of f(x,y)-f(a,b), the change in z when you move from (a,b) to (x,y) is approximately Adx + Bdy, which we will denote by dz.

Example: Imagine that we have unit masses at the three points (-1,0), (1,0), and (0,1) in the plane. These exert a gravitational force on a unit mass located at the point (x,y). Consider the function F(x,y) which gives the force component in the x-axis direction. Using the inverse square law we can calculate this force component as

[Maple Math]

where G is the gravitational constant. F(x,y) is a fairly unpleasant expression. Suppose though that we are only interested in F(x,y) near the point (0.5,0.2) . We define the function F in Maple and then compute F(0.5,0.2). We will set G=1 for convenience.

> F:=(x,y)->(-1-x)/((1+2*x+x^2+y^2)^(3/2))+(1-x)/((1-2*x+x^2+y^2)^(3/2))-x/((1-2*y+x^2+y^2)^(3/2));

[Maple Math]

> F(0.5,0.2);

[Maple Math]

But how can we understand the effect on the force component of moving a little away from (0.5, 0.2)? Let's compute the

differential, Adx + Bdy = [Maple Math] , at this point.

> A:=subs(x=0.5,y=0.2, diff(F(x,y),x));B:=subs(x=0.5,y=0.2, diff(F(x,y),y));

[Maple Math]

[Maple Math]

By the way, you might want to see what the partial derivatives of F(x,y) look like. Execute the following command to see the partial with respect to x:

> diff(F(x,y),x);

Now suppose we want the approximate change in F when we move .01 units in the x direction and .01 units in the y direction from the point (0.5, 0.2). The force component will change by about Adx + Bdy with dx=dy=.01. You could do the arithmetic easily by hand, but we'll use Maple:

> dx:=.01;dy:=.01; dz:=A*dx+B*dy;

[Maple Math]

[Maple Math]

[Maple Math]

We can compare this with the exact change, a calculation that would take some time by hand.

> F(0.51,0.21)-F(0.5,0.2);

[Maple Math]

Our differential approximation was a little too large. To see why, we will plot the graph of F together with the tangent plane at the point (0.5,0.2), in a small region centered at this point.

> Fplot:=plot3d(F(x,y),x=.3..0.7, y=0..0.4,axes=boxed):

> Ftan:=plot3d(A*(x-.5)+B*(y-.2) + F(0.5,0.2),x=.3..0.7, y=0..0.4, color=blue):

> with(plots):

> display(Fplot,Ftan);

[Maple Plot]

>

Note how the tangent plane weaves through the surface but is nevertheless the best planar approximation at our point. The point (0.5,0.2) is clearly visible, and you can see that as you move away from it in the direction of (0.51,0.21) the blue tangent plane lies above the graph.

Problem 2 In the triangle pictured below, whose sides are 1, x, and y, we consider y as a function of x and the angle t (in radians of course),

[Maple Math] , [Maple Math]

[Maple OLE 2.0 Object]

(This is just the Law of Cosines.)

a) Find the differential [Maple Math] at [Maple Math] . When x=2, t=1.3 it's easy to check that y = [Maple Math]

b) Find approximate values for y corresponding to (x,t) = (2.1, 1.32) and to (x,t) = (1.8, 1.34) using only simple arithmetic and the differential you found in a). Have Maple do the arithmetic.

c) Have Maple plot the graph of y = f(x,t) together with the tangent plane at (x,t) = (2,1.3). Use ranges x=0.5..3.5 and t=0.5..2.0 to start. Will the differential approximations near this point be too big, too small, or what? Explain in a complete sentence referring to your plot.

Homework Problems

Your homework for this worksheet consists of Problems 1 and 2 above.

>

MTH 243 Maple Worksheets written by B. Kaskosz and L. Pakula, Copyright 1999

>