Multivariable CalculusThe Chain Rule and the Gradient1 of 4
The Chain Rule and the Gradient · 1
The Multivariable Chain Rule
When a function z depends on x and y, and both x and y change with time t, we need a way to find how fast z changes with t overall.
Before looking at two variables changing at once, let's see how sensitivities multiply along a single chain t→x→z.
Sensitivities along a chain
tdtdxxdxdzz⟹dtdz=dxdzdtdx
1
Two paths at once
Now suppose z depends on both x and y, and both x and y depend on t. A small change in t reaches z along two paths at the same time: one through x and one through y. Why can we find those two effects separately and simply add them, even when x and y are multiplied together inside z?
Why two paths add without interfering
For tiny steps Δx and Δy, the corner piece Δx⋅Δy is so much smaller than the two side strips yΔx and xΔy that it drops out in the limit.
As the step shrinks, the corner piece vanishes compared to the two side strips, leaving the total change as just the two strips.
2
Building the formula from the diagram
We can read the chain rule formula, and whether each derivative uses a straight d or a curly ∂, right off the arrow diagram for t→x,y→z.
Straight d, curly ∂, and building the formula
dtdz=path through x∂x∂zdtdx+path through y∂y∂zdtdy
A variable with only one arrow pointing into it gets a straight d, while a variable with two or more arrows pointing into it gets a curly ∂ to show that its other inputs are held fixed. Because the whole system starts from a single input t, the total derivative on the left is dtdz with a straight d.
3
Finding dtdz from formulas
Let's find dtdz at t=0 for
zx=x2y+3y,=sin(t),y=et
We could plug sin(t) and et into z first, but finding the four derivatives on the diagram keeps the algebra much simpler.
Finding dz/dt from formulas
Text solution
Find the four derivatives on the arrowsDifferentiate z with respect to x and y while holding the other variable constant, and differentiate x and y with respect to t.
∂x∂z∂y∂z=2xy,=x2+3,dtdxdtdy=cos(t),=et
Multiply along each path and addCombine the top path through x and the bottom path through y.
dtdz=(2xy)cos(t)+(x2+3)et
Find x and y at t=0 and plug inFind the numbers x(0) and y(0) so we can plug numbers straight into our derivative instead of plugging in the whole formulas for x(t) and y(t).
t=0⟹xy=sin(0)=0,=e0=1
dtdz=2(0)(1)cos(0)+(02+3)e0=0+(3)(1)=3
So at t=0,z is increasing at 3 units per second.
4
Finding dtdz from a table of values
Sometimes we don't have formulas for f(x,y),x(t), or y(t), and instead want to find dtdz at t=2 from measurements at that moment (where fx and fy are shorthand for ∂x∂z and ∂y∂z):
x(2)dtdxt=2=4,=−3,y(2)dtdyt=2=1,=5
(x,y)(2,2)(4,1)fx(x,y)102fy(x,y)86
Finding dz/dt from a table of values
t
x
y
z
−3
5
dtdzt=2=?
Text solution
Use the point (x,y) at t=2 to look up fx and fyBecause z=f(x,y) takes in the position (x,y) rather than the time t directly, read the table at (x(2),y(2))=(4,1), not at (2,2).
∂x∂z∂y∂z=fx(4,1)=2,=fy(4,1)=6
Multiply along each path and addMultiply each partial derivative at (4,1) by the rate of change of that coordinate at t=2.
Now suppose x and y each depend on two inputs, s and t, and we want to find ∂s∂z and ∂t∂z for
zx=exsin(y),=st2,y=s2+t
When x and y depend on two variables
s
t
x
y
z
x=st2
z=exsin(y)
y=s2+t
∂s∂z=?
∂t∂z=?
Text solution
Follow only the paths starting at sHolding t fixed leaves the two paths from s to z through x and y, with curly ∂'s on every arrow because x,y, and z each have two inputs.
∂s∂z=∂x∂z∂s∂x+∂y∂z∂s∂y
Find the partial derivatives along the s-pathsDifferentiate z with respect to x and y, and differentiate x and y with respect to s while treating t as a constant.
∂x∂z∂y∂z∂s∂x=exsin(y),=excos(y),=t2,∂s∂y=2s
Multiply along each path and addPlug the four partial derivatives into the formula.
∂s∂z=(exsiny)(t2)+(excosy)(2s)
This gives the rate of change of z as s changes with t held fixed. To find ∂t∂z, we keep the same ∂x∂z and ∂y∂z and swap in the two arrows starting from t:
∂t∂z=∂x∂z∂t∂x+∂y∂z∂t∂y
Moving along s or t alone holds the other input fixed, so only the two paths from the moving input change z.
6
When t is also inside z
What if t appears right inside the formula for z as well as inside x and y, and we want to find dtdz for
z=x2y+5t,x=t3,y=2t
When t is also inside z
x
East
y
North
z
t
x
y
z
dtdx
∂x∂z
dtdy
∂y∂z
∂t∂z
all paths from t to zdtdz=∂x∂zdtdx+∂y∂zdtdy+direct arrow t→z only∂t∂z
Text solution
Find the direct partial derivative ∂t∂zHold x and y fixed in z=x2y+5t and differentiate only the 5t term.
∂t∂z=5
Add the x and y paths to the direct pathDifferentiate along the top and bottom chains and add all three paths from t to z.
dtdz=(2xy)(3t2)+(x2)(2)+5
While ∂t∂z=5 measures only how fast z changes from the 5t term alone with x and y held fixed, dtdz combines all three ways t changes z.
7
The chain rule as a dot product
Because the dot product of two vectors multiplies their matching components and adds them, (a,b)⋅(c,d)=ac+bd, the two-path sum in the chain rule can be written as a single dot product of the surface's gradient and your velocity vector.
So your rate of climb dtdz is largest when you move straight uphill with the gradient, most negative when you move opposite the gradient, and zero when you move perpendicular to it so the x and y changes cancel out.
At any spot on the mountain, the uphill gradient stays fixed, and how fast you climb comes from how your walking direction lines up with it.
Summary
Every multivariable chain rule problem comes down to drawing the arrows from inputs to outputs: multiply along each path, and add all paths that connect your chosen input to the output.
Straight d vs. curly ∂
Count the arrows pointing into the variable (or the starting inputs for the overall derivative). One arrow means a single variable controls it, so use a straight d (like dtdx when x=sint). Two or more arrows mean other inputs are being held fixed, so use a curly ∂ (like ∂s∂x when x=st2).
One starting input (t→x,y→z)
Both paths from t to z add together, which is also the dot product of the gradient vector and the velocity vector v:
When asked for dtdz at a specific time like t=0, find the numbers x(0) and y(0) first rather than plugging the formulas for x(t) and y(t) into z. When using a table of values at t=2, look up fx and fy at the point (x(2),y(2)), not at (2,2).
Two starting inputs (s,t→x,y→z)
Hold the other input fixed and add only the paths starting from the variable you are differentiating with respect to:
∂s∂z=∂x∂z∂s∂x+∂y∂z∂s∂y
When t is already inside z directly
A t term written right inside z (like the 5t in z=x2y+5t) does not go through x or y. It gives a direct arrow t→z labeled ∂t∂z=5 that gets added alongside the x and y paths:
dtdz=∂x∂zdtdx+∂y∂zdtdy+∂t∂z
8
Practice
1
Let z=x2y+y2, where x=2t+1 and y=et. Find dtdz when t=0.
Watch out: assuming x=0 and y=0 just because t=0 gives 0.
Find the four derivatives on the t→x,y→z diagram, and find x and y at t=0 before plugging in.
Differentiating along each arrow gives ∂x∂z=2xy,dtdx=2,∂y∂z=x2+2y, and dtdy=et, so dtdz=(2xy)(2)+(x2+2y)(et). At t=0,x=2(0)+1=1 and y=e0=1 (watch out: assuming x=0 and y=0 just because t=0 gives 0). Plugging in t=0,x=1,y=1 gives dtdz=(2)(2)+(3)(1)=7.
2
Suppose z=f(x,y). At t=3,x(3)=1,y(3)=5,dtdx=4, and dtdy=−2. Using the table values fx(3,3)=7,fy(3,3)=9,fx(1,5)=3, and fy(1,5)=8, find dtdz when t=3.
Watch out: looking up (3,3) just because t=3 uses 7 and 9 and gives 10.
Which point (x,y) are you at when t=3?
At t=3,(x,y)=(1,5), so use fx(1,5)=3 and fy(1,5)=8 (watch out: looking up (3,3) just because t=3 uses 7 and 9 and gives 10). Then dtdz=fx(1,5)dtdx+fy(1,5)dtdy=(3)(4)+(8)(−2)=−4.
3
Let z=excos(y), where x=s2t and y=3s−t. Find ∂s∂z and ∂t∂z.
Find ∂x∂z and ∂y∂z once, then pair them first with the s-derivatives of x and y, and next with the t-derivatives.
The partial derivatives of z are ∂x∂z=excosy and ∂y∂z=−exsiny. With respect to s,∂s∂x=2st and ∂s∂y=3, and with respect to t,∂t∂x=s2 and ∂t∂y=−1 (watch out: forgetting the minus sign on ∂t∂y=−1 or on −siny flips the sign of the second term, giving −exsiny instead of +exsiny in ∂t∂z). Combining along the paths gives ∂s∂z=(excosy)(2st)−3exsiny and ∂t∂z=(excosy)(s2)+exsiny.
4
Let z=x2y2−4t, where x=2t and y=t2. Find both ∂t∂z and dtdz when t=1.
How many paths connect t to z, and which of those paths does ∂t∂z represent?
Holding x and y constant leaves only the direct arrow from t to z, so ∂t∂z=−4. For the total derivative dtdz, include the x path, the y path, and the direct t path (watch out: leaving off the direct −4 term at the end gives 24). At t=1,x=2 and y=1, so ∂t∂z=−4 and dtdz=(2xy2)(2)+(2x2y)(2t)−4=(4)(2)+(8)(2)−4=20.
5
On a mountain with altitude z=f(x,y), the gradient at your position is (∂x∂z,∂y∂z)=(3,−2) and your velocity vector is v=(dtdx,dtdy)=(4,5). Find dtdz.
Watch out: dropping the minus sign on −2 gives 12+10=22.
Combine the gradient vector and the velocity vector using a dot product.
Multiply matching components and add (watch out: dropping the minus sign on −2 gives 12+10=22): dtdz=(3,−2)⋅(4,5)=(3)(4)+(−2)(5)=2.
6
Suppose w depends on x,y, and z, where x and y each depend on both s and t, while z depends only on t. Write the chain rule formulas for ∂s∂w and ∂t∂w using straight d and curly ∂ in the right places.
Draw the arrows from s and t to x,y,z and into w, then count how many arrows point into each variable.
Because z does not depend on s, there is no z-path in ∂s∂w, and because only one arrow points into z (from t), its derivative is written with a straight d as dtdz (watch out: writing ∂t∂z with a curly ∂ or adding a ∂z∂w∂s∂z term are the two common mistakes). This gives ∂s∂w=(∂x∂w)(∂s∂x)+(∂y∂w)(∂s∂y) and ∂t∂w=(∂x∂w)(∂t∂x)+(∂y∂w)(∂t∂y)+(∂z∂w)(dtdz).