Lab 03 - Tangent Planes
Math 2374 - University of Minnesota
http://www.math.umn.edu/math2374
 Questions to: rogness@math.umn.edu

Introduction

In last week's lab, we investigated properties of continuity, differentiability, and partial derivatives.  In this lab, all of the functions we consider will be differentiable, which as we learned means that we can approximate the function at any given point with a linear approximation, or "tangent plane."

There's an important point here: earlier we talked about whether a function is differentiable at the point (OverVector[x])=(OverVector[a]); if we say that a function is "differentiable" without any modifier, we mean that it is differentiable at every point, or at least every point where it is defined.  Go to the following web page:

http://www.math.umn.edu/~rogness/multivar/tanplane.shtml

This demo shows you part of a paraboloid with a tangent plane at a certain point;  you can click and drag the point to move it around, and LiveGraphics3D will automatically show you the tangent plane at the new point.

This is intended to reinforce the point that a "differentiable" function doesn't have one single tangent plane (or linear approximation, if you prefer that language).  Rather, it has a different linear approximation at each point!

Today we'll learn various methods of finding the equation of the tangent plane / linear approximation of a differentiable function.  In some sense this is one of the most important things you can learn in this course, and all of the material for the first month of the class has led to this point.  You'll even get a foreshadowing of things to come; in lecture, you've learned what the gradient is, but you haven't learned all of its properties.  In this lab you'll see how you can use the gradient to find a tangent plane, which will be mentioned later in the book an in lecture.

Plotting Planes

Before we begin considering issues of tangency, let's review how to plot planes.  It might help you to look in your textbook and review Cartesian and parametric equations for planes; you can also ask your TA for help.

The nicest situation is when we can describe the plane as a function of x and y; in that case, we can write the equation of the plane as ``z = ax + by + c'' where a, b, and c are real numbers. We can just use Plot3D in those cases; for instance, if we had z = 3x - y, we could just use

Plot3D[3x - y, {x,-2,2},{y,-2,2},AxesLabel->{"x","y","z"}]

to plot the plane, adjusting the range of x and y if necessary. 

Even if we can describe a plane with a nice, easy equation, it is sometimes more convenient or enlightening to describe the plane with parametric equations. If we are given a point and two non-parallel vectors, there is a unique plane containing that point parallel to each of the vectors. Let's say our vectors are (2,3,5) and (-7,-11,13), and we wish to find the plane parallel to those two vectors passing through the point (17, 29, 0). In parametric equations, we could write

(17,29,0) + t (2,3,5) + s(-7,-11,13)

where s and t range over all real numbers. To plot this plane, we use the properties of scalar multiplication and vector addition, and use ParametricPlot3D:

ParametricPlot3D[{17+2*t-7*s, 29+3*t-11* s, 5*t+13*s}, {t,-1,1},{s,-1,1},AxesLabel->{"x","y","z"}]

You can keep the parametric equation of the plane in ``un-multiplied out'' form and use ParametricPlot3D, although earlier versions of Mathematica might complain a bit before showing you the graph.  Either way works; mathematically they are exactly equivalent. The following form may be easier to write.

ParametricPlot3D[{17, 29,0} + t*{2,3,5}+s*{-7,-11,13}, {t,-1,1},{s,-1,1},AxesLabel->{"x","y","z"}]

One important thing to note is that we've only plotted a small portion of the plane. Above we chose values of t and s between -1 and 1, but we can choose any range we like. The ranges on s and t don't have to be the same. You don't have to use s and t if you don't like; Mathematica will let you use pretty much any variable name you like. The world is your oyster.

There's one other point you should be aware of.  In this class you've seen how difficult it can be sometimes to represent three-dimensional pictures on a two-dimensional computer screen or piece of paper.  A picture of a plane can be particularly hard to decipher; it's sometimes difficult to tell which part is sloping uphill, which part is going downhill, or even whether a plane is horizontal or vertical.  In the previous picture, for example, it's hard to decide how the plane is situated in space without rotating it around.  How accurately did you interpret the two-dimensional picture before moving it around?

Example

Plot the plane that's described by

s(0,0,1) + t(0.2, 0.2, 2)

when s and t range from 2 to 3. It won't look very good—it's ``too skinny''. Experiment with some different ranges on s and t until you get a nicer picture—one that's a little more ``square''.

Exercise 1 - A Thought Experiment

