Chapter II · Functions of real variables

Functions of two variables

§31 30 min

When z depends on two variables x and y, its graph is a surface in space; planes and spheres as loci of equations in three coordinates; and how horizontal slices turn a surface into a contour map.

Why this matters

Many quantities depend on more than one other: the height of land on two map coordinates, the pressure of a gas on its volume and temperature. §31 extends everything said about functions of one variable to functions of two variables, z=f(x,y)z = f(x, y), and their graphs, which are surfaces in space. Hardy is brief, since “the remarks of §20 may all be applied, mutatis mutandis”, but the new picture needs practice: surfaces are hard to draw on flat paper, and the standard way round that, the contour map, is worth learning early. Partial derivatives (Chapter VII) are built on this picture.

The idea

zz is a function of xx and yy if a rule gives one or more values of zz for (some) pairs (x,y)(x, y). To draw it, take three mutually perpendicular axes OXOX, OYOY, OZOZ. The point (a,b,c)(a, b, c) is at signed distances aa, bb, cc from the coordinate planes YOZYOZ, ZOXZOX, XOYXOY. As (x,y)(x, y) ranges over the plane, the point (x,y,f(x,y))(x, y, f(x, y)) moves over a surface, the graph of ff: above each point of the floor, the surface is at height f(x,y)f(x, y).

A surface is hard to show on paper, but its horizontal slices are easy. Cut the surface by the plane z=cz = c: the section is the curve f(x,y)=cf(x, y) = c at height cc. Drop it onto the floor and label it (c)(c). Doing this for many values of cc gives a contour map, exactly the principle of a contoured survey map.

Explore Slice a surface, read a map

Try this. Choose the paraboloid z=x2+y2z = x^2 + y^2 and move the level cc up and down; turn and tilt the surface. Then compare the cone z=x2+y2z = \sqrt{x^2 + y^2}, the saddle 2z=3xy2z = 3xy, and the two hills.

z=x2+y2z = x^2 + y^2Hardy: §31
xyz
xy
  • the surface z = f(x, y)
  • the plane z=2z = 2, its section, and the matching contour
  • other contours, equally spaced in height
The plane z=2z = 2 cuts the surface in the curve f(x,y)=2f(x, y) = 2; seen from above, that curve is the contour marked (2)(2) on the map.
What to notice

The section by z=cz = c and the highlighted contour are the same curve, one seen in space and one from above. Equally spaced heights give contours that crowd together where the surface is steep: the paraboloid’s circles get closer together further out, the cone’s are evenly spaced. The saddle’s contours are hyperbolas, and the level c=0c = 0 is the pair of axes. On the hills, contours close round each summit, and a figure-of-eight contour marks the pass between them.

Precise statements

Definition Function of two variables; its graph Hardy: §31

zz is a function of the two variables xx and yy, written z=f(x,y)z = f(x, y), if to some pairs of values of xx and yy there correspond one or more values of zz. Its graph, or the locus of the point (x,y,z)(x, y, z), is the set of all points (x,y,z)(x, y, z) in space with zz a value of ff at (x,y)(x, y). If the relation is given by a formula, that is the equation of the locus.

Definition Level curves and contour map Hardy: Examples XIX, 5

For a number cc, the curve f(x,y)=cf(x, y) = c in the plane XOYXOY is the contour (or level curve) of height cc: the projection onto XOYXOY of the section of the surface z=f(x,y)z = f(x, y) by the plane z=cz = c. A selection of contours, each labelled by its height, is a contour map of the surface.

Theorem Planes and spheres Hardy: §31

(i) The general equation of the first degree, Ax+By+Cz+D=0Ax + By + Cz + D = 0 (with AA, BB, CC not all zero), represents a plane, and every plane has an equation of this form.

(ii) The equation x2+y2+z2+2Fx+2Gy+2Hz+C=0x^2 + y^2 + z^2 + 2Fx + 2Gy + 2Hz + C = 0 represents the sphere with centre (−F,−G,−H)(-F, -G, -H) and radius F2+G2+H2−C\sqrt{F^2 + G^2 + H^2 - C} when F2+G2+H2−C>0F^2 + G^2 + H^2 - C > 0 (a single point when it is 00, nothing when it is negative). Every sphere has an equation of this form.

Part (i) is proved in books on solid geometry; the proof is the three-dimensional version of the one for lines in §21. Part (ii) follows the circle proof step by step once we have the distance formula in space, which is where the new idea is.

Proofs

Proof Distance in space, and the sphere
Strategy

Apply Pythagoras twice: once in a horizontal plane, once in a vertical one. Then complete three squares, exactly as for the circle.

Distance from the origin

Let P=(x,y,z)P = (x, y, z) and let M=(x,y,0)M = (x, y, 0) be the foot of the perpendicular from PP to the plane XOYXOY. In that plane, OM2=x2+y2OM^2 = x^2 + y^2 (Pythagoras). The triangle OMPOMP has a right angle at MM, because MPMP is vertical and OMOM lies in the horizontal plane. So OP2=OM2+MP2=x2+y2+z2OP^2 = OM^2 + MP^2 = x^2 + y^2 + z^2.

