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

Underscript[lim, x  a] f (x)

exists and

Underscript[lim, x  a] f (x) = f (a) .

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:

Cell[GraphicsData[PostScript, %!<br />%%Creator: Mathematica<br />%%AspectRatio: 1 <br />MathP ... ooo0@3oool00001<br />], ImageRangeCache -> {{{209.375, 413.125}, {282.75, 79.}} -> {-4, 1, 0, 0}}]

(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):

Cell[GraphicsData[PostScript, %!<br />%%Creator: Mathematica<br />%%AspectRatio: .5 <br />Math ... c80oooo<br />0000], ImageRangeCache -> {{{191.75, 457.125}, {478.563, 346.375}} -> {-5, 8, 0, 0}}]

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]:=

f[x_, y_] = Exp[-(x^2 + y^2)] Plot3D[f[x, y], {x, -1, 1}, {y, -1, 1}]

Out[134]=

^(-x^2 - y^2)

[Graphics:HTMLFiles/index_7.gif]

Out[135]=

⁃SurfaceGraphics⁃

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 f(x, y) is not continuous for all points (x, y), 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]:=

f[x_, y_] = Exp[-1/(x^2 + y^2)] Plot3D[f[x, y], {x, -1, 1}, {y, -1, 1}]

Out[136]=

^(-1/(x^2 + y^2))

[Graphics:HTMLFiles/index_13.gif]

Out[137]=

⁃SurfaceGraphics⁃

Notice that fhas a hole at (0,0), because it's not even defined there!

In[138]:=

f[0, 0]

                                     1 Power :: infy : Infinite expression  - encountered. More…                                      0

                                                     ComplexInfinity ∞ :: indet : Indeterminate expression                  encountered. More…

Out[138]=

Indeterminate

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,

Underscript[lim, (x, y)  (0, 0)] f (x, y) = 0,

although you should remember that graphical evidence isn't the same as actually calculating this limit!

What this means is that we can make f(x, y)into a continuous function by simply defining f(0, 0)to be 0.  In other words,

f(x, y) = e^(-1/(x^2 + y^2))

is not a continuous function at (0,0), because it doesn't even exist there, but

f (x, y) = {      2    2                                                                       ...                      0,       if (x, y) = (0, 0)

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:

f (x, y) = {  xy                                                                               ...                      0,       if (x, y) = (0, 0)

To work with this function in Mathematica, it's probably easiest just to use the following definition. If  Mathematica ever complains that f(0, 0)is undefined, you'll just have to remember on your own that f(0, 0) = 0.

In[139]:=

f[x_, y_] = x * y/(x^2 + y^2)

Out[139]=

(x y)/(x^2 + y^2)

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.

graph = Plot3D[f[x, y], {x, -1, 1}, {y, -1, 1}, AxesLabel {"X", "Y", "Z"}, PlotPoints40] ; ShowLive[graph] ;

[Graphics:HTMLFiles/index_31.gif]

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 -1/2, while on the opposite diagonal, on the top, the height seems to be +1/2.  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 +1/2, because otherwise there'd be a jump!  But if you walk along the valley in the bottom, the value at (0,0) "should" be -1/2, 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

Underscript[lim, (x, y)  (0, 0)] f (x, y) ≠f (0, 0) ; in fact, the limit  does not exist !

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]:=

RowBox[{RowBox[{dx, =, RowBox[{dy, =, RowBox[{1.1, /, 10}]}]}], ;}] RowBox[{Show, [, RowBox[{G ... bel {"X", "Y", "Z"}, ,, ViewPoint {1, -2, 1}}], ]}]

[Graphics:HTMLFiles/index_38.gif]

Out[143]=

⁃Graphics3D⁃

The red line show you all of the points on the surface which are above the line y = x.  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 y = x, simply do that substitution :

f (x, x) = (x (x))/(x^2 + (x)^2) = x^2/(x^2 + x^2) = x^2/(2x^2) = 1/2

Mathematica will do all of this for you.

In[144]:=

f[x, x]

Out[144]=

1/2

Similarly, the blue line shows you all of the points on the graph which have (x,y) values on the line y = -x.  Rotate the picture until you can see this.  The function values for these points [again, with the possible exception of (0,0)] is always -1/2.

In[145]:=

f[x, -x]

Out[145]=

-1/2

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 +1/2, which the limit as you approach on the blue line is -1/2.  Since they don't agree, we've shown that

Underscript[lim, (x, y)  (0, 0)] f (x, y)    does not exist

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 y = m x.  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]:=

