Lab 3C - Tangent Planes
Math 2374 - University of Minnesota
http://www.math.umn.edu/math2374
questions to: rogness@math.umn.edu, drake@math.umn.edu

Introduction

In the last few labs, we've investigated properties of continuity, differentiability, partial derivatives, directional derivatives, and gradients.  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 Overscript[x, ⇀] = Overscript[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

(Or, alternatively, expand the subsection below labeled "Tangent Plane Example" and evaluate the cell there.)  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.  In particular, we'll use a lot of the ideas from the previous two labs.

Tangent Plane Example

As with the code in the previous example, you don't have to worry about understanding the commands here.  It's just intended for people who would like to view the example without opening up a web browser.

This is a slightly modified version of an example on the LiveGraphics3D website, so I make no claim of originality.

RowBox[{(* plane, paraboloid, point, vector *), , RowBox[{independentVariables = {x ...  "MAGNIFICATION=1.3"}] ;, , EndJavaBlock[] ;, , Clear[g] ;, }]}]

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}]

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}]

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}]

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.  As an example, look at the previous picture and try to decide how the plane is situated in space.  Then evaluate the following command, which will make the same picture pop up in an interactive window.  Rotate the plane around and see how accurately you interpreted the two-dimensional picture.

ParametricPlot3DLive[{17, 29, 0} + t * {2, 3, 5} + s * {-7, -11, 13}, {t, -1, 1}, {s, -1, 1}]

Example

Plot the plane that's described by

RowBox[{s (0, 0, 1),  , +,  , RowBox[{t, RowBox[{(, RowBox[{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 Tangent Vectors

We're going to start out this section with a crucial observation.  Go back and think about the interpretation of a directional derivative -- it might help to reopen Lab 3B and run the example there, or go to:

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

We sliced through a surface with a vertical plane, and the intersection of the plane and surface gave us a cross-section of the surface.  (This is represented by the curvy part of the blue line; the straight blue lines are just there to help you visualize the vertical plane that you're using as a meat cleaver.)  The red arrow is part of the tangent line of the cross-section.

Here's the crucial observation: because the arrow is tangent to a cross-section through that point, then the arrow must be tangent to the surface at that point!  In other words, that arrow is actually part of the tangent plane at that point.  As you rotate the cross-section, the arrow moves around a lot, so this might be hard to believe.  There's another online example you can look at which might help convince you:

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

(Alternatively, you can expand the subsection titled "Interactive Example of Tangent Plane with Vectors" down below and evaluate that cell to start the example from within Mathematica.  In either case you should read on so that you know what you're looking at.)

The picture shows you the same surface as the previous directional derivative example, but now we've got two cross-sections of the surface, both of which go through the point (1, 0, 0).  The red and purple vectors are tangent to the cross-sections at the point.  The green vector is the cross product of the red and purple vectors.

Note that we've also drawn in a portion of the plane tangent to the surface at the point (1,0,0).  Rotate the cross-sections (using the slider on the bottom) and the entire picture (by clicking and dragging on the picture) until you're convinced that the tangent vectors are always contained in the tangent plane.  (This isn't always immediately obvious because LiveGraphics3D sometimes has trouble drawing lines and planes that overlap.)

Interactive Example of Tangent Plane with Vectors

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 Overscript[x, ⇀] = Overscript[a, ⇀], the equation of the tangent plane is:

p(s, t) = Overscript[a, ⇀] + s  (tan . vector of first cross section at the point Overs ... pt[a, ⇀]) + t  (tan . vector of second cross section at the point Overscript[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, 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]

For our first cross section, let's just slice the surface with the plane x=1.  [Note that this will give us a cross section through the point (1,-2,-1).  If you're not sure why this is true, as your TA.]

We'll use a parametric description for the curve that represents the restriction of f(x,y) to x=1. The x-value is always 1; we'll let y vary -- let's say y=t in our parametric equation -- and the z-value is described by f(1, t):

c1[t_] = {1, t, f[1, t]} RowBox[{one,  , =, RowBox[{ParametricPlot3D, [, RowBox[{Evaluate[c1[t]], ,,  , RowBox[{{, RowBox[{t, ,, RowBox[{-, 3.1}], ,, RowBox[{-, 0.9}]}], }}]}], ]}]}]

For our second cross section, let's use the vertical plane y=-2.  The parametric description of this cross section is very similar: we fix y=-2, and let x vary -- let's say x=s in our parametric equation, and the z-value is just f(s, -2).

c2[s_] = {s, -2, f[s, -2]} RowBox[{two,  , =, RowBox[{ParametricPlot3D, [, RowBox[{Evaluate[c2[s]], ,,  , RowBox[{{, RowBox[{s, ,, RowBox[{-, 0.1}], ,, 2.1}], }}]}], ]}]}]

Now we'll plot the surface and these curves together. Remember, we used "Mesh -> False" back in the Plot3D command to make it easier to see the curves.

Show[surf, one, two] 

Note how the paths run right through the surface. The nice thing about going to the trouble of using these paths is that the tangent vectors of the paths are also tangent to the surface. We can use those two tangent vectors to describe the plane that is tangent to the surface at the point where the curves intersect. It's easy to find the tangent vectors for the paths; we differentiate with respect to t (or s) and plug in the appropriate values of t or s. We get

dc1[t_] = D[c1[t], t] dc2[s_] = D[c2[s], s]

We're interested in the tangent vectors at the point (1,-2,-1), so we have to do a little bit of work here.  For what value of t does c1(t) = (1, -2, -1)?  Well, we can solve that easily enough:

c1(t) = (1, -2, -1)

(1, t, 1 + 3t + t^2) = (1, -2, -1)

Look at the y-component; it's pretty clear that c1 hits the intersection point (1,-2,-1) when t=-2.  You can check that t=-2 gives you the right z-value, too.  That means our first tangent vector is:

dc1[-2]

Similarly, the point of intersection occurs at s = 1 for c2 (check this!), yielding a tangent vector of (1,0,-4):

dc2[1]

Now we know everything we need to describe the plane: we know a point it passes through, namely (1, 2, f(1, -2)), and two vectors parallel to the plane. In parametric terms, the plane is

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

Let's plot the plane and the surface together in a LiveGraphics3D pop-up window:

tanplane = ParametricPlot3D[p[s, t], {s, -1, 1}, {t, -1, 1}] ; ShowLive[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]

Experience has taught us that the most confusing part of this process is where we set t=-2 and s=1.  Before you go on, make sure you understand what we did there.

There's nothing magical going on; we're just trying  to find the values of s and t so that c1(t) and c2(s) equal the point we're interested in.  In particular, s and t don't have to be equal; they also don't have to be equal to 1, or 0, or any other "nice" value.

Curves Not Parallel to Coordinate Planes

In the previous example, we used the cross sections determined by x=1 and y=-2, but it's not necessary for us to choose such nice equations -- in fact, it's not even necessary that the values for x and y follow a straight line; we just need to make sure the x- and y-values follow some curve which goes through our point -- (1,-2), in this case.  For example we could have used a cross section where the x- and y-values are on the parabola y = -x^2 - 1.  [Check that this parabola does in fact go through (1,-2).]  It would look like this:

f[x_, y_] = x^2 + 3 x * y + y^2 ; cs[t_] = {t, -t^2 - 1, f[t, -t^2 - 1]} ; RowBox[{RowBox[{par ... ], ;}] ShowLive[surf, parabcs, AxesLabel {"X", "Y", "Z"}] ;

You should look at the above commands until you're sure you understand the definition for cs1[t].  Ask your TA if you need help.  However, in practice we usually don't use complicated cross sections like this because it's simply easier to work with "straight ones."

It's certainly not necessary for the vertical planes to be as simple as x=1 or y=-2, however.  Let's work through the previous example again, but this time, instead of restricting f(x,y) to the planes x=1 and y=-2, let's restrict to the planes
y = 2x - 4. and y = -x - 1.  [You should check that these do in fact slice through the surface at the point (x, y) = (1, -2).]

Let's define c3 and c4 to represent the restrictions to y = 2x - 4 and y = -x-1 respectively.  Again, make sure you understand the following definitions; ask for help if you're not sure about them.

c3[s_] = {s, 2s - 4, f[s, 2s - 4]} c4[t_] = {t, -t - 1, f[t, -t - 1]}

Now let's look at the original surface with these two curves; you could replace the Show command with ShowLive if you prefer.

RowBox[{three,  , =, RowBox[{ParametricPlot3D, [, RowBox[{Evaluate[c3[s]], ,,  , RowBox[{{, Ro ... , ,,  , RowBox[{{, RowBox[{t, ,, RowBox[{-, 0.1}], ,, 2.1}], }}]}], ]}]}] Show[surf, three, four]

The tangent vectors are again found by differentiation: the tangent vectors are (1, 2, 22s-28) and (1, -1, -2t-1) and we are interested in the point when s and t both equal one, so we get (1,2,-6) and (1,-1,-3). Just like above, the vectors tangent to the paths at the point of intersection are both tangent to the surface at that point. The resulting plane is then

p2[s_, t_] = {1, -2, f[1, -2]} + t * {1, 2, -6} + s * {1, -1, -3} tanplane2 = ParametricPlot3D[p2[s, t], {t, -.5, .5}, {s, -.5, .5}] Show[surf, tanplane2]

For comparison, here's the first tangent plane we found:

Show[surf, tanplane]

Are these planes the same? They had better be, and in this case they are. The pictures don't look exactly the same, but that's because we used different cross sections, and therefore we have different vectors in our parametric equations for the plane.  You'll get a chance to verify that these two different methods produce identical planes.

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 - x_0) + B (y - y_0) + C (z - z_0) = 0

where (x_0, y_0, 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).  

p2[s_, t_] = {1, -2, f[1, -2]} + t * {1, 2, -6} + s * {1, -1, -3}

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

Cross[{1, -1, -3}, {1, 2, -6}]

Therefore our Cartesian equation for this same plane is

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

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

tanplane3 = Plot3D[-4x - y + 1, {x, 0, 2}, {y, -1, -3}] ; Show[surf, tanplane3] ;

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^2at the point (x, y) = (1, 2).  Your work should include the following steps:

(a) Find two curves on the surface which go through the point (1, 2); one of them can be the cross section given by x = 1, but the other should be something different than the cross section given by y = 2.

(b) Find the derivatives of each of these curves, and find their tangent vectors at the point (1, 2).  

(c) Give simplified parametric and cartesian equations for the 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) Find two curves on the surface which go through the point (π/4,-π/4); one of them can be the cross section given by y = -π/4, but the other should be something different than the cross section given by x = π/4.

(b) Find the derivatives of each of these curves, and find their tangent vectors at the point (π/4, -π/4).  

(c) Give simplified parametric and cartesian equations for the 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

Overscript[∇, ⇀] 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

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

Now recall from lecture (or the previous lab) that the gradient of a function g is perpendicular to the level sets of g.  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, Overscript[∇, ⇀] g (x, y, z)will be perpendicular (or normal) to our surface at that point.
-- In particular, we can use Overscript[∇, ⇀] 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):

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, solve for values of s and t, 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/5^(1/2) (1, 2)     and     1/2^(1/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

Df_u = (∂f/∂x, ∂f/∂y)  (1/5^(1/2), 2/5^(1/2)) = (-4, -1)  (1/5^(1/2), 2/5^(1/2)) = -6/5^(1/2)

We interpret this by saying ``in the direction of u, f is increasing at a rate of -6/5^(1/2).'' The upshot of this is that (1/5^(1/2), 2/5^(1/2), -6/5^(1/2)) 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, D_uf)

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


Created by Mathematica  (March 2, 2004)