Are there planes that are not the graph of a function of x and y? If so, which planes are they? If there are no such planes, explain why.

Are there planes that cannot be described by a parametrization? If so, which planes are they? If there are no such planes (i.e., any plane whatsoever can be described by a parametrization), explain why.

Explain your reasoning!

Tangent Planes Via Partial Derivatives

You've learned that, basically, a function is "differentiable" if it has a linear approximation; in the case of a function z=f(x,y), this is the same as saying it has a tangent plane at each point.  You've also seen the general (cartesian) equation z=L(x,y) of a linear approximation/tangent plane for a function like this; it has lots of partial deriatives in it.

In this section we're going to learn how to use partial derivatives to find the parametric equation of a tangent plane.  Before you do anything else, open the following page in a web browser and read the material there:

http://www.math.umn.edu/~rogness/multivar/partialderivs.html

Once you've read the web page, you can continue on to the rest of the lab.

Using Tangent Vectors to find Parametric Equations of Tangent Planes

So now you've seen that tangent vectors of cross sections through a point are in the tangent plane at that point.  But wait -- all we need to write down the parametric equation of a plane is a point on the plane and two vectors in the plane!  So, in this situation, we've got all the information we need.  Given two cross sections of a surface which intersect at a point (OverVector[x])=(OverVector[a]), the equation of the tangent plane is:

p(s,t)=(OverVector[a])+s·(tan. vector of first cross section at the point (OverVector[a])) + t·(tan. vector of second cross section at the point (OverVector[a])).

Let's do a real-life example now, by finding the plane tangent to the surface

z = (x^2) + 3xy + (y^2)

at the point (1,-2,-1).  First let's plot the surface; we'll use the Mesh option to turn off the grid, and Opacity to make it somewhat transparent, so that later on we can see our cross sections a little better.

f[x_,y_] = x^2 + 3 x*y + y^2
surf = Plot3D[f[x,y], {x,0,2},{y,-3,-1}, Mesh->False,AxesLabel->{"x","y","z"},PlotStyle->Opacity[0.5]]

Now we need to find the partial derivatives of f and evaluate them at the point (x,y)=(1,-2).

fx[x_,y_]=D[f[x,y],x]
fy[x_,y_]=D[f[x,y],y]

fx[1,-2]
fy[1,-2]

As you learned in the external web page, the vectors

				 (1,0,(Subscript[f, x])(1,-2))=(1,0,-4)
				 (0,1,(Subscript[f, y])(1,-2))=(0,1,-1) 

are both parallel to the tangent plane at our point; The following cell draws those two vectors on the surface, starting at the point (1,-2,f(1,-2))=(1,-2,-1).  You needn't worry about the syntax of the first two commands; they tell Mathematica to draw two 3D line segments representing the vectors.

tangentvectorx=Graphics3D[{Thick,Line[{{1,-2,-1},{1,-2,-1}+{1,0,-4}}]}];
tangentvectory=Graphics3D[{Thick,Line[{{1,-2,-1},{1,-2,-1}+{0,1,-1}}]}];
Show[surf,tangentvectorx,tangentvectory]

Rotate the picture and look at it from below to see the vectors.  It certainly seems plausible that they're in a tangent plane for the surface!

Let's go ahead and define the parametric equation for our tangent plane, using the equation above.

p[s_,t_] = {1,-2,f[1,-2]}+s*{1,0,fx[1,-2]}+t*{0,1,fy[1,-2]}

Now plot the plane and the surface together in a LiveGraphics3D pop-up window:

surf = Plot3D[f[x,y], {x,0,2},{y,-3,-1}, Mesh->5,AxesLabel->{"x","y","z"},PlotStyle->Red,PlotPoints->50];
tanplane =ParametricPlot3D[p[s,t], {s,-1,1}, {t,-1,1},Mesh->5,PlotStyle->Blue,PlotPoints->50];
Show[surf, tanplane]

Rotate the picture and see if you can convince yourself that this plane really is tangent to the surface. (We've talked about how appearances can be deceiving, but in this case your eyes aren't lying to you.)  Note how the plane is above the surface at some points and below it at others; that's perfectly fine. It's analogous to the line tangent to the curve y = sin x at x = 0, which goes above and beneath the curve:

Plot[{Sin[x],x},{x,-Pi/2,Pi/2},AspectRatio->Automatic]

