In Module 2 you learnt how to differentiate functions of two variables. In Module 3 we use those derivatives, and also extend them to three variables.
The chain rule in three variables. The same tree-diagram idea, now with three branches, and also with unknown functions.
Maxima and minima. Use partial derivatives to find the highest and lowest values of a function: first the local tops and bottoms, and then the absolute highest and lowest values on a closed region.
The gradient. One vector that has all the partial derivatives and points uphill.
Directional derivatives. The rate of change in any direction, not just along the axes, and the direction of steepest rise.
What you will be able to do
Apply the chain rule to w=f(x,y,z) when x,y,z depend on one or several parameters.
Prove identities for u=f(x−y,y−z,z−x) without knowing f.
Find critical points and classify them as local maxima, local minima or saddle points.
Solve optimisation problems, such as smallest surface area and lowest cost.
Find the absolute maximum and minimum of a function on a closed region.
Find ∇f at a point for two or three variables.
Find the rate of change of f in any direction, and find the direction of fastest increase.
How to use these notes
Every topic has the same shape: idea → rule → worked example → common mistakes.
Try each worked example yourself first. Cover the answer, solve it, and then compare.
Green boxes hold key ideas. Amber boxes marked Watch out show the mistakes that make you lose marks.
The last page has practice questions with answers, and then a one-page formula sheet for revision.
Where each topic sits
Part
Topics
Chain rule
Three variables, several parameters, unknown functions
Local extrema
Critical points, the second-derivative test, saddle points, optimisation
Absolute extrema
Closed regions: interior points, edges and corners
Direction
Gradient, directional derivative, steepest ascent and descent
Before you start. You should know Module 2: partial derivatives, second-order and mixed partials, and the two-variable chain rule. For the last three pages you should also be comfortable with adding vectors and finding dot products. The basics are revised where they are first used.
Page 2 of 14
The chain rule for three variables
The idea
In Module 2, a function z=f(x,y) had two paths down to its parameter. With w=f(x,y,z) there are three middle variables, so there are three paths. The rule is the same tree rule that you already know: multiply along each path, and add the paths.
Chain rule (one parameter). If w=f(x,y,z) and x=x(t), y=y(t), z=z(t), then
dtdw=∂x∂wdtdx+∂y∂wdtdy+∂z∂wdtdz
graph TD
w --> x
w --> y
w --> z
x --> t
y --> t
z --> t
For each path from w down to t, take the product of the derivatives along it: ∂x∂wdtdx, ∂y∂wdtdy, ∂z∂wdtdz. Add the three paths.
Method
Find the three partial derivatives ∂x∂w, ∂y∂w, ∂z∂w.
Find the three ordinary derivatives dtdx, dtdy, dtdz.
Multiply in pairs and then add.
Finally, put x(t),y(t),z(t), or the given value of t.
Examples
Example 1. Let w=x2y+yz3 with x=t2, y=et, z=sint. Find dtdw.
Verification. Substituting first, u=e2tcos2t+e2tsin2t+e2t=2e2t, so dtdu=4e2t. ✓
Watch out. The last step of every example is to put the values back. If you leave x, y, z in the answer when the question asks for a function of t (or a value at t=3), you will lose marks. Also, a quick check by substituting first, as in Examples 2 and 3, helps you find mistakes.
Page 3 of 14
The chain rule with several parameters
The idea
If w=f(x,y,z) and each of x,y,z depends on several parameters, say u, v and m, then w has a partial derivative with respect to each parameter.
Chain rule (several parameters). For x=x(u,v,m), y=y(u,v,m), z=z(u,v,m):
∂u∂w=∂x∂w∂u∂x+∂y∂w∂u∂y+∂z∂w∂u∂z
and the same with v, and with m, in place of u.
For each parameter: take the three paths from w down to that parameter, multiply along each path, and add.
Method
Compute the three outer partials ∂x∂w,∂y∂w,∂z∂w.
Make a table of the middle derivatives: each of x,y,z against each parameter. That gives nine entries for three parameters.
For each parameter, multiply and add down its column, like a dot product.
At the end, write x,y,z in terms of the parameters.
Example: spherical coordinates
Example 1. Let w=4x2+4y2+z2 with
x=ρsinϕcosθy=ρsinϕsinθz=ρcosϕ
Find ∂ρ∂w, ∂ϕ∂w and ∂θ∂w.
The outer partials are ∂x∂w=8x, ∂y∂w=8y, ∂z∂w=2z. The nine middle derivatives:
Check. Substituting first, 4(x2+y2)+z2=4ρ2sin2ϕ+ρ2cos2ϕ=ρ2(1+3sin2ϕ). This has no θ in it, so ∂θ∂w=0. Differentiating gives 2ρ(1+3sin2ϕ) for ρ and 6ρ2sinϕcosϕ for ϕ. ✓
Note on the source. In the first line, the handwritten page used cosθ instead of sinϕcosθ for ∂x/∂ρ, which gave a wrong answer for ∂w/∂ρ. The corrected value above is confirmed by the substitute-first check.
Watch out. With nine middle derivatives, it is easy to put one in the wrong place. A table like the one above keeps them in order. Also, look for cancellations: here every θ term cancels, which tells you immediately that w does not depend on θ.
Page 4 of 14
The chain rule with an unknown function
The idea
Sometimes u is given as f of some expressions, with no formula for f: for example u=f(x−y,y−z,z−x). You cannot differentiate f itself, but you can still find how u changes with x, y and z. The chain rule does this, and we keep ∂r∂u, ∂s∂u, ∂t∂u as unknown symbols.
Method
Give names to the inside expressions: r=…, s=…, t=…. Now u=f(r,s,t).
Compute the nine partials of r,s,t with respect to x,y,z.
Write ∂x∂u=∂r∂u∂x∂r+∂s∂u∂x∂s+∂t∂u∂x∂t, and likewise for y and z.
Combine them as the question asks. The unknown terms cancel in pairs.
Examples
Example 1. If u=f(x−y,y−z,z−x), show that ∂x∂u+∂y∂u+∂z∂u=0.
Why these are zero. In Example 1, u depends only on the differences of x,y,z. So if we increase all three by the same amount, nothing changes, and the sum of the three rates of change is 0. In Example 2, u depends only on the ratios. So if we multiply all three by the same factor, nothing changes, and we get the weighted sum xux+yuy+zuz=0.
Watch out. Keep the unknown derivatives ur,us,ut as symbols. Do not try to "find their values". Also, in Example 2 remember to multiply by x, y, zbefore adding. The cancellation works only after that.
Page 5 of 14
Local maxima and minima
The idea
A local maximum is a point where f is at least as large as at every nearby point, like the top of a hill. A local minimum is like the bottom of a valley. Together they are called local (or relative) extrema.
At the top of a smooth hill the ground is flat in every direction. So the slope in the x-direction and the slope in the y-direction are both zero.
Critical point. A point (a,b) is a critical point of f(x,y) when
fx(a,b)=0andfy(a,b)=0
Every local extremum is at a critical point. But every critical point is not an extremum, so we need a test.
The second-derivative test
Find the second derivatives at the critical point and form
D=fxxfyy−(fxy)2
(the determinant of second derivatives, often called the Hessian).
Condition at (a,b)
Conclusion
D>0 and fxx>0
local minimum
D>0 and fxx<0
local maximum
D<0
saddle point
D=0
the test fails: use another method
A saddle point is a critical point that is a maximum in one direction and a minimum in another, like the middle of a horse's saddle or a mountain pass. It is neither a top nor a bottom.
Why checking fxx alone is enough when D>0. If D>0 then fxxfyy>fxy2≥0, so fxx and fyy have the same sign. If you check one, you know both.
Method
Find fx and fy. Put both equal to 0 and solve the two equations. These give the critical points.
Find fxx, fyy, fxy.
At each critical point find D, and if D>0, find the sign of fxx.
Classify the point. For the extreme value, put the point in f.
Examples
Example 1. Find the relative extrema of f(x,y)=x2+y2−2x−6y+14.
fx=2x−2fy=2y−6
Putting both equal to zero gives x=1, y=3, so the only critical point is (1,3).
fxx=2fyy=2fxy=0⇒D=2⋅2−02=4
D=4>0 and fxx=2>0, so (1,3) is a local minimum. The minimum value is
f(1,3)=1+9−2−18+14=4
Example 2. Find the relative extrema of f(x,y)=xy−x2−y2−2x−2y+4.
fx=y−2x−2fy=x−2y−2
Solve y−2x−2=0 and x−2y−2=0. From the first, y=2x+2. Putting it in the second: x−4x−4−2=0, so x=−2 and then y=−2. The critical point is (−2,−2).
fxx=−2fyy=−2fxy=1⇒D=(−2)(−2)−12=3
D=3>0 and fxx=−2<0, so (−2,−2) is a local maximum, with value
f(−2,−2)=4−4−4+4+4+4=8
Watch out. Students make four mistakes here. (1) Forgetting the square in D=fxxfyy−(fxy)2. (2) Thinking that D>0 means "minimum". You must also check the sign of fxx. (3) Treating every critical point as an extremum. If D<0, it is a saddle point. (4) Finding the extreme value by putting the point in fx or D instead of f itself.
Page 6 of 14
Local extrema: worked examples
In each example, we find the critical points and then classify them using D. When there are many critical points, a table keeps the work neat.
Example 1. Find the critical points of f(x,y)=2xy−x3−y3 and the extreme values.
fx=2y−3x2fy=2x−3y2
From fx=0, y=23x2. Put this in fy=0:
2x−3(23x2)2=2x−427x4=x(2−427x3)=0
So x=0 or x3=278, that is x=32. The critical points are (0,0) and (32,32).
fxx=−6xfyy=−6yfxy=2
Point
fxx
fyy
fxy
D
Result
(0,0)
0
0
2
−4
saddle point
(32,32)
−4
−4
2
12
local maximum
Maximum value:
f(32,32)=98−278−278=2724−8−8=278
Example 2. Find the extreme values of f(x,y)=3x2−2xy+y2−8y.
fx=6x−2yfy=−2x+2y−8
Adding fx=0 and fy=0 gives 4x−8=0, so x=2. Then 6(2)−2y=0 gives y=6. The critical point is (2,6).
fxx=6fyy=2fxy=−2⇒D=12−4=8>0,fxx>0
So (2,6) is a local minimum, with value
f(2,6)=12−24+36−48=−24
Example 3. Find the extreme values of f(x,y)=x3+3xy2−15x2−15y2+72x.
fx=3x2+3y2−30x+72fy=6xy−30y=6y(x−5)
fy=0 gives two cases: y=0 or x=5.
Case y=0. Then fx=3(x2−10x+24)=3(x−4)(x−6)=0, so x=4 or x=6. Points: (4,0) and (6,0).
Case x=5. Then fx=75+3y2−150+72=3y2−3=0, so y=±1. Points: (5,1) and (5,−1).
With fxx=6x−30, fyy=6x−30, fxy=6y:
Point
fxx
fyy
fxy
D
Result
(5,1)
0
0
6
−36
saddle point
(5,−1)
0
0
−6
−36
saddle point
(6,0)
6
6
0
36
local minimum
(4,0)
−6
−6
0
36
local maximum
Values: f(6,0)=216−540+432=108 is the local minimum, and f(4,0)=64−240+288=112 is the local maximum.
Example 4. Find the extreme values of f(x,y)=4xy−x4−y4.
fx=4y−4x3fy=4x−4y3
fx=0 gives y=x3. Substituting into fy=0: 4x−4x9=4x(1−x8)=0, so x=0 or x=±1. The critical points are (0,0), (1,1), (−1,−1).
fxx=−12x2fyy=−12y2fxy=4
Point
fxx
fyy
fxy
D
Result
(0,0)
0
0
4
−16
saddle point
(1,1)
−12
−12
4
128
local maximum
(−1,−1)
−12
−12
4
128
local maximum
Both maxima have value f(1,1)=f(−1,−1)=4−1−1=2.
Solving the equations fx=fy=0. This is usually the difficult part. Three methods cover almost every question: (1) solve one equation for one variable and put it in the other equation (Examples 1 and 4); (2) add or subtract the equations to remove a variable (Example 2); (3) if one equation can be factorised, make separate cases (Example 3). Always check that you have found every case. Missing a critical point is the most common reason for losing marks.
Page 7 of 14
Extrema with a parameter
The idea
When the function has a constant like a, the critical points and their type depend on a. Keep a in the whole working, and at the end let the sign of a decide between a maximum and a minimum.
Examples
Example 1. Discuss the maxima and minima of f(x,y)=xy(a−x−y), where a=0.
Expand: f=axy−x2y−xy2.
fx=ay−2xy−y2=y(a−2x−y)fy=ax−x2−2xy=x(a−x−2y)
fx=0 gives y=0 or a−2x−y=0. fy=0 gives x=0 or a−x−2y=0. Combining the cases:
y=0 and x=0: the point (0,0).
y=0 and a−x−2y=0: x=a, the point (a,0).
x=0 and a−2x−y=0: y=a, the point (0,a).
a−2x−y=0 and a−x−2y=0: subtracting gives x=y, then 3x=a, the point (3a,3a).
The second derivatives are
fxx=−2yfyy=−2xfxy=a−2x−2y
Point
fxx
fyy
fxy
D
(0,0)
0
0
a
−a2
(a,0)
0
−2a
−a
−a2
(0,a)
−2a
0
−a
−a2
(3a,3a)
−32a
−32a
−3a
3a2
The first three have D=−a2<0, so they are saddle points.
At (3a,3a) we have D=3a2>0, and the sign of fxx=−32a depends on a:
If a>0: fxx<0, a local maximum.
If a<0: fxx>0, a local minimum.
The value there is f(3a,3a)=3a⋅3a⋅3a=27a3.
Example 2. Find the maxima and minima of f(x,y)=x3+y3−3axy, where a=0.
fx=3x2−3ayfy=3y2−3ax
fx=0 gives y=ax2. Substituting into fy=0:
a23x4−3ax=a23x(x3−a3)=0
So x=0 or x=a, giving the critical points (0,0) and (a,a).
fxx=6xfyy=6yfxy=−3a
Point
fxx
fyy
fxy
D
Result
(0,0)
0
0
−3a
−9a2
saddle point
(a,a)
6a
6a
−3a
27a2
see below
At (a,a), D=36a2−9a2=27a2>0, and fxx=6a:
If a>0: fxx>0, a local minimum.
If a<0: fxx<0, a local maximum.
In both cases the value is
f(a,a)=a3+a3−3a⋅a⋅a=−a3
Note on the source. The handwritten page gave the value as a3. The correct value is 2a3−3a3=−a3. For a=1, f(1,1)=1+1−3=−1.
Watch out. Do not assume a>0. Write both cases (or clearly say "for a>0"). Remember that D has a2, which is always positive, so it is the sign of fxx that depends on a.
Page 8 of 14
Optimisation problems
The idea
Many real questions ask for the smallest cost, the least material or the largest volume. The second-derivative test solves them once the quantity is written as a function of two variables.
Method
Write the quantity to be optimised (the objective), and name the variables.
Use the given condition (a fixed volume, a budget) to remove variables until the objective depends on two variables.
Find the critical points and classify them using D.
Check that the answer makes sense: dimensions must be positive, and quantities must be in the allowed range.
Examples
Example 1. Open box. A rectangular box, open at the top, has volume 32ft3. Find its dimensions if the total surface area is least.
Let x = length, y = breadth, z = height. The volume gives xyz=32, so z=xy32. The surface area is a base plus four sides (no lid):
S=xy+2yz+2xz=xy+x64+y64
(since 2yz=x64 and 2xz=y64).
Sx=y−x264Sy=x−y264
Sx=0 gives x2y=64 and Sy=0 gives xy2=64. Subtracting, xy(x−y)=0. Since x,y>0, we get x=y, so x3=64 and
So the surface area is a minimum at x=4, y=4, z=2. The dimensions are 4×4×2 feet, and the least surface area is 16+16+16=48ft2.
Example 2. Cost of two products. A manufacturer makes x units of product A and y units of product B at a cost
C(x,y)=x2+y2+4xy+10x+8y+50
Find and classify the critical points to decide the minimum cost.
Cx=2x+4y+10Cy=2y+4x+8
Putting both equal to 0: from Cy=0, y=−2x−4. Putting this in Cx=0: 2x−8x−16+10=0, so x=−1 and y=−2. The critical point is (−1,−2).
Cxx=2Cyy=2Cxy=4⇒D=4−16=−12<0
D<0, so (−1,−2) is a saddle point: the cost has no local minimum there.
In real life x,y≥0, and the critical point (with negative quantities) is not even in the allowed region. For x,y≥0 every term of C is non-negative, so the smallest cost is C(0,0)=50, on the boundary. We study boundary cases like this on the next page.
Watch out. Always check that the critical point is valid for the problem. Lengths and quantities cannot be negative. Also, a saddle point means "no optimum here". It does not mean "answer is 0".
Page 9 of 14
Absolute maxima and minima
The idea
The absolute maximum (or minimum) of f on a region is the largest (smallest) value it takes anywhere in that region. It is different from a local extremum. A local maximum is only the highest point nearby.
Key idea. A continuous function on a closed, bounded region (one that includes its edges, such as a filled triangle or rectangle) always has an absolute maximum and an absolute minimum. They come either at a critical point inside the region, or on the boundary.
So we must check both places.
Method
Inside. Find the critical points (fx=fy=0) and keep only those that are inside or on the region.
Edges. On each edge, put the equation of the edge in f. This gives a function of one variable. Find where its derivative is 0.
Corners. Take every corner of the region.
Compare. Find f at all these points. The largest value is the absolute maximum and the smallest value is the absolute minimum.
You do not need the second-derivative test here. You just compare the values.
Examples
Example 1. Find the absolute extrema of f(x,y)=xy−4x on the triangle R with vertices (0,0), (4,0), (0,4).
Interior.fx=2x−2y, fy=−2x+2. fy=0 gives x=1, then fx=0 gives y=1. The point (1,1) lies inside D, and f(1,1)=1−2+2=1.
Edges:
OA (y=0): f=x2, increasing, so no critical point.
AB (x=3): f=9−6y+2y=9−4y, derivative −4=0, so none.
BC (y=2): f=x2−4x+4=(x−2)2, derivative 2x−4=0 at x=2. The point is (2,2).
OC (x=0): f=2y, derivative 2=0, so none.
Candidates:
Point
f
(1,1)
1
(2,2)
0
(0,0)
0
(3,0)
9
(0,2)
4
(3,2)
1
The absolute maximum is 9 at (3,0). The absolute minimum is 0, at (0,0) and (2,2).
Note on the source. The handwritten table had f(1,1)=−1. The correct value is 1−2+2=1. The conclusions do not change, because 1 lies between the extreme values.
Watch out. Do not forget the corners. This is where the one-variable search on the edges ends, and the corners are often the answer (as with (3,0) above). Also, reject any critical point that lies outside the region.
Page 10 of 14
Absolute extrema: more examples
The method is always the same: points inside, then each edge as a one-variable problem, then the corners, and then compare.
Edges made easy. On a horizontal edge y=c or a vertical edge x=c, just put the constant. On a slanting edge, use its equation (such as y=2−2x) to remove one variable.
Example 1. Find the absolute extrema of f(x,y)=x2−3y2−2x+6y on the square with vertices (0,0), (0,2), (2,2), (2,0).
Interior.fx=2x, fy=2y: the only critical point is (0,0), a corner.
Edge OA (y=0): f=x2, increasing. Edge OB (x=0): f=y2, increasing. No critical points.
Edge AB (y=2−2x):
f=x2+(2−2x)2=5x2−8x+4f′=10x−8=0⇒x=54,y=52
Point
f
(0,0)
0
(1,0)
1
(0,2)
4
(54,52)
2516+254=54
The absolute maximum is 4 at (0,2). The absolute minimum is 0 at (0,0).
Note on the source. The handwritten conclusion said the maximum 4 is at both (0,2)and(54,52). But f(54,52)=54, not 4, so the maximum is at (0,2) only. (The point (54,52) is the point of that edge that is closest to the origin.)
Example 3. Find the absolute extrema of f(x,y)=x2−xy+y2+1 on the closed triangular plate in the first quadrant bounded by x=0, y=4 and y=x.
Interior.fx=4x−4 and fy=2y−4 give (1,2), which is the corner A.
Edges:
OB (x=0): f=y2−4y+1, derivative 2y−4=0 at y=2, the corner B.
BA (y=2): f=2x2−4x−3, derivative 4x−4=0 at x=1, the corner A.
OA (y=2x): f=6x2−12x+1, derivative 12x−12=0 at x=1, again the corner A.
Every critical point on the edges is a corner, so only the corners matter:
Point
f
(0,0)
1
(0,2)
−3
(1,2)
−5
The absolute maximum is 1 at (0,0). The absolute minimum is −5 at (1,2).
Watch out. When a critical point comes on a corner (as in Examples 2 to 4), it is not a separate extra point. It is just that corner. Find f at every corner, whether or not a critical point was found there.
Page 11 of 14
The gradient
The idea
For a function f(x,y) there are two partial derivatives, fx and fy. The gradient puts them together in a single vector:
∇f=∂x∂f^+∂y∂f^=(fx,fy)
The symbol ∇ is read "del". In three variables there is a third component:
∇f=∂x∂f^+∂y∂f^+∂z∂fk^=(fx,fy,fz)
Here ^,^,k^ are the unit vectors along the x, y, z axes.
Meaning. At each point, ∇f is a vector that points in the direction in which f increases fastest, and its length tells how fast. It is also perpendicular to the level curve of f through that point.
Method
Differentiate f with respect to each variable (partial derivatives, as in Module 2).
Write the results as a vector.
If a point is given, then put it in each component.
Examples
Example 1.f(x,y)=y−x at (2,1).
∇f=(−1,1)⇒∇f(2,1)=−^+^
Example 2.f(x,y)=ln(x2+y2) at (1,1).
∇f=(x2+y22x,x2+y22y)⇒∇f(1,1)=(22,22)=^+^
Example 3.f(x,y)=2x+3y at (−1,2).
∇f=(22x+3y2,22x+3y3)=(2x+3y1,22x+3y3)
At (−1,2): 2x+3y=−2+6=4 and 4=2, so
∇f(−1,2)=21^+43^
Example 4.f(x,y)=tan−1yx at (4,−2).
Use dudtan−1u=1+u21 with u=yx, so 1+u2=y2y2+x:
Watch out. The gradient is a vector. Write it as a^+b^ (or as (a,b)), not as a single number. Put the point after differentiating. Also, do not forget the chain-rule factors (the 2 and 3 inside the root in Example 3).
Page 12 of 14
Directional derivatives
The idea
fx and fy give the rate of change of f when you move along the x-axis or the y-axis. The directional derivative gives the rate of change when you move in any direction.
Directional derivative. The rate of change of f at a point in the direction of the unit vector u^ is
Du^f=∇f⋅u^
For u^=(u1,u2) this is fxu1+fyu2, and in three variables fxu1+fyu2+fzu3.
The sign has the usual meaning: positive means f is increasing in that direction, and negative means it is decreasing.
Vectors you need
Dot product. For a=(a1,a2,a3) and b=(b1,b2,b3): a⋅b=a1b1+a2b2+a3b3.
Vector between points. The vector from P to Q is PQ=Q−P. For P(1,2,3) and Q(3,4,5): PQ=(2,2,2).
Length.∣r∣=x2+y2+z2 for r=(x,y,z).
Unit vector.a^=∣a∣a has length 1 and the same direction as a.
Method
Find ∇f and find its value at the point.
If the direction is given as a vector v (or as "towards a point Q", so v=PQ), change it into a unit vectoru^=v/∣v∣.
Take the dot product ∇f⋅u^.
The most common mistake. The direction vector must be a unit vector. If you are given (1,1) or (2,3), first divide by its length. The formula ∇f⋅u^ is correct only for a vector of length 1.
Examples
Example 1.f(x,y)=x2+y2 at (1,1), in the direction u^=(21,21).
This u^ already has length 1. ∇f=(2x,2y), so ∇f(1,1)=(2,2):
Du^f=2⋅21+2⋅21=2+2=22
Example 2.f(x,y)=x3−3xy+y3 at (1,2), in the direction of v=(2,3).
∇f=(3x2−3y,3y2−3x), so ∇f(1,2)=(3−6,12−3)=(−3,9). The length is ∣v∣=4+9=13, so u^=13(2,3):
Du^f=13(−3)(2)+(9)(3)=13−6+27=1321
Example 3.f(x,y)=x2y+3xy2 at (1,2), in the direction of v=(1,1).
∇f=(2xy+3y2,x2+6xy), so ∇f(1,2)=(4+12,1+12)=(16,13). The vector (1,1) has length 2, so u^=(21,21):
Du^f=216+13=229≈20.5
Note on the source. The handwritten page took the dot product with (1,1) directly and wrote 29. That vector is not a unit vector, so 29 is 2 times too large. The correct answer is 229.
Example 4.f(x,y)=exsiny at (0,2π), in the direction of the unit vector (0,1).
∇f=(exsiny,excosy), so ∇f(0,2π)=(1,0):
Du^f=(1)(0)+(0)(1)=0
In the y-direction the function is flat at that point.
Example 5. A hill. The height of a hill is h(x,y)=100−0.01x2−0.02y2. A hiker at (50,40) looks towards the point (60,50). How steep is the hill in that direction?
∇h=(−0.02x,−0.04y)⇒∇h(50,40)=(−1,−1.6)
The direction of travel is PQ=(60−50,50−40)=(10,10), with length 102, so u^=(21,21):
Du^h=2−1−1.6=−22.6≈−1.84
The negative sign means the ground is going down in that direction, by about 1.84 units of height for each unit of horizontal distance.
Watch out. (1) Make the direction a unit vector. (2) Find ∇fat the given point before taking the dot product. (3) For "towards a point Q", the direction is Q−P, not P−Q.
Page 13 of 14
Steepest ascent and descent
The idea
At a point, the directional derivative depends on which way you go. Which direction gives the largest value, and what is that value? The dot product gives the answer. For the angle α between ∇f and u^:
Du^f=∇f⋅u^=∣∇f∣∣u^∣cosα=∣∇f∣cosα
This is largest when cosα=1 (the directions are the same) and smallest when cosα=−1 (opposite directions).
Properties of the gradient. At a point where ∇f=0:
Fastest increase is in the direction of ∇f, and the rate is ∣∇f∣, the maximum value of the directional derivative.
Fastest decrease is in the direction of −∇f, and the rate is −∣∇f∣.
In a direction perpendicular to ∇f the rate of change is 0 (you are moving along a level curve).
For a hill, ∇h points straight up the slope, and −∇h points in the direction in which water would flow down.
Method
Find ∇f at the point.
Maximum rate: ∣∇f∣=fx2+fy2. Direction of fastest increase: ∣∇f∣∇f.
Direction of fastest decrease: −∣∇f∣∇f.
Examples
Example 1. For f(x,y)=x2−3xy+y2 at (1,−1), find the maximum rate of change, the direction of fastest increase and of fastest decrease, and the directional derivative in the direction ^−^.
Fastest increase: the direction of ∇f, that is u^=2(1,−1).
Fastest decrease: the direction of −∇f=(−5,5), that is 2(−1,1).
For the direction ^−^, the unit vector is u^=2(1,−1), which is exactly the direction of ∇f. So
Du^f=(5,−5)⋅2(1,−1)=25+5=210=52
This is equal to ∣∇f∣, as it should be when we move in the direction of the gradient.
Example 2. Find the directional derivative of f(x,y)=xey+cos(xy) at (2,0) in the direction of v=3^−4^.
∇f=(ey−ysin(xy),xey−xsin(xy))
At (2,0): ∇f=(1−0,2−0)=(1,2).
The length of v is 9+16=5, so u^=5(3,−4):
Du^f=5(1)(3)+(2)(−4)=5−5=−1
So f is decreasing at rate 1 in that direction. This is less than ∣∇f∣=5, the largest possible rate at this point, as it should be.
Watch out. "Direction of fastest increase" means the unit vector∇f/∣∇f∣ (or simply the direction of ∇f). "Maximum rate" means the number∣∇f∣. These are different answers to different questions. Give the one that is asked.
Page 14 of 14
Practice questions and formula sheet
Practice questions
Try these without looking at the answers. The answers are given below.
A. Chain rule
Find dtdw for w=xy+yz+zx with x=t, y=t2, z=t3.
If u=f(x2−y2,y2−z2,z2−x2), show that x1∂x∂u+y1∂y∂u+z1∂z∂u=0.
B. Local extrema
Find and classify the critical points of f(x,y)=x2+xy+y2−3x−6y.
Find and classify the critical points of f(x,y)=x3−3x+y2.
Three positive numbers add up to 30. Find the largest possible product.
C. Absolute extrema
Find the absolute extrema of f(x,y)=x2+y2−2x−4y on the square 0≤x≤3, 0≤y≤3.
Find the absolute extrema of f(x,y)=xy on the triangle with vertices (0,0), (2,0), (0,2).
D. Gradient and directional derivatives
Find ∇f at (2,1) for f(x,y)=x2y−y3.
Find the directional derivative of f(x,y)=x2−xy+y2 at (1,1) in the direction towards the point (4,5).
Find the directional derivative of g(x,y,z)=xyz at (1,1,2) in the direction of v=(1,2,2).
For f(x,y)=excosy at (0,4π), find the greatest rate of increase and the direction in which it occurs.
Answers
dtdw=3t2+4t3+5t4. (Check: w=t3+t4+t5.)
With r=x2−y2, s=y2−z2, t=z2−x2: ux=2x(ur−ut), uy=2y(−ur+us), uz=2z(−us+ut). Dividing by x,y,z and adding gives 2[(ur−ut)+(−ur+us)+(−us+ut)]=0.
fx=2x+y−3, fy=x+2y−6 give the point (0,3). D=2⋅2−1=3>0, fxx=2>0: local minimum, value f(0,3)=9−18=−9.
fx=3x2−3=0 gives x=±1, and fy=2y=0 gives y=0. D=fxxfyy=6x⋅2=12x. At (1,0): D=12>0, fxx=6>0: local minimum, value −2. At (−1,0): D=−12<0: saddle point.
Maximise xyz with z=30−x−y, that is f=xy(30−x−y). This is Example 1 on the parameter page with a=30: the maximum is at x=y=z=10, with product 27a3=1000.
Interior critical point (1,2), f=1+4−2−8=−5. Edges: y=0 gives x2−2x, point (1,0), f=−1; x=3 gives y2−4y+3, point (3,2), f=−1; y=3 gives x2−2x−3, point (1,3), f=−4; x=0 gives y2−4y, point (0,2), f=−4. Corners: f(0,0)=0, f(3,0)=3, f(3,3)=0, f(0,3)=−3. Absolute maximum 3 at (3,0); absolute minimum −5 at (1,2).
fx=y, fy=x: critical point (0,0) (a corner). On the axes f=0. On x+y=2: f=x(2−x), maximum at x=1, point (1,1), value 1. Absolute maximum 1 at (1,1); absolute minimum 0 (at (0,0) and all along both axes).
∇f=(2xy,x2−3y2), so ∇f(2,1)=(4,1)=4^+^.
∇f=(2x−y,2y−x)=(1,1) at (1,1). The direction is (4−1,5−1)=(3,4), length 5, so u^=(53,54). Du^f=53+4=57.
∇g=(yz,xz,xy)=(2,2,1) at (1,1,2). ∣v∣=1+4+4=3. Du^g=32⋅1+2⋅2+1⋅2=38.
∇f=(excosy,−exsiny)=(22,−22) at (0,4π). The greatest rate is ∣∇f∣=21+21=1, in the direction 21(1,−1).
Study tip. For absolute extrema (6 and 7), write the points in a table as you go. It is easy to forget a corner when the working is spread over many edges.
Formula sheet
Chain rule
Situation
Formula
w=f(x,y,z), all depend on t
dtdw=wxdtdx+wydtdy+wzdtdz
x,y,z depend on u,v,m
∂u∂w=wx∂u∂x+wy∂u∂y+wz∂u∂z, same for v, m
Unknown f(r,s,t)
name r,s,t; chain rule; the unknowns cancel
Tree rule
multiply along each path, add the paths
Local extrema
Critical point
fx=0 and fy=0
Hessian
D=fxxfyy−(fxy)2
D>0, fxx>0
local minimum
D>0, fxx<0
local maximum
D<0
saddle point
D=0
test fails
Optimisation
eliminate variables with the constraint, then find and classify critical points
Absolute extrema on a closed region
Critical points inside the region.
Each edge: put its equation, and find where the one-variable derivative is 0.
All corners.
Comparef at every point: the largest is the maximum and the smallest is the minimum.