Lab 3A - Continuity and Differentiability
Math 2374 - University of Minnesota
http://www.math.umn.edu/math2374
 questions to 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 will probably 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.

We should also mention that this lab is almost completely independent of Mathematica. Previous versions of this lab were distributed as a PDF; we're using Mathematica to be consistent with the other labs. If you'd like to use a PDF version of this assignment (for example, if you don't have Mathematica at home), it's available at http://www.math.umn.edu/~drake/pdfs/Lab_3A.pdf . However, if changes are made, this Mathematica notebook is considered the authoritative version.

Continuity

From lecture, 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

(lim_( x  ->  a)) f (x)

exists and

(lim_( x  ->  a)) f (x) = f (a).

Determining whether a function is continuous or not is therefore mostly 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 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!

Exercise 1

With that observation in mind, let's consider the following function:

F (x, y) = {({{(xy/((x^2) +  (y^2))), if (x, y)≠(0, 0)
}, {     0,      if (x, y)=(0, 0)}})

Find the limit of F(x,y) as you approach the origin along the following lines: x = 0, y = 0, and y = x.

You don't have to use Mathematica to evaluate these limits—in fact, it's probably easier to not use Mathematica. In each case, you can use the fact that you are restricting the function to a line to reduce your problem to a single-variable limit (which you know how to evaluate). For instance, along the line y = 3x, since the y-coordinate is always equal to 3x, our function can be described by F(x, 3x)—i.e., you just plug in 3x for y.

Do these limits constitute enough information to determine if this function is continuous at the origin? If yes, is it continuous or not? If no, what additional information do you need?

If you'd like to see a graph of the function in Exercise 1, you can use Plot3D:

Plot3D[(x*y)/(x^2 + y^2),  {x, -1, 1}, {y, -1, 
        1}]

...but remember: appearances are sometimes deceiving!

Example 1

The function

G (x, 
            y)  = (( 2  (x^2) y)/((x^4) +  (y^2)))

is a good example of just how strange these functions can be. The limit as you approach the origin along any straight line is 0, but if you approach the origin along the parabola y = (x^2), the limit is 1! To see why this is so, represent any straight line through the origin as y = mx, where m is the slope (technically, this misses the y-axis, but we'll ignore that). Find the limit of G(x,mx) as x goes to zero—that is the limit as you approach along any straight line. Then approach along the parabola y = (x^2) and find the limit of G(x, (x^2)) as x goes to zero. The two limits don't agree!

Existence of Partial Derivatives Does Not Imply Continuity

Let's  look again at  the function F(x,y) that we used in the first exercise and investigate its partial derivatives at the origin. We know that the definition of a partial derivative at some point (x,y) with respect to x (sometimes we'll abbreviate ``with respect to'' as ``wrt'') is

\(lim\+\(\(\ \)\(h\  -> \ 0\)\)\(f \((x + h, \ y)\)\  - \ f \((x, y)\)\)\/h\),

and as you might expect, the partial derivative with respect to y at a point (x,y) is given by

(lim_( h  ->  0))((f (x,  y + h)  -  f (x, y))/h).

The definitions are similar for functions of more than 2 variables; you can look in your textbook to see those.

Exercise 2

We're still using this function F(x,y):

F (x, y) = {({{(xy/((x^2) +  (y^2))), if (x, y)≠(0, 0)
}, {     0,      if (x, y)=(0, 0)}})

Use the limit definition of partial derivatives to find the partial derivatives with respect to x and y of F[x,y] at (x,y) = (0,0). As before, you don't need to use Mathematica, but please include your calculations in your lab report. Remember that F(0,0) is defined differently from other points (x,y). You'll have to account for that in calculating the limit.

In terms of a function being continuous at a point and having partial derivatives at a point, how is this different from the single-variable case? (for functions of one variable, ``partial derivative'' just means the regular derivative that you know and love from Calc I)

We can see a connection between this exercise and the first. We need to be able to approach along any path and have the limits agree in order to have continuity—when finding the partial derivatives, in a sense we are only considering two paths: a horizontal and vertical line. You might say that we need to ``look in more directions'' to see if the function is continuous or not.

Differentiability

The technical definition of differentiability says that a function is differentiable at a point a if there's a linear transformation T such that

(lim_(x -> a))((|f(x) - f(a) - T(x-a)|)/(|x-a|)) = 0

(the single bars in that equation mean ``length of a vector'', not absolute value). Let's think about what that equation means: the limit is zero, so as x approaches a, the numerator becomes much smaller than the denominator. The denominator is just the distance from x to a. Since T is linear, T(x-a) = T(x) - T(a), and the part of the numerator inside the bars can be written in a somewhat more illuminating way:

f(x) - f(a) - (T(x) - T(a)) = f(x) - f(a) - T(x) + T(a).

But wait...T is a tangent plane (or ``tangent 3-space'', etc) so f(a) must equal T(a), and in the above equation they'll cancel. So the numerator becomes even simpler—

f(x) - T(x)

—and we can rewrite the above limit as

(lim_(x -> a))((|f(x)  - T(x)|)/(|x-a|)) = 0.

If that limit is zero, then as x approaches a (along any path, of course) the numerator is much smaller than the denominator, which means that the linear transformation approximates f(x) very well near a. You might say that in a very small neighborhood of a, f(x) is ``just about'' linear. Your text has some pictures on page 190 that make this a little more clear.

This definition of differentiability is, unfortunately, not very practical. If we're interested in deciding whether a function is differentiable or not (and also in finding the particular linear transformation that approximates it), theorem 3.5.1 provides a nice test. Below it's stated for only two variables; your text has the full details.

Theorem 3.5.1: If f : (ℝ^2) ⟶ ℝ has partial derivatives that are defined on an open disk around a point a in the domain of f, and if ∂f/∂x and ∂f/∂y are continuous at a, then f is differentiable at a. Furthermore, the total derivative of f at a is given by

Df(a) = [∂(f/∂)x(a)    ∂(f/∂)y(a)] [({{x}, {y}})].

The important feature of theorem 3.5.1 is that it requires the partial derivatives to be continuous, and not to merely be defined at some point.

Continuity of a Function and Existence of Its Partial Derivatives Do Not Imply Differentiability

If the derivative of a single-variable function exists at a point, the function is (of course) differentiable at that point. We saw in the last problem that a function of two variables can fail to be continuous at a point—thus having no chance whatsoever of being differentiable—but still have partial derivatives at that point.

This means that ``existence of partial derivatives'' is not a sufficient criterion for differentiability. The function we just looked at wasn't continuous; if we add that requirement, can we guarantee that a function is differentiable? The answer, as you can see from the title, is ``no''; we'll verify that with an example of a function that (1) is continuous at a point and (2) has partial derivatives at a point, but alas, is not differentiable at that point.

This function is

G (x, y) = {({{(((x^3)  -  (y^3))/((x^2)  +  (y^2))),  if (x, 
                      y)  ≠  (0, 0);}, {0,             if (x, y)  =  (0, 
                    0).}})

Exercise 3

(i) Graph the function G (just use the definition for (x,y) ≠ (0,0)). Is G continuous at the origin? Using ``ViewPoint -> {-3,1,1}'' gives a nice perspective on the function. You don't need to prove that G is continuous; in this case, appearances won't deceive you.
  
(ii) Find the partial derivatives of G at the origin. You will again need to use the limit definitions because of the way we have defined G.
  
Now let's see why G is not differentiable at the origin.

(iii) Knowing the partials of G at the origin, describe the linear transformation that presumably approximates G at the origin (a less fancy way to say this is, ``find the equation of the tangent plane''). Let's call this plane P(x,y).

(iv) Plot G and this alleged tangent plane together. Does P appear to be tangent to G at the origin? It will help to use ``BoxRatios -> {1,1,1}'' in your graph. To see the relationship between G and P, it may help you to go to http://www.math.umn.edu/~drake/exercise3.html and play with a ``live'' version of the graph of these two functions.

(v) Is P tangent to G when restricted to the line x = 0? y = 0? y = -x? Check this by making two-dimensional plots of G and P when restricted to those lines. Note that tangency is somewhat like continuity: if there's some line along which P fails to be tangent to G, then P (in all of 3-space) is not tangent to G.

(vi) You should see that P is not actually tangent to G. P is the only possible linear transformation that could approximate G at the origin, and it fails to do so—which means that G is not differentiable at the origin. Which hypotheses of theorem 3.5.1 are not satisfied? Explain why these hypotheses have not been satisfied.

The upshot of this section is that G came ``really close'' to being differentiable, and that (in the context of theorem 3.5.1) it failed to be differentiable in only one small way (i.e, continuity of partials).

Differentiability Does Not Imply Mixed Partials Are Equal

At this point we've seen that

	* if you approach a point along a number of different paths and the limit exists for each path, the function isn't necessarily continuous;
	* if a function has partial derivatives at a point, it's not necessarily continuous;
	* if a function is continuous and has partial derivatives, it's not necessarily differentiable. 
  
You might think that if a function is differentiable, it is then ``perfectly nice'' and no more of these headaches can occur. Unfortunately, that's not so.The mixed partial derivatives can fail to be equal at a point where a function is differentiable. Fortunately, we have at our disposal Clairaut's Theorem (3.4.1 in the text, page 182), which tells us precisely when the mixed partials are equal:

Clairaut's Theorem: Suppose the mixed partial derivatives of a function f : (ℝ^2) ⟶ ℝ are defined on an open disk D about a point a in the domain of f. If (∂^2) (f/(∂y ∂x)) and (∂^2) (f/(∂x ∂y)) are continuous at a, then

(∂^2) (f/(∂y ∂x))(a) = (∂^2) (f/(∂x ∂y))(a).

Roughly this means that if the mixed partials are both continuous at a point, then they are equal at that point.

In this exercise we'll examine the function

H (x, y) = {({{(((yx^3) - (xy^3))/((x^2)  +  (y^2))),  if (x, 
                      y)  ≠  (0, 0);}, {0,             if (x, y)  =  (0, 
                    0).}})

Exercise 4

(i) Find the partial derivatives wrt x and y. You should find the general forms of the partials and write them in ``bracket form'' like we've been writing the functions F, G, and H. When you are away from the origin (when (x,y) ≠(0,0)), you can calculate the partials using the quotient rule, but you'll have to use the limit definition at the origin.

(ii) Graph the partials. Do they seem continuous at the origin? In the context of theorem 3.5.1, what does this mean for H at the origin?

(iii) What is the linear transformation that approximates H at the origin?

(iv) Now let's look at the mixed partials. Take ∂(H/∂)x and use the limit definition to find the partial derivative of that function with respect to y at the origin. Do the same thing, but switched around appropriately, for ∂(H/∂)x.

(v) What is (∂^2) 
              (H/(∂y ∂x)) (0, 0)? What is (∂^2) 
              (H/(∂x ∂y)) (0, 0)? You should see that the mixed partials are not equal. This means that one or more of the hypotheses of Clairaut's Theorem is not satisfied. Which hypotheses aren't satisfied? Show why these hypotheses aren't satisfied.

Our final problem of this lab is a slightly modified version of a problem by Peter Selinger of the University of Ottawa. It's a bit tricky, so don't do this one until you've completed and understand all of the problems up to this point.

Exercise 5: The Lie Detector Test

Alice claims to know of a function f(x,y) that is differentiable everywhere, and whose partial derivatives are

	∂(f/∂)x  =  
        x Exp((x^2) (y^2)),       ∂(f/∂)y  =  
        y Exp((x^2) (y^2))

(recall that ``Exp(u)'' means ``e to the u'') and Bob claims to know a function g(x,y), also differentiable everywhere, such that

	∂(g/∂)x  =  
        y Exp((x^2) (y^2)),       ∂(g/∂)y  =  
        x Exp((x^2) (y^2)).

Be careful about the x's and y's in the above equations!

One of these two is lying. Which one, and how do you know?

(hint: one of these functions violates Clairaut's Theorem)