Using Tangent Vectors to find Cartesian Equations of Tangent Planes

Sometimes we need to find a Cartesian equation for a tangent plane.  Recall that the Cartesian equation of a plane looks like

A(x-(Subscript[x, 0]))+B(y-(Subscript[y, 0]))+C(z-(Subscript[z, 0]))=0

where ((Subscript[x, 0]),(Subscript[y, 0]),(Subscript[z, 0])) is a point on the plane, and the vector (A,B,C) is normal (i.e. perpendicular) to the plane.  Now think back to what we've been doing so far: given a surface, we choose a point; then we find two curves through that point; then we find the tangent vectors at that point.

So we've got a point, and now we need a normal vector.  Why not just use the cross product of the two tangent vectors?  They're both in the tangent plane, so their cross product is perpendicular to the plane.

Here's the parametric equation of the tangent plane we just found, which touches the surface at (1,-2,-1).

p[s_,t_] = {1,-2,f[1,-2]}+s*{1,0,fx[1,-2]}+t*{0,1,fy[1,-2]}

The two tangent vectors are (1,0,-4) and (0,1,-1), so our normal vector is their cross product.  Mathematica can compute cross products with a command named, not surprisingly, Cross:

Cross[{1,0,-4},{0,1,-1}]

Therefore our Cartesian equation for this same plane is

4(x-1)+1(y+2)+1(z+1)=0

z=-4x-y+1

Let's plot this using Plot3D and show it with the original surface:

surf = Plot3D[f[x,y], {x,0,2},{y,-3,-1}, Mesh->5,AxesLabel->{"x","y","z"},PlotStyle->Red,PlotPoints->50];tanplane2=Plot3D[-4x-y+1,{x,0,2},{y,-1,-3},Mesh->5];
Show[surf,tanplane2]

Are you convinced that this is the same tangent plane?  It certainly looks that way, and in fact it is!

Exercise 2

In this exercise you're going to find the linear approximation (or tangent plane, if you prefer) of the function g(x,y)=(x^2)-(y^2)at the point (x,y)=(1,2).  Your work should include the following steps:

(a) Describe the cross sections of the surface defined by x=1 and y=2.  

(b) Find the partial derivatives of g at the appropriate point; using these values, find two vectors tangent to the surface there.

(c) Give simplified parametric and cartesian equations for the tangent plane.

Your writeup should include a good picture of both the surface and the tangent plane.  You should put some thought into the ranges of the x- and y-values in your picture; if you're too close, you won't be able to tell the difference between the plane and the surface, but if you're too far away, the resulting picture may not be very useful.  In particular, if your picture clearly shows that your plane is not tangent, or if it's impossible to tell, you will most likely lose points.

Exercise 3

In this exercise you're going to find the linear approximation (or tangent plane, if you prefer) of the function g(x,y)=sin(x)cos(y)at the point (x,y)=(π/4,-π/4).  Your work should include the following steps:

(a) Describe the cross sections of the surface defined by x=π/4 and y=-π/4.  

(b) Find the partial derivatives of g at the appropriate point; using these values, find two vectors tangent to the surface there.

(c) Give simplified parametric and cartesian equations for the tangent plane.

Your writeup should include a good picture of both the surface and the tangent plane.  You should put some thought into the ranges of the x- and y-values in your picture; if you're too close, you won't be able to tell the difference between the plane and the surface, but if you're too far away, the resulting picture may not be very useful.  In particular, if your picture clearly shows that your plane is not tangent, or if it's impossible to tell, you will most likely lose points.

Tangent Planes Via Gradients

Another way to find the tangent plane to a surface is to use the gradient vector. Recall that the gradient vector of a function f(x,y) is defined to be

(OverVector[∇])f(x,y)=(((∂f)/(∂x)), ((∂f)/(∂y))).

Hmmm. This is a two-dimensional vector, and to define a plane in 3-space, we'll definitely need vectors with three components.  We get around this by doing some minor rearranging.  Our surface is defined by z=f(x,y).  We could move everything over to the same side and say that our surface is defined by the equation

z-f(x,y)=0

You might be thinking that this is an odd step; if anything, it's a more complicated way to write it.  That's true, and it's going to get a little worse.  Rather than saying our surface is defined by this equation, let's defined a new function:

g(x,y,z) = z - f(x,y)