f[x, m * x] Simplify[%]

Out[146]=

(m x^2)/(x^2 + m^2 x^2)

Out[147]=

m/(1 + m^2)

In our example, we used the slopes m = 1 and m = -1.

Exercise 1

Show that the function

g (x, y) = {    2                                                                              ...                      0,       if (x, y) = (0, 0)
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.

Clear[g, x, y] ;  g[x_, y_] = (2x^2 * y)/(x^4 + y^2) <br /> graph = Plot3D[g[x, y], {x ... 54; {"X", "Y", "Z"}, PlotPoints30] ; <br /> ShowLive[graph]

Do the following steps:

(a) Show that the limits agree if you approach above/below any line y = m x.  (Do this by figuring out what g(x, m x)is and then letting x→0.)

(b) Calculate the limit as you approach the origin above the parabola y = x^2.

(c) Calculate the limit as you approach the origin below the parabola y = -x^2.

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.

g (x, y) = {   4  2                                                                            ...                      0,       if (x, y) = (0, 0)

You can use the following commands to see a picture of its graph.

Clear[g, x, y] ;  g[x_, y_] = (x^4 * y^2)/(x^4 + y^2)^2 <br /> graph = Plot3D[g[x, y], ... 54; {"X", "Y", "Z"}, PlotPoints50] ; <br /> ShowLive[graph]

Differentiability

You've already been told in lecture that the derivative of a multivariable function f : ^n ^m is a matrix, sometimes called D f (for "Derivative matrix of f), and sometimes called J f (for "Jacobian of f").  Both Df and Jf mean the same thing: the matrix which contains all of the partial derivatives of the function:

( ∂ f     ∂ f                   ∂ f   )                    1 ... 8706; x                   ∂ x                    1             2    ⋯                n

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

 Underscript[lim, x  a] (|| f (x) - f (a) - D f (a) (x - a) ||)/(|| x - a ||) = 0

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 f(x) is differentiable at x = a 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 f(x) looks linear ("like a line") near x = a.  Evaluate the next cell to see the graph of y = x^2along with its tangent line for x = 1.  (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]:=

Plot[{x^2, 2x - 1}, {x, -1, 3}]

[Graphics:HTMLFiles/index_80.gif]

Out[148]=

⁃Graphics⁃

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 y = x^2looks linear when you zoom in far enough.  This is also why the tangent line is called the linear approximation of the graph at x = 1; it's the line which most closely approximates the graph there.

So, a single variable function f(x) is differentiable at x = a if it has a linear approximation there; f ' (a)is the slope of that line.

Here's the quintessential function from single variable calculus which isn't differentiable at x = 0:

In[149]:=

Plot[Abs[x], {x, -1, 1}]

[Graphics:HTMLFiles/index_89.gif]

Out[149]=

⁃Graphics⁃

The graph of y = | x | does not look like a line at x = 0.  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 Overscript[x, ⇀] = Overscript[a, ⇀]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, (x^3 - y^3)/(x^2 + y^2), 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]:=

surf1 = Plot3D[Exp[-(x^2 + y^2)] - 1, {x, -1, 1}, {y, -1, 1}, AxesLabel {"X", "Y", "Z"}, PlotPoints40] ;

[Graphics:HTMLFiles/index_96.gif]

In[151]:=

surf2 = Plot3D[(x^3 - y^3)/(x^2 + y^2), {x, -1, 1}, {y, -1, 1}, AxesLabel {"X", "Y", "Z"}, PlotPoints40] ;

[Graphics:HTMLFiles/index_98.gif]

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

z = x - y

(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]:=

plane2 = Plot3D[x - y, {x, -1, 1}, {y, -1, 1}, PlotPoints40] Show[surf2, plane2, BoxRatios {1, 1, 2}, ViewPoint {-2, 1, 2}] ;

[Graphics:HTMLFiles/index_101.gif]

Out[152]=

⁃SurfaceGraphics⁃

[Graphics:HTMLFiles/index_103.gif]

Just for comparison, here's the first surface, along with its tangent plane.

In[156]:=

plane1 = Plot3D[0, {x, -1, 1}, {y, -1, 1}, PlotPoints40] RowBox[{RowBox[{Show, [, RowB ... owBox[{ViewPoint, , RowBox[{{, RowBox[{1, ,, -2, ,, RowBox[{-, 0.1}]}], }}]}]}], ]}], ;}]