Distance between two points

Moving the origin to (p,q,r)(p, q, r) (axes parallel to the old ones) changes coordinates to x−px - p, y−qy - q, z−rz - r, so the distance from (p,q,r)(p, q, r) to (x,y,z)(x, y, z) is (x−p)2+(y−q)2+(z−r)2\sqrt{(x - p)^2 + (y - q)^2 + (z - r)^2}.

Complete the squares

x2+y2+z2+2Fx+2Gy+2Hz+C=0x^2 + y^2 + z^2 + 2Fx + 2Gy + 2Hz + C = 0 is equivalent to (x+F)2+(y+G)2+(z+H)2=F2+G2+H2−C(x + F)^2 + (y + G)^2 + (z + H)^2 = F^2 + G^2 + H^2 - C.

Read off the locus

The left side is the squared distance from (x,y,z)(x, y, z) to (−F,−G,−H)(-F, -G, -H). If the right side is ρ2>0\rho^2 > 0, the locus is the set of points at distance ρ\rho from that centre: a sphere. If it is 00, only the centre; if negative, nothing. Conversely the sphere with centre (α,β,γ)(\alpha, \beta, \gamma) and radius ρ\rho expands to this form with F=−αF = -\alpha, G=−βG = -\beta, H=−γH = -\gamma, C=α2+β2+γ2−ρ2C = \alpha^2 + \beta^2 + \gamma^2 - \rho^2.

The same distance formula explains the shapes in the explorer. On the paraboloid, the contour of height c>0c > 0 is x2+y2=cx^2 + y^2 = c, a circle of radius c\sqrt c; on the cone it has radius cc. Equally spaced cc therefore give radii c\sqrt c, crowding outwards, for the paraboloid, and equally spaced radii for the cone.

Worked examples and exercises

Exercise ●○○ Hardy: §31

Find the centre and radius of the sphere x2+y2+z2−2x+4y−6z+5=0x^2 + y^2 + z^2 - 2x + 4y - 6z + 5 = 0, and decide what x2+y2+z2=2zx^2 + y^2 + z^2 = 2z represents.

Hint
Match with the general form: here 2F=−22F = -2, 2G=42G = 4, 2H=−62H = -6.

Solution

F=−1F = -1, G=2G = 2, H=−3H = -3, C=5C = 5: centre (1,−2,3)(1, -2, 3) and F2+G2+H2−C=1+4+9−5=9F^2 + G^2 + H^2 - C = 1 + 4 + 9 - 5 = 9, so radius 33. Check: (x−1)2+(y+2)2+(z−3)2=9(x - 1)^2 + (y + 2)^2 + (z - 3)^2 = 9.

x2+y2+z2−2z=0x^2 + y^2 + z^2 - 2z = 0 is x2+y2+(z−1)2=1x^2 + y^2 + (z - 1)^2 = 1: the sphere of radius 11 about (0,0,1)(0, 0, 1), which touches the plane XOYXOY at the origin.

Exercise Sections of the paraboloid ●○○ Hardy: §31

Describe the sections of z=x2+y2z = x^2 + y^2 by the planes z=cz = c, by the plane y=0y = 0, and by the plane y=by = b.

Hint
Substitute the equation of each plane into the equation of the surface.

Solution

z=cz = c: x2+y2=cx^2 + y^2 = c, a circle of radius c\sqrt c centred on the axis OZOZ when c>0c > 0, the single point OO when c=0c = 0, empty when c<0c < 0. y=0y = 0: z=x2z = x^2, a parabola in the plane ZOXZOX. y=by = b: z=x2+b2z = x^2 + b^2, the same parabola raised by b2b^2. So the surface is generated by a parabola, and is also a stack of circles: it is the surface of revolution of z=x2z = x^2 about OZOZ (compare §33).

Exercise ●●○ Hardy: Examples XIX, 6

Draw a series of contour lines for the surface 2z=3xy2z = 3xy, and describe its shape.

Hint
The contour of height cc is xy=23cxy = \tfrac23 c. What curve is xy=kxy = k?

Solution

The contour (c)(c) is xy=23cxy = \tfrac23c. For c>0c > 0 it is a rectangular hyperbola in the first and third quadrants, for c<0c < 0 one in the second and fourth, and for c=0c = 0 it is the pair of axes x=0x = 0, y=0y = 0. Larger ∣c∣|c| gives hyperbolas further from the axes. So the surface rises in the first and third quadrants and falls in the second and fourth: it is a saddle, like a mountain pass, with the origin as the pass point. Along the lines y=xy = x it is the upward parabola z=32x2z = \tfrac32x^2; along y=−xy = -x the downward parabola z=−32x2z = -\tfrac32x^2.

Exercise ●●○ Hardy: Misc. Examples II, 20

What is the form of the graphs of z=[x]+[y]z = [x] + [y] and z=x+y−[x]−[y]z = x + y - [x] - [y]?

