Continuity and Differentiability

Department of Mathematics, Statistics and Computer Science

University of Illinois at Chicago

by Paul Brown, Heidi Burgiel, Marc Culler, Heather Dye and John Wood

Copyright © 1999, The University of Illinois at Chicago

Maple is a registered trademark of Waterloo Maple Software



Introduction

In this lab you will use Maple to examine closely how a function of two variables behaves near a point. Usually, functions vary smoothly near a point. Sometimes, functions of two variables may have kinks or cusps in their graphs, and fail to be differentiable at a point. Sometimes the values a function takes varies widely near a point, and the function is not continuous at that point. The concepts of differentiability and continuity are analogous to concepts from single variable calculus, but functions of multiple variables may be discontinuous or non-differentiable in surprising new ways.

Differentiability

In Calculus 1, we said a function of one variable was differentiable at a point if we could find the slope of the tangent to its graph at that point; in other words, if the function always looked like a straight line when we "zoomed in" on it at that point. Here is an example:

> f1 := x -> x^3-2*x^2+x;

[Maple Math]

> plot(f1(x), x=-0.2..1.4);

The graph of this polynomial function looks smooth; we expect the function to be differentiable, so we expect it to look like a straight line when we zoom in on it. To zoom in on the point x=0.5 , we choose a small range of x values around 0.5 and plot the function again.

> plot(f1(x), x=0.499..0.501);

When we zoom in on the graph, it looks like a straight line -- the tangent line to the graph at x=0.5 . This function of one variable is differentiable at x=0.5 .

A function of two variables is differentiable at a point if its graph looks like a flat surface when we "zoom in" on that point. A function of two variables is differentiable at a point if it is well approximated by its tangent plane near the point . So if we use Maple to zoom in on the graph of a function of two variables, and the graph looks flat once we've zoomed in far enough, then the function is differentiable at the point we zoomed in on. A "flat" graph is very close to (or equal to) its tangent plane, and so it the equation of the function is well approximated by the equation of the tangent plane in places where the function's graph appears flat.

Let's look at an example. Open a new Maple worksheet. Define a function f of two variables as below.

> f := (y,x) -> x^2 + y^2 - x;

[Maple Math]

On a large scale, the graph of f is not flat:

> plot3d(f(x,y), x = -2..2, y = -2..2, axes=BOX);

The domain for the graph above is a square of width 4 centered on the origin (how can you tell this from the plot command?) The graph looks smooth, which suggests that it might be flat if we zoom in on it. Let's see if f is differentiable (locally flat) at the point (0,0). To do this, we find a smaller square (width 2) centered on the origin and graph the function over that square:

> plot3d(f(x,y), x = -1..1, y = -1..1, axes=BOX);

The graph is not as steeply curved as it used to be -- it's getting flatter as we zoom in. Let's zoom in again, drawing the graph of f over a square of width 1 centered on (0,0).

> plot3d(f(x,y), x = -0.5 .. 0.5, y = -0.5 .. 0.5, axes=BOX);

The graph looks even flatter! Let's skip ahead and zoom in on a square of width .01.

> plot3d(f(x,y), x = -0.005 .. 0.005, y = -0.005 .. 0.005, axes=BOX);

We have zoomed in on graph of the function f(x,y) = x^2 + y^2 - x at the point (0,0), and it appears flat. We conclude that near the point (0,0), the graph of f is very close to the tangent plane approximation of f at (0,0) and so the function is differentiable at the point (0,0).

Try this yourself: zoom in on the function x^2 -2*x*y + y^3 near the point (0,0). If you typed the commands above into a Maple document, you should be able to cut, paste and edit your commands to quickly see that this new function is differentiable at (0,0).

Zooming Made Simple

We will need to zoom in on a lot of different graphs at a lot of different points. Finding the x and y ranges for a square of width .01 centered at the point (2.2, 0.35) by hand is not much fun, so we will program Maple to do this for us.

What do we need to know when we zoom in on the graph of a function? We need the definition of the function, what point we're zooming in on, and the width of the square of graph we want to see. These three values (function, point, and width) are the arguments given to our Maple zooming tool, which we define in the same way we do a Maple function. The command to define the zooming tool is shown below; type it in to your Maple worksheet now.

