Chap2 3
Chap2 3
In this chapter we will be looking at how one can di↵erentiate a function of several variables
on the domain where it is defined.
Let consider a general case. Suppose function f is defined in some neighbourhood of point x0 2
Rn , f (x) = f (x1 , x2 , ..., xn ). If we fix all variables but one, i.e. let x2 = x02 , x3 = x03 , ..., xn = x0n ,
then we obtain a function of one variable f (x1 , x02 , x03 , ..., x0n ). If this function has a derivative
at a point x0 , then this derivative is called a partial derivative of function f in x1 variable at a
point x0 , and is usually denoted as
@f 0
(x ), fx0 1 (x0 ) or fx1 (x0 ),
@x1
i.e.
@f 0 @f
(x , ..., x0n ) = (x1 , ..., x0n ) .
@x1 1 @x1 x1 =x01
A partial derivative fx1 (x0 ) defines a rate of change of function f at the point x0 in the x1
direction, and partial derivatives are evaluated following the same rules as for functions of one
variable.
15
Calculus of Several Variables (G5210) 2018-19 Lecture notes
Solution. We have
@f
fx = = yxy 1 ,
@x
and
@f
fy = = xy ln x.
@y
⌅
(x2 +y 2 )
Example: Let f (x, y) = e sin(xy 2 ). Find fx and fy .
Solution. We have
@f (x2 +y 2 ) (x2 +y 2 )
fx = = 2xe sin(xy 2 ) + y 2 e cos(xy 2 ),
@x
and
@f (x2 +y 2 ) (x2 +y 2 )
fy = = 2ye sin(xy 2 ) + 2xye cos(xy 2 ).
@y
⌅
Example: If f (x, y) = ln(xy), find an expression for fx fy in terms of f .
For a function f (x1 , ..., xn ), a symbol f called the increment of f at a point x0 denotes the
change
Example: A cylindrical tank is 1m high and 0.3m radius. If height is increased by 5cm and
radius by 1cm, what is the e↵ect on volume?
Solution. Let the radius be r and height be h. Then the volume is given by
V = ⇡r2 h,
and
@V @V
= 2⇡rh and = ⇡r2 .
@r @h
Therefore,
@V @V
V ⇡ r+ h = 2⇡rh r + ⇡r2 h.
@r @h
We have r = 0.3, h = 1, r = 1cm = 0.01m and h = 5cm = 0.05m, hence
Theorem 6 If function is di↵erentiable at a point, then there exist all its partial derivatives
at that point.
f = A1 x1 + ... + An xn + ↵1 x1 + ... + ↵n xn .
Note. The existence of partial derivates at a point does not mean that the function is di↵er-
entiable at that point. Consider an example
8
< 1, x = y 6= 0
f (x, y) =
:
0, x 6= 0, x = y = 0.
@f @f
(0, 0) = (0, 0) = 0,
@x @y
but this function is not continuous at (0, 0). Since it is not continuous at (0, 0), this means that
it is not di↵erentiable at point (0, 0).
then
dy dy du
= ,
dx du dx
where u is called the intermediate variable, and x is the independent variable. For partial
derivatives, the same chain rule can be applied, but the situation becomes more complicated as
it depends on how many intermediate and independent variables are present. Consider three
di↵erent cases.
1. Let z = f (x, y), x = x(t) and y = y(t), which means that z is ultimately a function of t, and
dz @z dx @z dy
= + .
dt @x dt @y dt
dw @w dx @w dy @w dz
= + +
dt @x dt @y dt @z dt
3. Let z = f (x, y), x = x(u, v), y = y(u, v), that is z is a function of u and v, and
@z @z @x @z @y
= + ,
@u @x @u @y @u
@z @z @x @z @y
= + .
@x @x @v @y @v
In general, we have the following theorem.
Solution.
dz @z dx @z dy
= + = (2xy)(2t) + (x2 )(3t2 ) = 7t6 .
dt @x dt @y dt
⌅
Solution. In this example, u = u(x, y), so it’s a function of two variables, and x = x(x, t),
y = y(s, t) are also functions of two variables. Therefore,
@u @u @x @u @y
= +
@s @x @s @y @s
= (2x 2y 2 )(3s2 ln t) + ( 4xy + 6y 2 )(2t2 ),
and
@u @u @x @u @y
= +
@t @x @t @y @t
✓ 3◆
2 s
= (2x 2y ) + ( 4xy + 6y 2 )(4st).
t
⌅
Example: Calculate the rate at which the area of the rectangle is changing if its length is
15m and is increasing at 3ms 1 , and its width is 6m and is increasing at 2ms 1 .
Solution. Let x denote the length of the rectangle, y denote the width of the rectangle, A be
the area, and t be time. With this notation, we are given that
dx 1 dy
= 3ms and = 2ms 1 .
dt dt
The area A = xy, and we want to find dA/dt when x = 15 and y = 6. We can apply the chain
rule to obtain
dA @A dx @A dy
= +
dt @x dt @y dt
dx dy
=y +x = (6)(3) + (15)(2)
dt dt
= 48m2 s 1 .
⌅
@f
Definition 10 If function has a partial derivative at the point M 2 Rn , that is there
✓ ◆ @x i
@ @f
exists , this derivative is called the second order partial derivative of the function
@xk @xi
f in variables xi and xk at the point M , and is denoted by
@ 2f
(M ).
@xi @xk
If i 6= k, it is called a mixed second order partial derivative.
@ 2f
• ⌘ fyx - the derivative of f taken with respect to y and then with respect to x;
@x@y
@ 2f
• ⌘ fxy - the derivative of f taken with respect to x and then with respect to y;
@y@x
@ 2f
• ⌘ fyy - the derivative of f taken twice with respect to y;
@y 2
Definition 11 The nth order derivative of the function f (x1 , x2 , ..., xn ) in xi1 , xi2 , ..., xin at
the point M is defined as
✓ ◆
@ nf @ @ n 1f
= .
@xin @xin 1 ...@xii @xin @xin 1 ...@xii
If all indexes i1 , ..., in are di↵erent, then this partial derivative is called a mixed partial
derivative of order n.
Example: Find all partial derivatives up to the second order of the function
f (x, y) = x4 y 2 x2 y 6 .
Solution. We have
fx = 4x3 y 2 2xy 6 ; fy = 2x4 y 6x2 y 5 .
Now,
fxx = 12x2 y 2 2y 6 ; fyy = 2x4 30x2 y 4
and
fxy = 8x3 y 12xy 5 ; fyx = 8x3 y 12xy 5 .
⌅
u = xy .
ux = yxy 1 ; uy = xy ln x.
and
uxy = yxy 1
ln x + xy 1 ; uyx = xy 1
+ yxy 1
ln x.
⌅
You might have noticed that in the last two examples, fxy = fyx . The obvious question to ask
ourselves now is: is this always true? Let us consider the following example.
Example: Let ⇢
xy, |y| |x|,
u(x, y) =
xy, |y| > |x|.
Find uxy (0, 0) and uyx (0, 0).
Solution. The function u is plotted in Fig. 2.1, where shaded area is where u = xy, and
u = xy everywhere else. For any y 6= 0, in the very small neighbourhood of the point (0, y),
we have u(x, y) = xy, hence, ux (x, y) = y, and ux (0, y) = y. The last equality holds even
for y = 0, i.e. ux (0, 0) = 0. Therefore, for any y we have
ux (0, y) = y.
If we di↵erentiate this again, we have
uyx (0, y) = 1, uyx (0, 0) = 1.
Similar argument leads to the conclusion that uxy = 1. This means that uxy (0, 0) 6= uyx (0, 0).
⌅
M0 , and its partial derivatives @f /@x and @f /@y are di↵erentiable in some neighbourhood of
the point M0 . Consider a di↵erential of this function in the neighbourhood of the point M0
@f @f
df = (x, y)dx + (x, y)dy.
@x @y
It is worth noting the di↵erential is a function of four variables, namely, x, y, dx, dy. In order to
introduce the second order di↵erential of the function f (x, y), we will consider df as the function
of x, y only, and take dx and dy as fixed numbers. Since @f /@x and @f /@y are di↵erentiable
at the point M0 , therefore, df is di↵erentiable at the point M0 .
Definition 12 The second order di↵erential of the function f (x, y) at the point M0 is de-
fined as the di↵erential of the first di↵erential df if the following conditions are satisfied:
• when calculating the di↵erentials of @f /@x(x, y) and @f /@y(x, y), the displacements
x and y of the variables x and y are equal to dx and dy correspondingly.
d2 f = d(df ).
Let us calculate the second order di↵erential of the function f (x, y). By definition, we have
✓ ◆
2 @f @f
d f =d dx + dy
@x @y
✓ ◆ ✓ ◆
@f @f
= d dx + d dy
@x @y
✓ ◆ ✓ ◆
@ @f @ @f
= dx + dy dx
@x @x @y @x
✓ ◆ ✓ ◆
@ @f @ @f
+ dx + dy dy
@x @y @y @y
@ 2f 2 @ 2f @ 2f
= (dx) + 2 dxdy + (dy)2 .
@x2 @x@y @y 2
Example: Let f (x, y) = xy . Calculate the second order di↵erential of the function f (x, y) at
the point M0 = (1, 0).
Solution. We start by calculating the first and second order derivatives of the function f (x, y)
as follows
fx = yxy 1 , fy = xy ln x;
and
fxx = y(y 1)xy 2 , fxy = xy 1
+ yxy 1
ln x, fyy = xy (ln x)2 .
Now using the formula for the second order di↵erential, we obtain
d2 f |M0 = fxx (M0 )dx2 + 2fxy (M0 )dxdy + fyy (M0 )dy 2
You might have noticed that the expression for the second order di↵erential resembles that
of the quadratic binomial. Indeed, it is possible to express the second order di↵erential as a
symbolic second order binomial.
An operator is a rule according to which one function can be transformed into another function.
For example, the process of finding a derivative of the function f (x, y) in x can be considered
@ @f
as an operator (denoted by ), which transforms function f (x, y) into function (x, y), so
@x @x
@ @f
that f= .
@x @x
@ @
An operator d = dx + dy is called the di↵erential operator. If one applies this operator
@x @y
@f @f
to the function f (x, y), this gives the di↵erential of the function, i.e. df = dx + dy. The
@x @y
product of the operators is defined as follows
@ @ @2
· =
@x @y @x@y
✓ ◆2
@ @ @ @2
· = =
@x @x @x @x2
✓ ◆k ✓ ◆l
@ @ @ k+l
· = ,
@x @y @xk @y l
where k, l 2 N. Now we can define the second order di↵erential operator as
✓ ◆2
2 @ @ @2 2 @2 @2
d = dx + dy = (dx) + 2 dxdy + (dy)2 .
@x @y @x2 @x@y @y 2
Using this definition, we can now write the second order di↵erential in the form
✓ ◆2
2 @ @
df= dx + dy f.
@x @y
In general, we can define the nth order di↵erential of the function f (x, y).
dn f = d(dn 1 f ), n = 2, 3, ...
@ @
d= dx1 + ... + dxn ,
@x1 @xn
and ✓ ◆n
n @ @
d f= dx1 + ... + dxn f.
@x1 @xn
In particular,
✓ ◆2 n
X
2 @ @ @ 2f
df= dx1 + ... + dxn f= dxi dxj .
@x1 @xn i,j=1
@xi @xj
Let t t0 = t = dt. Since F (k) (t0 )(t t0 )k = F (k) (t0 )(dt)k = dk F |t=t0 , if we let F (t) F (t0 ) =
F , we can rewrite the Taylor’s fomula in the form
1 n 1
F = dF |t=t0 + ... + d F |t=t0 + dn+1 F |t=t0 +✓ t . (2.1)
n! (n + 1)!
Theorem 9 If function f (x1 , ..., xm ) is (n+1) times di↵erentiable in the "-neighbourhood of the
point M0 (x01 , ..., x0m ), then for any point M (x01 + x1 , ..., x0m + xm ) from this "-neighbourhood,
f = f (M ) f (M0 ) can be expressed as follows
1 2 1 1
f = df |M0 + d f |M0 + ... + dn f |M0 + dn+1 f |N , (2.2)
2! n! (n + 1)!
where N is some point from the segment M0 M and di↵erentials dk f are calculated as
✓ ◆k
k @ @
d f= x1 + ... + xm f.
@x1 @xm
Formula (2.2) is called the Taylor’s formula for the function F (M ) expanded about the point
(M0 ).
Proof: Suppose we fix a point M (x01 + x1 , ..., x0m + xn ) from the "-neighbourhood of the
point M0 , as shown in Fig. 2.2. The equations for the segment M0 M can be expressed in the
form
Figure 2.2: A point M (x01 + x1 , ..., x0m + xm ) from the "-neighbourhood of the point M0 .
Since x1 , ..., xm are linear functions of t, the di↵erentials dk F can be calculated as follows
✓ ◆k
@ @
dk F |t=0 = x1 + ... + xm f | M0 = d k f | M0 , k = 1, 2, ..., n. (2.5)
@x1 @xm
Similarly,
✓ ◆n+1
n+1 @ @
d F |t=✓ = x1 + ... + xm f |N (x01 +✓ x1 ,...,x0m +✓ xm ) = dn+1 f |N . (2.6)
@x1 @xm
From the fact that 0 < ✓ < 1, it follows that the point N lies on the segment M0 M .
Substituting the expressions (2.5) and (2.6) into the right hand side of the expression (2.4),
and taking into account (2.3) gives us the formula (2.2) and concludes the proof of this theorem.
⌅
The Taylor’s formula can also be expressed using the derivatives of the function. For this, let
us calculate the di↵erentials dk f via the function’s derivatives, i.e.
✓ ◆k
@ @
d k f | M0 = x1 + ... + xm f | M0
@x1 @xm
m X
X m m
X @kf
= ··· (M0 ) xi1 ... xik .
i1 =1 i2 =1 ik =1
@xi1 ...@xik
In particular,
m
X @ 2f
d 2 f | M0 = (M0 ) xi xj .
i,j=1
@xi @xj
Suppose xi = xi x0i , i = 1, ..., m. Using the expression (2.2), we obtain the following Taylor’s
formula
Xn m
1 X @kf
f (x1 , ..., xm ) = f (x01 , ..., x0m ) + (x01 , ..., x0m ) xi1 ... xik + Rn+1 ,
k=1
k! i ,...,i =1
@x i 1 ...@x i k
1 k
where
1
Rn+1 = dn+1 f |N
(n + 1)!
is called the remainder.
Example: At some instant, the temperature distribution on a plate lying in the xy-plane is
2 2
given by T (x, y) = C + e (x +y ) , where C is a constant. Assuming that measurements of T
and its partial derivatives up to the second order are available at the point (2, 1), estimate the
temprerature at (x, y) = (2.1, 1.1). Compare this with the actual value from the function. How
would you estimate the temperature gradient in the x-direction at this point?
Solution. First, we need to construct the values for the ”measurements” at the point (2, 1).
We have
(x2 +y 2 )
T (x, y) = C + e , T (2, 1) = C + e 5 ;
(x2 +y 2 )
Tx = 2xe , Tx (2, 1) = 4e 5 ;
(x2 +y 2 )
Ty = 2ye , Tx (2, 1) = 2e 5 ;
(x2 +y 2 )
Txx = (4x2 2)e , Tx (2, 1) = 14e 5 ;
(x2 +y 2 )
Tyy = (4y 2 2)e , Tx (2, 1) = 2e 5 ;
(x2 +y 2 )
Txy = 4xye , Tx (2, 1) = 8e 5 .
1 5 5
+ ((0.01)14e + 2(0.01)8e + (0.01)2e 5 )
2
= C + 0.56e 5 .
Example: Find the third order Taylor expansion of the function f (x, y) = e2x sin 3y about the
point (0, 0).
Solution. In this example, we will use two di↵erent methods for calculating the Taylor expan-
sion of the function f (x, y). First, calculate all partial derivatives up to the third order at the
Using the Taylor’s formula for functions of several variables to order three about the point
(0, 0), we obtain
X 1 @ l+m f
f (x, y) = l @y m
(0, 0)xl y m + ...
0l,m3,l+m3
l!m! @x
1 1 1 1
= 3y + 6xy + 12x2 y 27y 3 + ...
1!3! 1!1! 2!1! 0!3!
9 3
= 3y + 6xy + 6x2 y y + ....
2
The second method to get the same result is to use the single variable Taylor expansions,
namely, we know that
1 2 1 3
ex = 1 + x + x + x + ...
2! 3!
1 3
sin y = y y + ....
3!
If we replace x by 2x in the first and y by 3y in the second expansions, and multiply the two
expressions keeping the terms of degree at most three, we obtain
1 1 1
= 1 + 2x + (2x)2 + (2x)3 + ... 3y (3y)3 + ...
2! 3! 3!
4 9 3
= 1 + 2x + 2x + x3 + ...
2
3y y + ...
3 2
9 3
= 3y y + 6xy + 6x2 y + ...,
2
which is exactly the same expression as the one we have calculated above. ⌅
Minima and maxima points of the function are its extrema points.
Theorem 10 (necessary condition on the existence of the local extrema) If at the point M0 (x01 , ..., x0n )
@u
the function u = f (x1 , ..., xn ) has its extrema and if a partial derivative exists at this point
@xk
M0 , then
@u
(M0 ) = 0.
@xk
Proof: Let us fix all independent variables except for xk by taking xi = x0i (i 6= k), and
consider a function of one variable f (x01 , x0k 1 , xk , x0k+1 , ..., x0m ) =: '(xk ). This function has a
local extrema at the point xk = x0k , and its derivative at the point x0k exists and is
@u
'0 (x0k ) = (M0 ).
@xk
From the theorem about the existence of the extrema for functions of one variable, it follows
that '0 (x0k ) = 0, which, in turn, means that
@u
(M0 ) = 0.
@xk
This concludes the proof. ⌅
It is worth noting that the condition du|M0 = 0 is a necessary but not sufficient condition on
the existence of the local extrema.
Suppose u = xy. This means that ux (0, 0) = 0 and uy (0, 0) = 0, so that du|(0,0) = 0. However,
this function does not have its extrema at (0, 0) since in any neighbourhood of the point (0, 0)
this function takes both positive and negative values, which means that it admits values larger
than u(0, 0) = 0 and smaller than u(0, 0).
fx (x0 , y0 ) = fy (x0 , y0 ) = 0.
f (x, y) = x2 xy + y 2 2x 2y.
Solution. In order to find critical or stationary points, we have to solve simultaneous equations
fx (x, y) = 2x y 2 = 0
fy (x, y) = x + 2y 2 = 0,
which gives (x, y) = (2, 2) as the only critical/stationary point. The Hessian at this point is
✓ ◆ ✓ ◆
fxx fxy 2 1
H= = .
fyx fyy 1 2
Since det(H) = 4 1 > 0 and fxx = 2 > 0, the critical point (2, 2) is a local minimum. ⌅
Solution. In order to find critical or stationary points, we have to solve simultaneous equations
fx (x, y) = 3y 3x2 = 0
fy (x, y) = 3x 3y 2 = 0,
which gives (x, y) = (0, 0) and (x, y) = (1, 1) as the stationary/critical points. The Hessian is
given by ✓ ◆ ✓ ◆
fxx fxy 6x 3
H= = .
fyx fyy 3 6y
At the point (0, 0), we have
✓ ◆
0 3
H= =) det(H) = 9 < 0,
3 0
Suppose that some function f (x, y) is to be analysed for stationary points subject to the con-
straint g(x, y) = 0. For the function f (x, y) to have stationary points, we require
@f @f
df = dx + dy = 0,
@x @y
@f @f
which gives rise to the condition = 0 and = 0 because dx and dy are considered as
@x @y
independent variables. But now dx and dy are not independent because they are implicitly
related via g(x, y) = 0. In other words, g(x, y) = 0 defines y = y(x) implicitly, and, therefore,
dy/dx exists.
@f @g
+ = 0.
@y @y
These two equations along with the condition g(x, y) = 0 are sufficient to determine stationary
points of interest and . The ”dummy” variable is called a Lagrange multiplier, we only really
care about the values of x and y.
Once you have found all the critical points, you plug them into f to see where the maxima and
minima are. The critical points where f is greatest are maxima, and the critical points where
f is smallest are minima.
Solving system of equations can be difficult, below are some tricks that may help:
• Since we do not actually care what is, it may be easier to first solve for in terms of
x, y and z, and eliminate it from the equatons;
• Whenever you take a square root, you must consider both positive and negative square
roots;
• Whenever you divide an equation by an expression, you must ensure that the expression
is not equal to zero.
(ii) Find all stationary points by solving the n + m simultaneous equations, namely
@
L(x) = 0, i = 1, ..., n,
@xi
(iii) Now maximise or minimise the function subject to given constraints by finding the values
of the function f at the stationary/critical points.
Example: Calculate the maximum distance from the origin to the curve 3x2 +3y 2 +4xy 2 = 0.
p
Solution. The distance from the origin to any point (x, y) is l = x2 + y 2 . We want to
maximise this distance but subject to (x, y) lying on the surface, i.e. subject to 3x2 + 3y 2 +
4xy 2 = 0. In this case it is easier to maximise l2 and not l giving the same result. The
Lagrange equations are
2x + (6x + 4y) = 0,
2y + (6y + 4x) = 0,
3x2 + 3y 2 + 4xy 2 = 0.
For thepfirst pair, we have l2 = 2/5 and for the second pair l2 = 2. Thus, the maximum distance
is l = 2. ⌅
Example: Use Lagrange multipliers to find all critical points of the function f (x, y, z) =
x + y + 2z on the surface x2 + y 2 + z 2 = 3. Determine the maxima and minima of f on this
surface.
fx = 1; fy = 1; fx = 2,
and
gx = 2x; gy = 2y; gz = 2z.
Now we have to solve simultaneous equations
1 + 2 x = 0,
1 + 2 y = 0,
2 + 2 x = 0,
x2 + y 2 + z 2 = 3.
Expressing x, y and z in terms of from the first three equations and substituting them into
the last equation, gives
1 1 1
2
+ 2 + 2 = 3,
4 4
p
which gives = ±1/ 2. Plugging these values of into the first three equations, gives two
critical points ! !
p p p p
2 2 p 2 2 p
, , 2 , , , 2 .
2 2 2 2
Since f (x, y, z) = x + y + 2z, we have
p p !
2 2 p p
f , , 2 =3 2
2 2
Example: Use Lagrange multipliers to show that f (x, y, x) = z 2 has only one critical point on
the surface x2 + y 2 z = 0. Show that the one critical point is a minimum.
Since f (x, y, x) = z 2 , f (x, y, x) 0 for all (x, y, z). At the critical point (0, 0, 0), we have
f (0, 0, 0) = 0. Thus, (0, 0, 0) is the minimum. ⌅
Solution. Unlike the previous examples, in this example, we have to find minima/maxima of
the function subject to two constraints. The Lagrange function has the form
2
L(x, y, z) = xyz + 1 (x + y2 + z2 1) + 2 (x + y + z).
In order to find critical/stationary points, we have to solve the following system of simultaneous
equations:
yz + 2 1 x + 2 = 0,
xz + 2 1 y + 2 = 0,
xy + 2 1 z + 2 = 0,
x2 + y 2 + z 2 = 1
x + y + z = 0.
If we add the first three equations, and use the last equation, we obtain
yz + xz + xy + 3 2 = 0.
(y x)(z 2 1 ) = 0.
In a similar manner, the di↵erence between the second and third equations, and the di↵erence
between third and first equations is
(z y)(x 2 1 ) = 0,
(x z)(y 2 1 ) = 0.
(y x)(z y)(x z) = 0,
which gives y = x, z = y and x = z. We will consider the case when y = x, and the other two
cases can be done similarly. If y = x, then we have the following simultaneous equations to
solve
1
yz + 2 1 y + = 0,
6
1
y2 + 2 1z + = 0,
6
2y + z = 0,
which gives
1
2y 2 + 2 1 y + = 0,
6
1
y2 4 1y + = 0,
6
z= 2y.