Chapter 4
Functions of several variables
In this chapter we will consider real-valued functions of two or three variables. Suppose that
to every point (x, y) in some subset U of the plane, f (x, y) gives a real number. For example,
f (x, y) = x2 + y 2 . One way to visualise such a function is by considering its level sets (or level
curves). These are sets of points (x, y) such that f (x, y) = c, for some fixed constant c. The
level sets in the example given above are circles (if c > 0) or the single point {(0, 0)} (if c = 0)
or the empty set (if c < 0). A sketch showing representative examples of level sets of a function
is called a contour plot.
Another way of visualising a function of two variables is through its graph: z = f (z, y). The
graph of x2 + y 2 , i.e., z = x2 + y 2 is a paraboloid.
4.1 Sketching surfaces — see video lectures and the accompa-
nying slides
4.2 Partial derivatives
Calculus concerns the rate of change of quantities. For a function f of two variables, we can
talk about it rate of change in di↵erent directions. In particular, the rates of change of f (x, y)
in the x- and y-directions respectively are given by the partial derivatives
@f f (x + h, y) f (x, y)
= lim ,
@x h!0 h
@f f (x, y + h) f (x, y)
= lim ,
@y h!0 h
provided these limits exist. We often say “partial d” or “curly d” for “@”. Note that the symbol
“@” is NOT a delta ( ) and you should never write delta instead of “@”.
@f (x, y) @f (x, y)
fx (x, y) = and fy (x, y) = .
@x @y
4.2.1 Higher derivatives
@2f
We denote the second derivative of f with respect to x by @x2
or fxx and the second derivative
@2f
with respect to y by @y 2
or fyy . There are also the mixed derivatives: the derivative with respect
to y of the derivative of f with respect to x is denoted by
✓ ◆
@ @f @2f
= or (fx )y = fxy .
@y @x @y@x
36
CHAPTER 4. FUNCTIONS OF SEVERAL VARIABLES 37
Example 4.1 Find all first- and second-order partial derivatives of f (x, y) = sin(x2 y) + xy.
The first-order derivatives are
@f @f
= 2xy cos(x2 y) + y and = x2 cos(x2 y) + x.
@x @y
The second-order derivatives are
@2f @
2
= 2xy cos(x2 y) + y = 2y cos(x2 y) 4x2 y 2 sin(x2 y),
@x @x
@2f @
= 2xy cos(x2 y) + y = 2x cos(x2 y) 2x3 y sin(x2 y) + 1,
@y@x @y
@2f @
= x2 cos(x2 y) + x = 2x cos(x2 y) 2x3 y sin(x2 y) + 1,
@x@y @x
@2f @
2
= x2 cos(x2 y) + x = x4 sin(x2 y).
@y @y
Observe that
@2f @2f
= .
@y@x @x@y
This is true for any function f with continuous second derivatives. More generally, for sufficiently
smooth functions, changing the order of partial derivatives does not change the outcome. For
example fxxy = fxyx = fyxx .
4.3 Tangent plane and linear approximation
In this section we will find the equation of the tangent plane to the graph
z = f (x, y)
at the point (x0 , y0 , z0 ), where z0 = f (x0 , y0 ). We will start by finding two vectors parallel to the
tangent plane. Let us consider the intersection of the graph z = f (x, y) with the plane y = y0 .
This gives the curve (x, y0 , f (x, y0 )). Points in the plane y = y0 are specified by using x and z.
In the plane y = y0 , the intersection curve described above has the equation z = g(x), where
g(x) = f (x, y0 ), so at x = x0 it has slope g 0 (x0 ) = fx (x0 , y0 ). It follows that a vector tangent
to this intersection curve is v1 = i + fx (x0 , y0 )k. Similarly, by considering the intersection of
the graph z = f (x, y) with the plane x = x0 we find the tangent vector v2 = j + fy (x0 , y0 )k. A
normal to the tangent plane is given by
n = v1 ⇥ v2 = fx (x0 , y0 )i fy (x0 , y0 )j + k.
using the fact that the tangent plane contains the point P0 = (x0 , y0 , f (x0 , y0 )), we see that
P = (x, y, z) is a point in the tangent plane if and only if
0 = n · P~0 P = fx (x0 , y0 )(x x0 ) fy (x0 , y0 )(y y0 ) + 1 (z f (x0 , y0 )) .
Solving for z gives the standard form of the tangent plane:
z = f (x0 , y0 ) + fx (x0 , y0 )(x x0 ) + fy (x0 , y0 )(y y0 ). (4.1)
Note that this equation is applicable when determining the tangent plane to a surface written
as the graph z = f (x, y), NOT when it is written as a level surface: f (x, y, z) = c, for some
constant c.
As is the case for a function of a single variable, we use the tangent to give a linear approx-
imation to our function near the point of contact. Specifically, for (x, y) near (x0 , y0 ) we have
the approximation
f (x, y) ⇡ f (x0 , y0 ) + fx (x0 , y0 )(x x0 ) + fy (x0 , y0 )(y y0 ). (4.2)
CHAPTER 4. FUNCTIONS OF SEVERAL VARIABLES 38
4.4 The directional derivative and the gradient
The partial derivative of f with respect to x is formed by comparing the values of f at the point
(x, y) with the point obtained by moving h units in the positive x-direction, namely (x+h, y) and
then forming the standard di↵erence quotient before taking the limit h ! 0. We now consider
the same procedure in which we move in an arbitrary direction given by the unit vector
û = u1 i + u2 j.
The directional derivative of f in the direction û is defined to be
f (x + hu1 , y + hu2 ) f (x, y)
Dû f (x, y) = lim ,
h!0 h
provided the limit exists. If Dû f (x0 , y0 ) > 0 then f is increasing at (x0 , y0 ) in the direction û.
If Dû f (x0 , y0 ) < 0 then f is deccreasing at (x0 , y0 ) in the direction û.
The approximation (4.2) gives
f (x + hu1 , y + hu2 ) ⇡ f (x, y) + fx (x0 , y0 )hu1 + fy (x0 , y0 )hu2 ,
so we have
f (x + hu1 , y + hu2 ) f (x, y)
Dû f (x, y) = lim = u1 fx (x0 , y0 ) + u2 fy (x0 , y0 ).
h!0 h
This can be written succinctly as
Dû f (x, y) = û · rf (x, y),
where
@f @f
rf (x, y) = i+ j
@x @y
is called the gradient of f .
Let us now choose a particular di↵erentiable function f (x, y) and a particular point (x0 , y0 )
in its domain. Without changing f or (x0 , y0 ), we will see the e↵ect that varying û has on the
directional derivative Dû f (x0 , y0 ). First observe that
Dû f (x0 , y0 ) = û · rf (x0 , y0 ) = |rf (x0 , y0 )| cos ✓, (4.3)
where ✓ is the angle between û and rf (x0 , y0 ). Recall that as ✓ ranges from 0 to ⇡, cos ✓
decreases from 1 to 1. The greatest increase in f corresponds to the largest (most positive)
value of the derivative Dû f (x0 , y0 ). Since rf (x0 , y0 ) does not change, the largest rate of increase
of f corresponds to ✓ = 0, which means that û is pointing in the same direction as rf (x0 , y0 ).
Furthermore, the value of the derivative in this direction is |rf (x0 , y0 )|. This gives a very
natural interpretation of rf (x0 , y0 ): The direction of rf (x0 , y0 ) is the direction in which f (x, y)
increases most rapidly at (x0 , y0 ). The magnitude of rf (x0 , y0 ) is the rate of change of f in this
direction (i.e., |rf (x0 , y0 )| is the largest rate of change of f at (x0 , y0 )).
Continuing our analysis of equation (4.3) we see that the smallest (i.e., most negative) value
of Dû f (x0 , y0 ) occurs when ✓ = ⇡, which corresponds to the direction opposite to that of
rf (x0 , y0 ). Furthermore, we see that Dû f (x0 , y0 ) = 0 when ✓ = ⇡/2, in other words, f is as
close to being constant as possible in the directions perpendicular to rf (x0 , y0 ).
This generalises to three dimensions where we have
Dû f (x, y, z) = û · rf (x, y, z),
CHAPTER 4. FUNCTIONS OF SEVERAL VARIABLES 39
where
@f @f @f
rf (x, y, z) = i+ j+ k.
@x @y @z
Equation (4.3) still holds so we see that at (x0 , y0 , z0 ) the function f (x, y, z) increases most
rapidly in the direction of rf (x0 , y0 , z0 ) (at a rate given by |rf (x0 , y0 , z0 )|), decreases most
rapidly in the opposite direction and is stationary (approximately constant) in directions per-
pendicular to rf (x0 , y0 , z0 ). This final observation is particularly important in relation to level
surfaces given by f (x, y, z) = c, for some constant c.
Let (x0 , y0 , z0 ) be a point on the surface f (x, y, z) = c, for some constant c. Obviously we
have f (x0 , y0 , z0 ) = c. Now f must be essentially constant at (x0 , y0 , z0 ) in all directions tangent
to the surface, since f is constant on the surface. But the directions in which f is essentially
constant, that is the directions in which the directional derivative of f is zero, are all orthogonal
to rf (x0 , y0 , z0 ). Hence r(x0 , y0 , z0 ) is normal to the surface (and therefore its tangent plane)
at (x0 , y0 , z0 ). So we now have a very simple way of finding the normal vector to a surface,
which we can use to find the tangent plane.
Consider the sphere of radius 1 centred at the origin. You can probably guess a normal
vector at each point (it is either r or r, where the position vector of the point on the sphere).
Let’s check that we get the same thing using the procedure above. First we note that of we
define f (x, y, z) := x2 + y 2 + z 2 then the unit sphere is the level set f (x, y, z) = 1. Now
rf (x, y, z) = 2xi + 2yj + 2zk = 2r, so at any point (x0 , y0 , z0 ) on the unit sphere, rf (x0 , y0 , z0 )
points in the same direction as the positions vector of (x0 , y0 , z0 ).
Earlier we obtained the equation of the tangent plane to a surface that could be written as
the graph z = f (x, y). Let us revisit that example from the point of view of level sets. Now the
graph can be written in terms of the function
g(x, y, z) := f (x, y) z
as the level set g(x, y, z) = 0. Therefore a normal vector to the surface at a point (x0 , y0 , z0 ) is
given by
n = rg(x0 , y0 , z0 ) = fx (x0 , y0 )i + fy (x0 , y0 )j k.
The tangent plane is perpendicular to n and contains the point P0 = (x0 , y0 , z0 ) = (x0 , y0 , f (x0 , y0 )).
Hence, in terms of P = (x, y, z), the equation of the tangent plane is
0 = n · P~0 P = fx (x0 , y0 )(x x0 ) + fy (x0 , y0 )(y y0 ) (z f (x0 , y0 )).
Solving for z we recover equation (4.1).