> zoom := (f, x0, y0, w) -> plot3d( f(x,y), x = x0-w/2..x0+w/2, y = y0-w/2..y0+w/2, axes=BOX);

[Maple Math]

Now define a new function g = x - |y| and test this tool.

> g := (x,y)-> x - abs(y);

[Maple Math]

> zoom(g, 2.2, 0.35, 4);

Did you get something that looks like the picture above? This is the graph of g near the point (2.2, 0.35) over a square of width 4. Is g differentiable at the point (2.2, 0.35)? Make a guess, then check it using the command "zoom(g, 2.2, 0.35, 0.01);".

Look at the graph of the function g near the point (2,0). What is the approximate value of g at (2,0)? Do you think g is differentiable at (2,0)? Let's use the zoom tool to find out.

> zoom(g, 2, 0, 0.01);

This is not flat! Maybe we should zoom in further.

> zoom(g, 2, 0, 0.0001);

Still not flat. In fact, no matter how far we zoom in it will never be flat. The function g = x - |y| is not differentiable at the point (2,0). This is because the term |y| is not differentiable; g will always have a crease along the line y =0.

A function can be non-differentiable even if all its terms are differentiable, as in the following example.

> f2 := (x,y) -> x^3 * y / (x^4 + y^2);

> plot3d(f2(x,y), x=-2..2, y=-2..2, axes=BOX, shading=ZHUE, style=patchcontour);

[Maple Math]

The graph below was obtained by zooming in on this function near (0,0). You can see that it is not nearly flat, even though we are looking at a square patch of width 0.1. This function is differentiable everywhere except at (0,0)!

Exercise 1

For each of the functions listed below, use the zoom tool to decide if the function is differentiable at the point given. If you conclude that the function is not differentiable, describe the features of the graph of the function that lead you to that conclusion.

a) g1(x,y) = x^2 - 2*x*y + y^3 at (0.5, -0.5)

b) g2(x,y) = x*y / sqrt(x^2 + y^2) at (0,0)

c) g3(x,y) = x*y / (x^2 + y^2) at (0,0)

Differentiability and Critical Points

So far, none of the points we've zoomed in on have had horizontal tangent planes. Just as horizontal tangent lines were important for finding maximum and minimum points in Calculus 1, horizontal tangent planes will be important in Math 210. Zooming in on a point on the graph that has a horizontal tangent plane looks a little different than zooming in on other points, so we pay special attention to this case here.

The function h(x,y) = x^2 - y^2 has a "saddle point" at (0,0).

> h := (x,y) -> x^2 - y^2;

[Maple Math]

> zoom(h,0,0,4);

At (0,0), the graph of the function flattens out. As you move away from (0,0) in the x direction, the function increases. As you move in the y direction, the function decreases. This remains true as you zoom in on the point (0,0).

> zoom(h, 0, 0, 1);

> zoom(h, 0, 0, 0.1);

At smaller scales, the graph continues to curve up in the x direction and down in the y direction. At first glance, it doesn't look like it will be well approximated by its tangent plane. However, if we look closer we see that the height ( z -range) of the graph is much much smaller than the width ( x - and y -range) of the graph. The graph is really almost flat; Maple just draws it as curved. We can verify this by using the scaling=CONSTRAINED option to force Maple to match the scale on the z -axis to the scales on the x - and y -axes.

> plot3d(h(x,y),x = -0.05..0.05, y=-0.05..0.05, axes=BOX, scaling=CONSTRAINED);

Now the graph looks as flat as it is. We conclude that the function x^2-y^2 is differentiable at the point (0,0).

Exercise 2

For each of the functions listed below, use the zoom tool to decide if the function is differentiable at the point given. If you conclude that the function is not differentiable, describe the features of the graph of the function that lead you to that conclusion.

a) g4(x,y) = x^2 +y^2 at (0,0)

b) g5(x,y) = sqrt(x^2 + y^2) at (0,0)

Introduction to Continuity

In Calculus 1, we said that a function of one variable was continuous if you could draw its graph without lifting your pencil from the page. In other words, a function of one variable is continuous if it doesn't have any "jumps". Functions of two variables are hard to draw with a pencil, and can do stranger things than jump. But the basic ideas remain the same. A function of two variables is continuous at a point if its value doesn't make any sudden changes near that point.

The function |x| is not differentiable at x =0, but it is continuous at x =0 because when x is near 0, |x| is also near 0.

> plot(abs(x), x = -1..1);

The Maple function signum( x ) is not continuous (or differentiable) at x =0, because it jumps from -1 to 1 at that point.

> plot(signum(x), x = -2..2, discont=true, color=RED);

We can use signum() to create an example of a function of two variables that is not continuous:

> f3 := (x,y) -> signum(x*y) - x/10;

[Maple Math]

> plot3d(f3(x,y), x = -2..2, y = -2..2, axes=BOX);

This function fails to be continuous in two ways. First, it jumps from about -1 to about 1 along the lines x =0 and y =0. A second, more interesting, discontinuity occurs at (0,0), where it has values of about -1 two quarters of the way around the point, and values close to 1 the other quarter of the way around the point. We get another view of this region by zooming in:

> zoom(f3, 0, 0, 0.01);

No matter how much we zoom in on the graph near (0,0), we will always get a picture like this, and the z -range of the function will always be about 2. Because the z -range does not shrink (i.e. because the values of the function always jumps from about -1 to about 1 near (0,0)), we conclude that the function is discontinuous at the point (0,0).

Testing for Continuity using Maple

We say that function f(x,y) is continuous at a point (a,b) if there is some number v so that f(x,y) is always close to v when point (x,y) is close enough to point (a,b) . In other words, near point (a,b) the value of f doesn't suddenly "jump away" from the value v=f(a,b) .

Remember that the Maple box is drawn so that the graph touches the top and bottom of the box. To tell whether a function f is continuous at a point (a,b) , zoom in on the graph near the point (a,b) . If the function is not continuous, it will "jump" near (a,b) and the height of the box (the z -range) will be equal to the distance of the jump -- the height will not shrink as the width goes to 0. If the height of the box does approach 0 as the width gets smaller, then the function's values get closer and closer to some limit v at point (a,b) and the function is continuous.

The graph of the function f3(x,y) = sign(x*y) - x/10 went all the way from -1 to 1 near (0,0) no matter how far we zoomed in. Now let's zoom in on the same graph near the point (1/2, 1/2).

> zoom(f3, 1/2, 1/2, 0.1);

We can read off of the z -axis of our box that the values of the function range from about 0.945 to about 0.955 over this interval. This is a very small range (roughly .01), and the range would get smaller if we zoomed in closer (try it!) We conclude that the function is continous at the point (1/2, 1/2).

Exercise 3

For each of the functions listed below, use the zoom tool to decide if the function is continuous at the point given. If you conclude that the function is not continuous, describe the features of the graph of the function that lead you to that conclusion.

a) g1(x,y) = x^2 - 2*x*y + y^3 at (0.5, -0.5)

b) g2(x,y) = x*y / sqrt(x^2 + y^2) at (0,0)

c) g3(x,y) = x*y / (x^2 + y^2) at (0,0)

An interesting discontinuity

Plot the function f4(x,y) = x^2 * y / (x^4 + y^2) . This simple quotient of two polynomials appears to be differentiable and continuous almost everywhere. However, this function has a discontinuity at the origin.

> f := (x,y) -> x^2 * y / (x^4 + y^2);

> plot3d(f(x,y), x=-2..2, y=-2..2, axes=BOX, shading=ZHUE, scaling=CONSTRAINED, style=PATCHCONTOUR);

[Maple Math]

It is difficult for Maple to depict this discontinuity for us, but it is simple enough to understand it using algebra. What are the values of the function f when y = x^2 ? Substitute x^2 for y and evaluate f :

> f(x,x^2);

[Maple Math]

On your own, verify that f(x, -x^2) = -1/2 .

Approaching the origin along the curve y=x^2 , the value of f is always 1/2. However, on the curve y=-x^2 the value of f is always -1/2. So no matter how close to (0,0) you get, there will always be points where f has the value 1/2 nearby, and there also will be nearby points where f has the value -1/2. There is no number v for which f(x,y) is always close to v when (x,y) is near (0,0), so f is not continuous at (0,0).