**Tangent Planes to Surfaces in Maple**

**Copyright © 1999, 2001 by James F. Hurley, University of Connecticut Department of Mathematics, Unit 3009, Storrs CT 06269-3009. All rights reserved.**

This worksheet shows how to use Maple to plot both the graph in
of a function
*f: *
®
and its tangent plane at a point
*P*
(
*a*
,
*b*
,
*f*
(
*a*
,
*b*
)) on the surface.
**
**
Consider first the function

`> `
**with(plots):
f := (x, y) -> y^2 - 2*x^2:
tanpoint := pointplot3d([2,1,-7], symbol = circle, color = red):
surf := plot3d( f(x, y), x = -3..3, y = -3..3, axes = boxed ):
xaxis := spacecurve([t, 0, 0, t = -3..6, color = magenta]) :
yaxis := spacecurve([0, t, 0, t = -3..5, color = magenta]) :
zaxis := spacecurve([0, 0, t, t = -3..12, color = magenta]) :
labx := textplot3d([6.5, 0, -.2, `x`], color = magenta):
laby := textplot3d([0,5.5, -.2, `y`], color = magenta):
labz := textplot3d([0, 0, 13, `z`], color = magenta):
labP := textplot3d([2.2, 1.1, -6.8, `P`], color = red):
display(surf, tanpoint, labP, xaxis, yaxis, zaxis, labx, laby,labz);**

Warning, the name changecoords has been redefined

The tangent plane to the graph of
*f*
at the point
*P*
(2, 1, 2)
has equation

*z*
Ð 7 =
(2, 1) (
*x*
Ð 2) +
(2, 1) (
*y*
Ð 1)
.

It is easy to calculate the partial derivatives of
*f*
:

(
*x*
,
*y*
)
=
*Ð*
4
*x*
Þ
(2, 1)
=
Ð8,
(
*x*
,
*y*
)
= 2
*y*
Þ
(2, 1)
=
2.

Thus the equation of the tangent plane at the point
*P*
is

.

The following routine plots the plane.

`> `
**with(plots):
f := (x, y) -> -7 - 8*(x - 2) + 2*(y - 1):
tanplane := plot3d( f(x, y), x = 1..3, y = 0..3, axes = boxed ):
tanpoint := pointplot3d([2,1,-7], symbol = circle, color = red):
xaxis := spacecurve([t, 0, 0, t = -3..6, color = magenta]) :
yaxis := spacecurve([0, t, 0, t = -3..5, color = magenta]) :
zaxis := spacecurve([0, 0, t, t = -3..12, color = magenta]) :
labx := textplot3d([6.5, 0, -.2, `x`], color = magenta):
laby := textplot3d([0,5.5, -.2, `y`], color = magenta):
labz := textplot3d([0, 0, 13, `z`], color = magenta):
labP := textplot3d([2.2, 1.1, -6.8, `P`], color = black):
display(tanplane,tanpoint,xaxis, yaxis, zaxis,labx,laby,labz, labP);
**

As we have seen, Maple can display the two plots together. The following command accomplishes that. Observe that the tangent plane resembles a patch on the surface.

`> `
**display(surf, tanplane, tanpoint, xaxis, yaxis, zaxis, labx, laby,labz, labP);**

`> `

A convenient feature of Maple lets you direct output to an untitled window, which you can then
*print as an individual graphical image*
without the need to print the entire worksheet or to copy the image to a new document. To print output to such a window, simply add the command

plotsetup(window);

directly after the
with(plots);
command. To
*restore plotting to the worksheet,*
add the following to the graphics routine right after the
with(plots);
command:

plotsetup(inline);

Try this with the last routine!