Hint
On each unit square m≤x<m+1m \le x < m + 1, n≤y<n+1n \le y < n + 1 (with mm, nn integers), [x][x] and [y][y] are constant.

Solution

On the square m≤x<m+1m \le x < m + 1, n≤y<n+1n \le y < n + 1 we have z=[x]+[y]=m+nz = [x] + [y] = m + n: the graph is a horizontal unit square at height m+nm + n. The whole surface is a staircase of flat squares, rising by one step in each of the directions of OXOX and OYOY, with vertical jumps along the lines x=mx = m and y=ny = n (which, as for [x][x], belong to the step on the far side). Its “contour” at an integer height kk is a union of squares along the diagonal band m+n=km + n = k; try it in the explorer.

The second is z=(x−[x])+(y−[y])z = (x - [x]) + (y - [y]), the sum of the fractional parts. On each unit square it is the plane z=(x−m)+(y−n)z = (x - m) + (y - n), rising from 00 at the corner (m,n)(m, n) to nearly 22 at the opposite corner, then dropping back to 00 at the next square: a field of identical tilted tiles.

Exercise ●●○ Hardy: Misc. Examples II, 21

What is the form of the graphs of z=sin⁡x+sin⁡yz = \sin x + \sin y, z=sin⁡xyz = \sin xy and z=sin⁡(x2+y2)z = \sin(x^2 + y^2)?

Hint
Think about where each is 00, where it is largest, and what it does along lines or circles.

Solution

z=sin⁡x+sin⁡yz = \sin x + \sin y is periodic with period 2π2\pi in each variable: an egg-box of peaks of height 22 at (12π+2mπ,12π+2nπ)(\tfrac12\pi + 2m\pi, \tfrac12\pi + 2n\pi) and pits of depth −2-2 at (−12π+2mπ,−12π+2nπ)(-\tfrac12\pi + 2m\pi, -\tfrac12\pi + 2n\pi), separated by saddles; the contour z=0z = 0 consists of the lines y=−x+2nπy = -x + 2n\pi and y=x+(2n+1)πy = x + (2n + 1)\pi.

z=sin⁡xyz = \sin xy is constant along each hyperbola xy=kxy = k: it is 00 along the axes and the hyperbolas xy=nπxy = n\pi, with ridges (z=1z = 1) and troughs (z=−1z = -1) along the hyperbolas in between. The ripples crowd together far from the axes.

z=sin⁡(x2+y2)z = \sin(x^2 + y^2) is constant on circles about the origin, so it is a surface of revolution: circular ripples with crests at radii (2n+12)π\sqrt{(2n + \frac12)\pi}, closer and closer together as the radius grows, like waves spreading from a stone dropped at the origin, but compressed outwards.

Check yourself

Check yourself Enter a number

What is the radius of the sphere x2+y2+z2=2zx^2 + y^2 + z^2 = 2z?

Why

It is x2+y2+(z−1)2=1x^2 + y^2 + (z - 1)^2 = 1: centre (0,0,1)(0, 0, 1), radius 11. In the general form H=−1H = -1, C=0C = 0, and F2+G2+H2−C=1F^2 + G^2 + H^2 - C = 1.

Check yourself Choose one

On a contour map with equally spaced heights, where is the surface steepest?

Why

Between neighbouring contours the height changes by the same amount; covering it in a short horizontal distance means a steep slope. The paraboloid’s contours crowd outwards because it gets steeper away from the axis. Height and steepness are different things: a high plateau has widely spaced contours.

Check yourself True or false?

Every equation f(x,y,z)=0f(x, y, z) = 0 represents a surface.

Why

False. x2+y2+z2=0x^2 + y^2 + z^2 = 0 represents a single point and x2+y2+z2=−1x^2 + y^2 + z^2 = -1 nothing at all. Hardy says a single equation gives a locus that is called a surface but “may or may not satisfy our common-sense notion of what a surface should be” (§33).

Check yourself Choose one

For the saddle 2z=3xy2z = 3xy, what is the contour of height 00?

Why

xy=0xy = 0 when x=0x = 0 or y=0y = 0, so the level curve is the pair of crossing lines. It separates the rising quadrants from the falling ones, which is why the pass point of a saddle lies on a crossing contour.

Hardy’s language

Summary

Summary
  • z=f(x,y)z = f(x, y) is a function of two variables; its graph is the surface of points (x,y,f(x,y))(x, y, f(x, y)).
  • Distance in space is (x−p)2+(y−q)2+(z−r)2\sqrt{(x - p)^2 + (y - q)^2 + (z - r)^2} (Pythagoras twice); hence x2+y2+z2+2Fx+2Gy+2Hz+C=0x^2 + y^2 + z^2 + 2Fx + 2Gy + 2Hz + C = 0 is a sphere when F2+G2+H2−C>0F^2 + G^2 + H^2 - C > 0. First-degree equations are planes.
  • The section of the surface by z=cz = c, projected to the floor, is the contour f(x,y)=cf(x, y) = c. A contour map shows a surface on flat paper; close contours mean steep slopes.