Landscapes z = f(x, y) and their contour maps, level surfaces in space, and limits that depend on how you approach
A function of two variables is a landscape: over each point (x, y) of the floor stands a height z = f(x, y). You can look at it from the side as a surface, or from above as a map of contour lines, as hikers do. Add a third variable and the contours become surfaces in space, and even the idea of a limit gets more interesting, because there are infinitely many directions to come from.
Type a function or pick one. Slide the cutting plane to see where it meets the surface, and move over the map to walk a marker across the landscape.
Drag the surface to turn it. Both pictures use the same 14 equally spaced levels and the same colours, from deep indigo (low) to cream (high). The vertical scale of the surface is stretched to fit the scene, and the extreme 1% of heights is clipped so that poles do not swamp the picture; the readouts are true values.
The graph of f(x, y) is the surface {(x, y, z) : z = f(x, y)} in space. Its level curves are the sets f(x, y) = c in the plane: slice the graph with the horizontal plane z = c and look down. A contour map draws level curves for equally spaced values of c, so the spacing between them measures steepness: crowded lines mean the height changes quickly with distance, wide gaps mean gentle ground.
Contours read the shape of a landscape. Around a peak or a pit they close up into nested loops. At a saddle such as x² − y² the level curve through the saddle point is a pair of crossing lines and the others are hyperbolas, rising on two sides and falling on the other two. The monkey saddle x³ − 3xy² has three valleys and three ridges meeting at the origin, room for a monkey’s tail.
Lines of equal depth appeared on Dutch charts of rivers and harbours long before anyone drew lines of equal height on land. One of the first to do that was the mathematician Charles Hutton, in the 1770s, while working up survey data from the Scottish mountain Schiehallion for the experiment that measured the density of the Earth.
For a function of three variables the level sets f(x, y, z) = c are surfaces. Slide c through the special values and watch the shape change, not just its size.
f(x, y, z) = x² + y² − z²
Blue faces look towards larger f (the direction of the gradient), amber faces towards smaller f. The function is sampled once on a 49³ grid; each slider move re-runs marching tetrahedra on those samples, so the surface is exact at the grid’s edges and linear in between. The slice cuts away everything above z = s and draws the level curve f(x, y, s) = c in yellow.
A function of three variables cannot be graphed (that would take four dimensions), but its level sets can be drawn. Temperature in a room has isothermal surfaces; the potential of a point charge has concentric spheres. For most c the level set f = c is a smooth surface, and as c changes it deforms gently.
The exceptions happen at critical values, levels that contain a point where the gradient of f is zero. For x² + y² − z² the only critical point is the origin, where f = 0: just above 0 the level set is a connected hyperboloid of one sheet, at 0 a double cone, and just below 0 two separate sheets. For the torus function the change comes at c = 4, when the tube reaches the z-axis, where the function is not smooth (√(x² + y²) has a corner there), and the hole closes. Morse theory, developed by Marston Morse in the 1920s and 1930s, makes this precise: the topology of the level sets can only change by passing a critical value.
The surfaces here are found by marching tetrahedra. Sample f on a grid, split each cube of the grid into six tetrahedra, and wherever f − c changes sign along an edge, put a vertex at the linearly interpolated crossing. Each tetrahedron contributes nothing, a triangle or a quadrilateral. The related marching cubes algorithm, published by William Lorensen and Harvey Cline in 1987, made this the standard way to turn CT and MRI scans into 3D surfaces.
A bead slides toward the origin and reports the heights it sees. Drag the start of the path, switch to a parabola or a spiral, and compare what different paths find.
f(x, y) = xy / (x² + y²), undefined at the origin. On the map, blue means f > 0 and red means f < 0. The bead’s distance shrinks geometrically, to 0.2% of where it started. The polar panel shows f around circles of shrinking radius: if the limit were L, these curves would flatten onto the line at height L. For xy/(x² + y²) they do not change at all, sin 2θ / 2 at every radius; for 2x²y/(x⁴ + y²) the spikes narrow but keep their height 1.
The limit of f(x, y) as (x, y) → (a, b) is L if f(x, y) is as close to L as you like whenever (x, y) is close enough to (a, b), however it gets there. In one variable there are only two directions, left and right. In the plane there are infinitely many, and also curved paths, spirals, and paths that zigzag.
That gives a practical test for non-existence. If two paths give different limits, the limit does not exist. For f = xy/(x² + y²) along the line y = mx, f = m/(1 + m²), so the x-axis gives 0 and the line y = x gives ½. The function 2x²y/(x⁴ + y²) is subtler: along every straight line through the origin f → 0, yet along the parabola y = x² it equals 1 everywhere. Checking all lines is not enough.
Agreement along paths never proves a limit exists; a proof needs a bound that works for every approach at once. Polar coordinates often supply one. For x²y/(x² + y²), write x = r cos θ, y = r sin θ to get r cos²θ sin θ, which is at most r in size whatever θ is, so the limit is 0. For xy/(x² + y²) the same substitution gives ½ sin 2θ, with no r left at all: the value depends only on the direction, which is exactly why the limit fails.
Spot a mistake or have an idea?