And now we say that our function is the level set defined by g(x,y,z)=0.  So now instead of the nice, simple statement z=f(x,y), we're suddenly talking about level sets.  Yikes!  There's a reason for this, however...

Notice that g(x,y,z) is a function of three variables, and its gradient is

(OverVector[∇])g(x,y,z)=(-((∂f)/(∂x)), -((∂f)/(∂y)), 1).

Now recall from lecture that the gradient of a function g is perpendicular to the level sets of g.  (If you haven't seen this in lecture yet, you will soon.  Just take it for granted here; it might be a good idea to ask your TA to draw a picture of what this means.)  In other words:

-- We can start with a point (x,y,z) which is on the level set g(x,y,z)=0.
-- Because of the way we defined g(x,y,z), this is the same as saying the point is on the surface z=f(x,y).
-- Furthermore, (OverVector[∇])g(x,y,z)will be perpendicular (or normal) to our surface at that point.
-- In particular, we can use (OverVector[∇])g(x,y,z)as a normal vector to define the equation for our tangent plane!

Let's use this method quickly to find the same tangent plane we've been working with this whole time.  Remember that the function is given by:

f[x_,y_] = x^2 + 3 x*y + y^2

So we can do our magic "new" function like this:

g[x_,y_,z_]=z-f[x,y]

We're interested in the gradient at the point (1,-2,-1).  Note the new command, Grad[], which computes the gradient:

gradg[x_,y_,z_]=Grad[g[x,y,z]]
gradg[1,-2,-1]

Thus the Cartesian equation of the tangent plane is:

4(x-1)+(y+2)+(z+1)=0

z=-4x-y+1

Which is exactly what we found before.  Good!

Although the "gradient method" of finding a tangent plane might seem more complicated -- particularly if you don't like level sets -- it's very, very useful.  We didn't have to find any cross sections, find tangent vectors, and so on.  We just rewrote the original equation, computed one gradient, and we were basically done!

Exercise 4

Use the gradient method to find the cartesian equation of the plane tangent to

f(x,y)=Exp(-(x^2)-(y^2))*x

at the point (0,0,f(0,0)).  Show the graph of f(x,y) and this tangent plane together on the same plot. Be sure to show your work and explain your reasoning.

Exercise 5

Use the gradient method to find the cartesian equation of the plane tangent to

f(x,y)=y*Cos(x)

at the point (0,π/4,f(0,π/4)).  Show the graph of f(x,y) and this tangent plane together on the same plot; use the ranges -π to π for both x and y.   Be sure to show your work and explain your reasoning.  In particular, with the suggested ranges the "true" tangent plane looks like it sticks through part of the surface.  You may want to explain why that's the case.

Tangent Plane Conspiracy Theory

You are not responsible for the material in this section, but we've included it for those people who are interested in the mathematics behind all of this; it turns out that all of the different methods of finding tangent planes aren't really all that different!

In this section, we'll learn that, despite all appearances to the contrary, the ``tangent vectors'' and ``gradient vector'' methods are surreptitiously working together and are engaged in a secret government conspiracy!

Okay, there's no government conspiracy (well...none that I'm aware of), but it is true that the two methods are working together—in fact, they are just different ways of looking at the same thing. Let's talk about directional derivatives for a bit before explaining why they're the same.

Above we were talking about partial derivatives and directions, which should remind you of directional derivatives. In the Tangent Vectors section, when specifying ``the planes y = 2x - 4 and y = -x - 1'', we were really talking about direction vectors. In the above cases, the corresponding direction vectors would be

(1/(Sqrt[5]))(1,2)    and     (1/(Sqrt[2]))(1,-1),

respectively. We are basically using the slope of a line: y = 2x - 4 is a line (in two dimensions) with slope 2. The vector (1,2) is parallel to that line, and above we just normalized it. The other direction vector was obtained in a similar way. Once we know direction vectors, we just need to take the dot product with the gradient vector to find the directional derivative. The conspiracy is already unravelling.

For the function f(x,y) = (x^2) + 3xy+ (y^2) at the point (1,-2), and the first direction vector—call it u—we have

(Subscript[Df, u])= (((∂f)/(∂x)), ((∂f)/(∂y)))·((1/(Sqrt[5])),(2/(Sqrt[5]))) = (-4, -1)·((1/(Sqrt[5])),(2/(Sqrt[5]))) = -(6/(Sqrt[5]))

