Multivariable CalculusThe Chain Rule and the Gradient3 of 4
The Chain Rule and the Gradient · 3
Directional Derivatives and the Gradient Vector
Partial derivatives tell us the slope of a surface when we walk due East or due North, and now we need a way to find the slope when we walk in any direction.
1
Slope in Any Direction from East and North Slopes
The directional derivative is the slope of a surface f(x,y) in the direction you choose to walk: how much your height changes per 1 unit of horizontal step. Because any smooth surface looks like a flat, tilted tangent plane when you zoom in close to your feet, you only need the East slope ∂x∂f and the North slope ∂y∂f to find the slope along any diagonal path.
Slope in Any Direction from East and North Slopes
Because slope measures the height change per 1 unit of horizontal travel, we have to test every direction with a step of length 1. If a direction is given by a vector v=⟨a,b⟩ whose length ∣v∣=a2+b2 is not 1, plugging a and b straight in would measure the height change over a step of length ∣v∣ rather than 1. We divide v by its length first to scale it to a unit vector u:
u=∣v∣v=unit direction vector (length 1)⟨a2+b2a,a2+b2b⟩
Once our step u=⟨u1,u2⟩ has length 1, walking diagonally along u on the tangent plane right under your feet gives the exact same height change as walking u1 units East and then u2 units North:
On the zoomed-in tangent plane, for every direction around the unit circle, the East height change and the North height change add together to match the surface's height change over that 1-unit step.
On the flat tangent plane, the slope along any 1-unit step is the East height change plus the North height change.
2
Finding a Directional Derivative from Partial Derivatives
Now let's find the directional derivative of a surface f(x,y) at a given point along a given vector v.
Example: Find the directional derivative of f(x,y)=x2y at the point (1,2) in the direction of the vector v=⟨2,−1⟩.
Finding a Directional Derivative from Partial Derivatives
Text solution
1. Find the East and North slopes at (1,2)Differentiate f(x,y)=x2y with respect to x and y, then plug in (1,2) to find the two basic slopes right where we stand.
∂x∂f∂y∂f=2xy=2(1)(2)=4=x2=(1)2=1
2. Divide v by its length to get a unit step uFind the length of v=⟨2,−1⟩ and divide both components by that length so our step is 1 unit long.
∣v∣u=22+(−1)2=4+1=5=∣v∣v=⟨52,−51⟩
3. Multiply each slope by its step component and addAdd the height changes from the x-step and the y-step to get the directional derivative Duf (the subscript u reminds us that the direction vector is a unit vector).
Duf=4(52)+1(−51)=58−51=57
So walking from (1,2) in the direction of ⟨2,−1⟩, the surface rises at a rate of 57 units of height per 1 unit of horizontal travel.
3
The Gradient Vector and the Dot Product Formula
The gradient vector puts a surface's partial derivatives at a point together into a single vector. It separates the calculation into two pieces: one vector for the hill's slopes at your feet, and one unit vector for the direction you choose to walk.
Remember, the dot product of two vectors multiplies their matching components and adds them up: ⟨a1,b1⟩⋅⟨a2,b2⟩=a1a2+b1b2.
The Gradient Vector and the Dot Product Formula
Putting the partial derivatives into the gradient vector turns our directional derivative calculation into a single dot product:
The upside-down triangle ∇ is called del (or nabla), so ∇f is read "the gradient of f" or "del f." Notice that ∇f is a vector of slopes, whereas the directional derivative Duf=∇f⋅u is a single number.
For a function of three variables f(x,y,z), the gradient includes the z partial derivative and takes the dot product with a 3D unit vector in the exact same way:
∇fDuf=⟨∂x∂f,∂y∂f,∂z∂f⟩,=∇f⋅u
4
Directional Derivative at a Given Angle
Sometimes a problem gives your walking direction as an angle θ from the positive x-axis instead of giving you a vector v.
Example: For the same surface f(x,y)=x2y at the point (1,2), where ∇f(1,2)=⟨4,1⟩, find the directional derivative if you walk at an angle of θ=3π(60∘) from the positive x-axis.
Directional Derivative at a Given Angle
Duf=∇f⋅u=?
(1,2)
∂x∂f=4
∂y∂f=1
θ=3π
u
x
y
(1,2)
θ=3π
u
1
cos3π=21
sin3π=23
Text solution
1. Write the unit vector u directly from the angle θ=3πA step to the unit circle at angle θ has components ⟨cosθ,sinθ⟩, which already has length 1 because cos2θ+sin2θ=1.
u=⟨cos3π,sin3π⟩=⟨21,23⟩
2. Take the dot product of the gradient at (1,2) and the unit vector uMultiply the matching components of ∇f(1,2)=⟨4,1⟩ and u, then add.
Duf=⟨4,1⟩⋅⟨21,23⟩=4(21)+1(23)=2+23
So walking from (1,2) at a 60∘ angle from the positive x-axis, the hill rises at a rate of 2+23 units of height per 1 unit of horizontal travel.
5
The Geometric Meaning of the Gradient
Drawing the gradient ∇f as an arrow on the ground at our feet tells us which direction on the hill is the steepest uphill, what that steepest slope is, and which direction is completely level.
Remember, the dot product of two vectors can also be written using the angle ϕ between them: a⋅b=∣a∣∣b∣cosϕ.
The Geometric Meaning of the Gradient
Duf=∇f⋅u
x
y
(1,2)
∇f=⟨4,1⟩
u
φ
Because the direction vector u has length ∣u∣=1, rewriting Duf=∇f⋅u in its cosine form leaves only the length of the gradient and the angle ϕ between ∇f and u:
Duf=∣∇f∣1∣u∣cosϕ=∣∇f∣cosϕ
Since cosϕ goes between −1 and 1, turning your walking direction u relative to ∇f shows three special directions at any point on the surface:
Steepest uphill (ϕ=0∘,cos0∘=1): Walking in the same direction as ∇f gives the largest possible slope, Duf=∣∇f∣.
Level ground (ϕ=90∘,cos90∘=0): Walking perpendicular to ∇f (along the level curve through the point) gives zero slope, Duf=0. In 2D, if ∇f=⟨a,b⟩, swapping the components and flipping one sign gives the two perpendicular vectors ⟨−b,a⟩ and ⟨b,−a⟩, since ⟨a,b⟩⋅⟨−b,a⟩=−ab+ab=0.
Steepest downhill (ϕ=180∘,cos180∘=−1): Walking directly opposite ∇f gives the most negative slope, Duf=−∣∇f∣.
As you turn your walking direction u around a point on the surface, the slope Duf=∣∇f∣cosϕ ranges from ∣∇f∣ straight uphill (ϕ=0∘), to 0 along the level curve (ϕ=90∘), to −∣∇f∣ straight downhill (ϕ=180∘).
At any spot on the hill, how steep your step is depends entirely on its angle with the gradient arrow.
Summary
Every directional derivative question at a point separates the surface's slopes(∇f=⟨∂x∂f,∂y∂f⟩ plugged in at the point) from your walking direction (a unit vector u of length 1), combining them with
Duf=∇f⋅u=∣∇f∣cosϕ
How you set up the calculation depends on what the problem gives you:
Direction given as a vector v=⟨a,b⟩ (divide by its length, then take the dot product)
Divide v by ∣v∣=a2+b2 to get u=∣v∣v, then calculate ∇f⋅u. For ∇f=⟨4,1⟩ and v=⟨3,4⟩, divide v by its length 5 to get u=⟨3/5,4/5⟩ and take the dot product: ⟨4,1⟩⋅⟨3/5,4/5⟩=16/5.(When not to use this: if the problem asks only for the East slope or North slope, ∂x∂f or ∂y∂f is already the answer; if a2+b2=1 already, v is already a unit vector.)
Direction given as an angle θ from the positive x-axis (unit circle, then take the dot product)
Write u=⟨cosθ,sinθ⟩ directly. It already has length 1, so do not waste time finding its length. For ∇f=⟨4,1⟩ and θ=π/3,u=⟨1/2,3/2⟩ gives Duf=4(1/2)+1(3/2)=2+3/2.
Maximum slope, angle ϕ to the gradient, or level direction (use the geometry of ∇f)
If a question asks for the maximum possible slope at a point, you do not need a direction vector u at all: just find the length of the gradient, ∣∇f∣ (for ∇f=⟨4,1⟩, the maximum slope is 42+12=17). If you walk at an angle ϕ to ∇f, use Duf=∣∇f∣cosϕ. To find the two unit directions where Duf=0, swap the components of ∇f=⟨a,b⟩, flip one sign to make ∇f⋅u=0, and divide by a2+b2.
6
Practice
1
Find the directional derivative of f(x,y)=3x2−xy2 at the point (2,1) in the direction of the vector v=⟨3,−4⟩.
Watch out: taking the dot product of ⟨11,−4⟩ directly with v=⟨3,−4⟩ gives 49, which is the height change over a 5-unit step; and missing the double negative in (−4)(−4/5) gives 17/5.
Find ∇f=⟨∂x∂f,∂y∂f⟩ at (2,1), then check the length of v=⟨3,−4⟩: how long is that step?
At (2,1), the partial derivatives are ∂x∂f=6x−y2=11 and ∂y∂f=−2xy=−4, giving ∇f(2,1)=⟨11,−4⟩.(Watch out: taking the dot product of ⟨11,−4⟩ directly with v=⟨3,−4⟩ gives 49, which is the height change over a 5-unit step; and missing the double negative in (−4)(−4/5) gives 17/5.) Divide v by its length ∣v∣=32+(−4)2=5 to get u=⟨53,−54⟩, then take the dot product:
Duf=⟨11,−4⟩⋅⟨53,−54⟩=533+516=549
Answer549
2
Find the directional derivative of f(x,y)=xe2y at the point (4,0) in the direction of the angle θ=32π from the positive x-axis.
Watch out: forgetting the chain rule factor of 2 on e2y gives ∇f(4,0)=⟨1,4⟩ and −21+23; and dropping the negative sign on cos32π=−21 gives 21+43.
Remember the chain rule on e2y when finding ∂y∂f; for the unit vector u, what are the signs of cosθ and sinθ at θ=32π in the second quadrant?
At (4,0),∂x∂f=e2y=1 and ∂y∂f=2xe2y=8, so ∇f(4,0)=⟨1,8⟩.(Watch out: forgetting the chain rule factor of 2 on e2y gives ∇f(4,0)=⟨1,4⟩ and −21+23; and dropping the negative sign on cos32π=−21 gives 21+43.) From the unit circle, u=⟨cos32π,sin32π⟩=⟨−21,23⟩, so
Duf=⟨1,8⟩⋅⟨−21,23⟩=−21+43
Answer−21+43
3
Find the directional derivative of f(x,y,z)=xy+yz2 at the point (1,−2,3) in the direction of the vector v=⟨2,1,−2⟩.
Watch out: forgetting to divide v by its length ∣v∣=3 gives 30; and losing the positive sign on (−12)(−2/3)=+8 in the dot product gives −6.
Find all three partial derivatives ⟨∂x∂f,∂y∂f,∂z∂f⟩ at (1,−2,3), and divide v by its 3D length 22+12+(−2)2.
At (1,−2,3), the partial derivatives are ∂x∂f=y=−2,∂y∂f=x+z2=10, and ∂z∂f=2yz=−12, so ∇f(1,−2,3)=⟨−2,10,−12⟩.(Watch out: forgetting to divide v by its length ∣v∣=3 gives 30; and losing the positive sign on (−12)(−2/3)=+8 in the dot product gives −6.) Since ∣v∣=4+1+4=3, the unit vector is u=⟨32,31,−32⟩, giving
Duf=⟨−2,10,−12⟩⋅⟨32,31,−32⟩=−34+310+324=10
Answer10
4
At a point on a hill f(x,y), the East slope is ∂x∂f=−6 and the North slope is ∂y∂f=8. What is the maximum possible slope at this point, and what is the slope if you walk at a 60∘ angle to the gradient vector?
How does the maximum slope relate to the vector ∇f=⟨−6,8⟩, and which formula uses the angle ϕ between your walking direction and ∇f?
The gradient vector is ∇f=⟨−6,8⟩, so the maximum possible slope is its length:
∣∇f∣=(−6)2+82=36+64=10
(Watch out: 60∘ is the angle ϕ to the gradient vector, not the angle θ from the positive x-axis. Plugging ⟨cos60∘,sin60∘⟩ into ⟨−6,8⟩⋅u gives the wrong answer −3+43.) Using the angle ϕ=60∘ to the gradient:
Duf=∣∇f∣cos60∘=10(21)=5
AnswerMaximum slope =10; slope at 60∘ to the gradient =5
5
Find the two unit vectors u at the point (3,2) on the surface f(x,y)=x2+2y2 along which the directional derivative Duf equals 0.
Watch out: dividing ⟨6,8⟩ itself by its length gives ±⟨3/5,4/5⟩, which are the steepest uphill and downhill directions rather than the level directions where Duf=0.
Find ∇f(3,2) first; what must ∇f(3,2)⋅u equal for the slope to be 0?
At (3,2),∇f(x,y)=⟨2x,4y⟩ gives ∇f(3,2)=⟨6,8⟩.(Watch out: dividing ⟨6,8⟩ itself by its length gives ±⟨3/5,4/5⟩, which are the steepest uphill and downhill directions rather than the level directions where Duf=0; and stopping at ⟨−8,6⟩ or ⟨−4,3⟩ leaves a vector whose length is not 1.) For Duf=⟨6,8⟩⋅u=0,u must be perpendicular to ⟨6,8⟩. Swapping components and flipping one sign gives ⟨−8,6⟩ and ⟨8,−6⟩, each of length (−8)2+62=10. Dividing by 10 gives the two unit vectors:
u=⟨−54,53⟩andu=⟨54,−53⟩
Answer⟨−54,53⟩ and ⟨54,−53⟩
6
At a point on a smooth hill, the East slope is ∂x∂f=5. If the directional derivative in the direction of the vector v=⟨3,4⟩ is Duf=7, what is the North slope ∂y∂f at that point?
Watch out: forgetting to divide v=⟨3,4⟩ by its length 5 sets up 5(3)+∂y∂f(4)=7, which gives the wrong answer ∂y∂f=−2.
Divide v=⟨3,4⟩ by its length to get a unit vector u first, then set up the dot product ⟨5,∂y∂f⟩⋅u=7.
Since ∣v∣=32+42=5, the unit direction vector is u=⟨53,54⟩.(Watch out: forgetting to divide v=⟨3,4⟩ by its length 5 sets up 5(3)+∂y∂f(4)=7, which gives the wrong answer ∂y∂f=−2.) Set up Duf=∇f⋅u=7 and solve for ∂y∂f: