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 ; 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:
(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
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
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
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:
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.
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.
Plot the plane that's described by
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''.
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:
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:
(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 . 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 , the equation of the tangent plane is:
Let's do a real-life example now, by finding the plane tangent to the surface
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.
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 :
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 .
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.
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
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 does ? Well, we can solve that easily enough:
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:
Similarly, the point of intersection occurs at s = 1 for c2 (check this!), yielding a tangent vector of (1,0,-4):
Now we know everything we need to describe the plane: we know a point it passes through, namely ), and two vectors parallel to the plane. In parametric terms, the plane is
Let's plot the plane and the surface together in a LiveGraphics3D pop-up window:
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 = at x = 0, which goes above and beneath the curve:
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 . [Check that this parabola does in fact go through (1,-2).] It would look like this:
You should look at the above commands until you're sure you understand the definition for . 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 . and . [You should check that these do in fact slice through the surface at the point .]
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.
Now let's look at the original surface with these two curves; you could replace the Show command with ShowLive if you prefer.
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
For comparison, here's the first tangent plane we found:
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
where is a point on the plane, and the vector 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 .
The two tangent vectors are and , so our normal vector is their cross product. Mathematica can compute cross products with a command named, not surprisingly, Cross:
Therefore our Cartesian equation for this same plane is
Let's plot this using Plot3D and show it with the original surface:
Are you convinced that this is the same tangent plane? It certainly looks that way, and in fact it is!
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
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 . We could move everything over to the same side and say that our surface is defined by the equation
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:
And now we say that our function is the level set defined by . So now instead of the nice, simple statement , we're suddenly talking about level sets. Yikes! There's a reason for this, however...
Notice that is a function of three variables, and its gradient
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 .
-- Because of the way we defined , this is the same as saying the point is on the surface .
-- Furthermore, will be perpendicular (or normal) to our surface at that point.
-- In particular, we can use 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:
So we can do our magic "new" function like this:
We're interested in the gradient at the point :
Thus the Cartesian equation of the tangent plane is:
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!
Tangent Plane Conspiracy Theory
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
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) = at the point (1,-2), and the first direction vector—call it u—we have
We interpret this by saying ``in the direction of u, f is increasing at a rate of .'' The upshot of this is that (, , ) 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
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.
Created by Mathematica (March 2, 2004)