[Graphics:HTMLFiles/index_105.gif]

Out[156]=

⁃SurfaceGraphics⁃

[Graphics:HTMLFiles/index_107.gif]

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 f : ^1 ^1is differentiable at x = a if has linear approximation (that is, a tangent line) at that point.  Moreover, the derivative f ' (a) is the slope of the tangent line.  A little less intuitively, the derivative f ' (a) is the number which makes the following equation be the linear approximation to f at x = a.

L (x) = f (a) + f ' (a) (x - a)

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 f : ^n ^mis differentiable at Overscript[x, ⇀] = Overscript[a, ⇀] if has linear approximation (that is, a tangent (hyper-) plane) at that point.  Moreover, the derivative Df(Overscript[a, ⇀])  is a matrix which, in some sense, tells you the "slope" of the tangent plane.  More accurately, if a little less intuitively, the derivative Df(Overscript[a, ⇀]) is the matrix which makes the following equation be the linear approximation to f at x = a.

L (Overscript[x, ⇀]) = f (Overscript[a, ⇀]) + D f (Overscript[a, ⇀]) (Overscript[x, ⇀] - Overscript[a, ⇀])

How can you tell if a multivariable function is differentiable?  We have the following handy-dandy (if somewhat complicated) theorem.

Differentiability Theorem: f : ^n ^m is differentiable at a point x=a if each of the entries of the matrix D f(a) exists at a and is continuous at a; in other words, all of the partial derivatives which make up D f(a) 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.

f (x, y) = { 3    3             x  - y             -------, if (x, y) ≠ (0, 0) ;         ...    0,             if (x, y) = (0, 0) .

You may assume that f(x, y) is a continuous function without proving it.
   
(a) Find the partial derivatives of f at the origin.  Don't use Mathematica to do this; do it by hand.  Remember that f(0, 0) = 0.

Now let's see why f 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 z = x - y.  Prove this.  Remember that the equation for the tangent plane -- that is, the linear approximation -- looks like this:

                        L (Overscript[x, ⇀]) = f (Overscript[a, ⇀]) + D f(Overscript[a, ⇀]) (Overscript[x, ⇀] - Overscript[a, ⇀])

In particular, if we have a function of two variables, the equation for the linear approximation at a point (a,b) becomes

                        L(x, y) = f(a, b) + D f(a, b) · (x - a, y - b)

(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 f 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 f, then L (in all of 3-space) is not tangent to f.

(d) Now you've shown that L is not tangent to f.  But L is the only possible linear approximation for f at the origin; hence there is no linear approximation for f there.  In other words, f 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:

f (x, y) = {1        2    2             - y Log[x  + y ],        ...              if (x, y) = (0, 0) .

You may assume that this is a continuous function (although that's not easy to show!)  Prove that f does not satisfy the conditions of the "Differentiability Theorem" above at the point (0,0).

Credits


Created by Mathematica  (November 6, 2004)