Lab 3A - Continuity and Differentiability
Math 2374 - University of Minnesota
http://www.math.umn.edu/math2374
questions to rogness@math.umn.edu, drake@math.umn.edu
Introduction
This week we will investigate the ideas of continuity and differentiability for functions of several variables. The relationships between limits, continuity, partial derivatives, and differentiability are quite subtle and complicated and you might find that your intuition will often lead you astray. Most of the functions with which we'll concern ourselves in this course are very ``nice'', but it's important that you are aware of the sorts of pathological functions which do exist.
Some of the functions and equations in this lab are complicated and difficult to read in a small font. If that bothers you, the magnification can be changed in the Format → Magnification menu. Another way is Format → Screen Style Environment → Presentation, which changes the general look of your notebook and pretties things up a bit.
Also, many of the examples here will use ShowLive or Plot3DLive. If you're viewing this on a computer where those commands don't work, you can remove the Live from each command and still read the lab, although it will be less interactive. In the online version we've already done this, but we'd like to stress that you won't get as much out of the "static" version as the live one.
Continuity
From lecture and our textbooks, we know that the idea of continuity—for both single- and multi-variable functions—largely depends upon the idea of a limit. In both cases, a function f is continuous at a point a if
exists and
Intuitively, this means that the function has no holes or jumps; in the single-variable case, we often talk about being able to draw a function without lifting your pencil from the paper.
Determining whether a function is continuous or not is therefore mostly a matter of determining the value of the limit (if it even exists, which it may not). For single-variable functions, we talk about right-hand and left-hand limits: one can approach a value on the real line from either the right or the left. But what about a function whose domain is two-dimensional? Not only can you approach from the left and right, but from many other directions as well. Say we have a function g(x) whose domain includes the point (2,2). We could approach the point (2,2) along any one of infinitely many straight lines:
(of course, due to the limitations of Mathematica, we can only draw finitely many arrows...). We can also approach the point (2,2) along other kinds of curves: below, we've drawn a parabola, a sine wave, and a portion of a circle, each of which approaches the point (2,2):
The problem is even worse with 3 or more dimensions! An important observation is that the limit of a function as x goes to a will exist if and only if the limits as you approach a along ANY path agree. As we just saw, there are infinitely many paths that approach a point, and we certainly can't test each one of them individually. This means that, in practice, we usually won't evaluate any "two-dimensional" limits. We will, however, use the contrapositive of the above statement: if the limits as you approach a along two or more different paths disagree, then the limit as x goes to a does not exist.
Now carefully re-read the above paragraph once or twice. This is a tricky concept!
Example 1 - A continuous function
We mentioned above that in the single variable case, you can intuitively read "f is continuous" as "You can draw the graph of f without lifting your pencil from the paper." Unfortunately, it's impossible to generalize this sort of statement to multivariable functions. You're not drawing a line on a piece of paper -- you're trying to draw a surface in three-dimensional space!
In practice, that means we have to work with the slightly less intuitive idea that "a multivariable function f is continuous if its graph has no jumps or holes." That's actually not a bad way to think about it; the trick is that it's not always easy to tell if a function has a hole (or a jump) or not!
Just for the record, here's a function which is continuous everywhere. Rotate the picture around and notice that it seems very smooth, without any jumps.
In[134]:=
Out[134]=
Out[135]=
Example 2 - A function with a hole at (0,0) that can be fixed
In this course we're not going to deal with a lot of pathological functions. If a function is not continuous for all points , then usually there will only be one bad point, and usually that bad point will be the origin. Here's an example where we've only changed the function in the previous example a little bit.
In[136]:=
Out[136]=
Out[137]=
Notice that has a hole at (0,0), because it's not even defined there!
In[138]:=
Out[138]=
However, this is not at all evident from the picture, is it? This is another example of how you need to be very careful when using technology; Mathematica will help you visualize things, but it won't always tell you the whole story.
Note that in this case, we could actually "plug" the hole. Look at the picture again and notice that as (x,y) get close to (0,0), the z-values all go to zero. In other words,
although you should remember that graphical evidence isn't the same as actually calculating this limit!
What this means is that we can make into a continuous function by simply defining to be 0. In other words,
is not a continuous function at (0,0), because it doesn't even exist there, but
is a continuous function at (0,0), because we've plugged the hole. Again, this is a tricky concept, but we won't be asking you to do any of this. Ask your TA if you've got questions, though.
Example 3 - A function which is not continuous at (0,0)
Here's an example of a function that's not continuous at (0,0), and there's nothing we can do about it:
To work with this function in Mathematica, it's probably easiest just to use the following definition. If Mathematica ever complains that is undefined, you'll just have to remember on your own that .
In[139]:=
Out[139]=
Let's take a look at the graph of f. The following commands will give you an interactive window with the picture, as well as a static image for later reference.
Notice that, even after using the PlotPoints option, the graph is still a little jagged in the middle. This is usually an indication that something is wrong; the graph is jumping around so much that Mathematica can't keep up!
Rotate the picture around until you get a good feel for what the graph looks like. Along a diagonal on the bottom, the height seems to be , while on the opposite diagonal, on the top, the height seems to be . And that, in a nutshell, is why the function is discontinuous at the origin: if you walk along the ridge on the top, the value at (0,0) "should" be , because otherwise there'd be a jump! But if you walk along the valley in the bottom, the value at (0,0) "should" be , because otherwise there'd be a jump there too. There's no way to satisfy both conditions, so the function has a jump discontinuity at (0,0), even though it's defined there.
What that last paragraph says is really that
How could we prove this? We definitely don't want to have to compute a limit with two variables. As we mentioned above, this is too hard. Instead, we could try to make the difference between the "ridge" and the "valley" a little more mathematical. Evaluate the following cell -- don't worry about understanding the commands -- and then continue reading. You should get a LiveGraphics3D window with a wireframe drawing of the surface, along with two lines.
In[142]:=
Out[143]=
The red line show you all of the points on the surface which are above the line . Look at the picture from above until you see this. Notice that the z-values for these points are always 1/2, with the possible exception of the point above the origin. We can prove this mathematically. If we want to know what the function values are equal to when , simply do that substitution :
Mathematica will do all of this for you.
In[144]:=
Out[144]=
Similarly, the blue line shows you all of the points on the graph which have (x,y) values on the line . Rotate the picture until you can see this. The function values for these points [again, with the possible exception of (0,0)] is always .
In[145]:=
Out[145]=
You've now shown mathematically -- instead of just pictorially -- that if you approach the origin along these two different lines, you end up with different heights. Or, a little more mathematically, the limit as you approach the origin on the red line is +, which the limit as you approach on the blue line is -. Since they don't agree, we've shown that
without having to actually calculate limits. Woohoo!
Incidentally, to show a function isn't continuous at the origin, you need to find two ways to approach (0,0) where you get different heights, but those approaches don't necessarily have to be along these lines -- or even on a line at all, as the next two exercises show. With our particular function in this example, we could have used just about any two lines.
Remember that any non-vertical line through the origin has the form . If you look at the points on the surface above these lines (or below, as the case may be), their height will be:
In[146]:=
Out[146]=
Out[147]=
In our example, we used the slopes and .
Exercise 1
Show that the function
is not continuous at the origin. You should use Mathematica to look at pictures of this surface, but the actual calculations might be easier done by hand. You can copy the following commands and evaluate them to see a picture, but remember that the picture "breaks down" a bit near the origin.
Do the following steps:
(a) Show that the limits agree if you approach above/below any line . (Do this by figuring out what is and then letting x→0.)
(b) Calculate the limit as you approach the origin above the parabola .
(c) Calculate the limit as you approach the origin below the parabola .
You should actually show your calculations here; don't just let Mathematica do them for you. Now interpret your results!
Exercise 2
Repeat Exercise 1 for the following function.
You can use the following commands to see a picture of its graph.
Differentiability
You've already been told in lecture that the derivative of a multivariable function is a matrix, sometimes called (for "Derivative matrix of ), and sometimes called (for "Jacobian of "). Both Df and Jf mean the same thing: the matrix which contains all of the partial derivatives of the function:
Once we've found this matrix, we can evaluate it at a point x=a by plugging in numbers for x, y, or whatever other variables we have. We write this as Df(a). The technical definition of differentiability says that a function is differentiable at a point a if
Yikes! While this definition is correct, it's hard to work with, and it's not at all clear what it means. Let's take a step backwards and figure out what it means for a function to be differentiable.
Think back to single variable calculus. You know the limit definition of a derivative in the single variable case, but intuitively is differentiable at if the graph has a tangent line there, and the derivative is that slope. Another way of thinking about this is that the graph of looks linear ("like a line") near . Evaluate the next cell to see the graph of along with its tangent line for . (You haven't seen this before, but you can give Plot more than one function at a time, as long as you surround them with curly brackets.)
In[148]:=
Out[148]=
Now go back and change the range for x to 0.5 and 1.5. Then .9 and 1.1, or even .999 and 1.001. Notice how the more you "zoom in," the harder it gets to distinguish between the two graphs. In other words, the graph of looks linear when you zoom in far enough. This is also why the tangent line is called the linear approximation of the graph at ; it's the line which most closely approximates the graph there.
So, a single variable function is differentiable at if it has a linear approximation there; is the slope of that line.
Here's the quintessential function from single variable calculus which isn't differentiable at :
In[149]:=
Out[149]=
The graph of does not look like a line at . In fact it has a very sharp corner there, and no matter how far you zoom in --- try a range of -0.00001 to 0.00001 for x! --- you can't make the graph straighten out and look linear.
The same idea works for multivariable functions. If you zoom in far enough on a point on a graph, it should either look linear (which in higher dimensions could be replaced with "planar") or not. If it's linear when you zoom in, then you can find a linear approximation there. Make sense?
So, to draw a direct analog to the single variable case, a multivariable function is differentiable at if it has a linear approximation -- i.e. a tangent plane -- there.
This can be very tricky to figure out! Evaluate the following cells and decide if you think they look linear at the origin. (Remember, you can zoom in/out with LiveGraphics3D by holding down the shift key, clicking on the picture, and dragging the mouse up and down.)
Note that the second function, , isn't defined at (0,0), but you can "plug the hole" by defining the function to be equal to zero there. This makes it a continuous function, which you can assume without checking.
In[150]:=
In[151]:=
It turns out that the first one is differentiable, and the second one isn't. That's hard to see from the second picture, but notice that there are "ridges" and "valleys" leaving the origin along the coordinate axes; the particular way that some of them go up, while some go down, make it impossible to approximate the graph with a tangent plane. The only real possibility is the plane
(You're asked to show this in the exercises.) But look at the following picture of the graph and the plane together. Rotate and zoom in/out as needed. See if you can believe that the plane isn't actually tangent to the surface at (0,0). Basically, the surface has a few "kinks" at (0,0) which prevent the plane from being tangent.
In[152]:=
Out[152]=
Just for comparison, here's the first surface, along with its tangent plane.
In[156]:=
Out[156]=
You can see that the linear approximation isn't very good once you move away from the origin, but the surface certainly doesn't have any kinks in it, or "jab through" the plane near the origin.
So, back to the $64,000 question: why does the big, ugly derivative matrix (or "Jacobian" matrix, which is the same thing) matter? As you hopefully recall, you use it to find the linear approximation --- or "tangent plane" --- for your function.
If you'd like to understand the technical definition a bit more, expand the next subsection; otherwise go on to the summary of what differentiable functions are.
(Expand this Subsection to read an explanation of the technical definition)
Summary of what "differentiable" means
To recap what we've gone over (and add a few more details from lecture that you can look up in your notes):
Single Variable Calculus
A function is differentiable at if has linear approximation (that is, a tangent line) at that point. Moreover, the derivative is the slope of the tangent line. A little less intuitively, the derivative is the number which makes the following equation be the linear approximation to at .
We know that some things, such as polynomials and trig functions, are differentiable. If you're ever in doubt about a given function, you can always check it using the limit definition you learned in Calc I.
Multivariable Calculus
A function is differentiable at if has linear approximation (that is, a tangent (hyper-) plane) at that point. Moreover, the derivative Df() is a matrix which, in some sense, tells you the "slope" of the tangent plane. More accurately, if a little less intuitively, the derivative is the matrix which makes the following equation be the linear approximation to at .
How can you tell if a multivariable function is differentiable? We have the following handy-dandy (if somewhat complicated) theorem.
Differentiability Theorem: is differentiable at a point x=a if each of the entries of the matrix exists at a and is continuous at a; in other words, all of the partial derivatives which make up exist and are continuous functions at a.
The important feature of this theorem is that it requires the partial derivatives to be continuous, and not to merely be defined at some point. That doesn't sound too bad, but you know from the first section of this lab that it can be tricky just to tell if a given function (i.e. one of the partial derivatives) is continuous or not!
Exercise 3
Consider the following function, which we examined above. You may wish to go back and look at the graph and the "alleged" tangent plane at (0,0), which we've already told you isn't really a tangent plane. In this exercise you're going to prove that.
You may assume that is a continuous function without proving it.
(a) Find the partial derivatives of at the origin. Don't use Mathematica to do this; do it by hand. Remember that .
Now let's see why is not differentiable at the origin.
(b) Earlier you were told that if there were a tangent plane at the origin, it would have to be the plane . Prove this. Remember that the equation for the tangent plane -- that is, the linear approximation -- looks like this:
In particular, if we have a function of two variables, the equation for the linear approximation at a point (a,b) becomes
(c) Is the plane tangent to the graph when restricted to the line x = 0? y = 0? y = -x? Check this by making two-dimensional plots of L and when restricted to those lines. Note that tangency is somewhat like continuity: if there's some line along which L fails to be tangent to , then L (in all of 3-space) is not tangent to .
(d) Now you've shown that L is not tangent to . But L is the only possible linear approximation for at the origin; hence there is no linear approximation for there. In other words, is not differentiable at the origin. Explain why this does not contradict the "Differentiability Theorem" above.
Note that we've split this problem up into pieces to help you work through it, but your written solution should not be split up in this way; it should be a seamless essay which investigates this function and hits the important points mentioned here.
Exercise 4
Consider the following function:
You may assume that this is a continuous function (although that's not easy to show!) Prove that does not satisfy the conditions of the "Differentiability Theorem" above at the point (0,0).
Credits
Created by Mathematica (November 6, 2004)