We interpret this by saying ``in the direction of u, f is increasing at a rate of -6/(Sqrt[5]).'' The upshot of this is that (1/(Sqrt[5]), 2/(Sqrt[5]), -6/(Sqrt[5])) is a tangent vector to f(x,y), and it's parallel to (1,2,-6)—the tangent vector we found by using the path we described in the first section. We get this vector by taking the direction vector—a two-dimensional vector—and adding a third component, which is given by the directional derivative of f(x,y).  In general, this means that

(u1, u2, (Subscript[D, u])f)

is a vector tangent to the surface z = f(x,y). You should do this same process with the other direction vector above and make sure that you end up with a tangent vector parallel to (1,-1,-3).

Of course, there's nothing special about those two directional vectors above. We can use any two non-parallel direction vectors and we'll get the same plane—which is exactly what you would hope for, since a function can have only one tangent plane (or no tangent plane, if the function isn't differentiable). The following exercise will help you expose the conspiracy—er, show that the tangent planes from the ``tangent vectors method'' and from the ``gradient vectors method'' are in fact the same. We'll do that by comparing the normal vectors of the resulting planes.

Exercise 

(Notice that this isn't in a red box; you don't have to hand this exercise in.  You might find it interesting, however.)

As discussed in the Gradient Vector section, the gradient of z - f(x,y) represents a normal vector to the tangent plane, so our main objective is to find the normal vector of the plane we get from the tangent vector method. We'll use an arbitrary differentiable function f(x,y) and two non-parallel direction vectors u = (u1, u2) and v = (v1, v2).

	(i) Find the vectors tangent to f(x,y) in the directions of u and v. Describe them in terms of u1, u2, v1, v2, and the partials of f (∂f / ∂x and ∂f / ∂y).

	(ii) Find the normal vector of the plane spanned by those two vectors.
	
	(iii) Show that the normal vector you found in (ii) is parallel to the gradient vector of the function g(x,y,z) = z - f(x,y).
	
	(iii) What does this imply about the tangent planes found using the two different methods?

Credits

This lab is a descendent of an earlier lab on Tangent Planes written by Cindy Kaus.  Dan Drake did a major rewrite in 2002, and then I overhauled it again in February 2004.  We changed the focus a little bit, and added a few things here and there; having taught this lab for a few years now, we've learned what the sticking points are for students, so I've tried to add extra explanations in these parts.  I also changed the exercises, except for #1, which Dan wrote, and the pseudo-exercise in the "Conspiracy Theory" section, which is also Dan's.  I changed the rest of them so we'd have a little variety; the previous exercises have been used for the last 4 years or so.

It's a little difficult to completely describe who did what, but here's an attempt:

-- I don't believe any of the writing is Cindy's; the only thing remaining is her choice of the surface and the point where we find the tangent planes.

-- The "Plotting Planes" and "Tangent Plane Conspiracy Theory" sections are all Dan's; at most I changed a few words here or there, or added a Live command.

-- The other sections are fairly major rewrites of Dan's original sections.  A lot of his original text remains.  Some of it remains but has been modified a bit, because of reorganization, etc.  Some of it is new text added by me.  To make things more complicated, it's all intertwined; many paragraphs combine Dan's writing with mine.

[ Update (Fall 2004): switching textbooks really messed this lab up.  We used to parametrize "general" cross sections, i.e. the points in the surface over any line in the xy-plane which went through the appropriate surface.  In the new textbook, students know about parametric equations of lines, but not parametric curves, and not the tangent vector of a parametric curve.  I had to gut that section and replace it with a version where we only use tangent vectors derived from the partial derivatives.  Ah well. ]

Minor updates in January 2008 for Mathematica 6.0.

This would be a major mess, but fortunately we've all agreed to use the same license, and it works out.  The current version of the lab is copyright 2004 by Jonathan Rogness (rogness@math.umn.edu) and is protected by the Creative Commons Attribution-NonCommercial-ShareAlike License.  You can find more information on this license at http://creativecommons.org/licenses/by-nc-sa/1.0/.   (As mentioned, parts of this are copyright 2000 by Cindy Kaus and 2002 by Dan Drake and are protected under the same license.)

Although it's not specifically required by the license, I'd appreciate it if you let me know if you use parts of our labs, just so I can keep track of it.  Please send me any questions or comments!