← Chapter 4 §4.5 The Chain Rule 链式法则 · Chapter 4 · Differentiation of Functions of Several Variables

Calculus Volume 3 · Chapter 4 · Section 4.5

The Chain Rule

When z depends on x and y, and they both depend on t, z changes along every route at once. Add the routes.

Colour key path, velocity route through x route through y total rate, tangent key idea · round handles can be dragged · page links open the textbook

Level 1 · see itA rate along a pathbefore any formula

How fast is the fly warming up?

A fly crawls across a hot plate (Exercise 257). Where it is, the plate warms by 4 °C per cm to the right and 3 °C per cm upward. The fly moves right at ¼ cm/s and up at ⅓ cm/s.

2 °C/s

4 · ¼ = 1 from moving right, 3 · ⅓ = 1 from moving up. Each direction the fly moves adds its own share of the warming.

3
Isotherms every 2 °C of a plate with T=4x+3y+3T=4x+3y+3; the path x=1+tx=\sqrt{1+t}, y=2+t/3y=2+t/3.

Two routes to one rate

  1. Time moves the inputs; the inputs move the output. zz depends on tt only through xx and yy — the intermediate variables (p362).
  2. Each route is a product. (how fast zz changes with xx) × (how fast xx changes with tt), and the same through yy.
  3. Add the routes. A tree diagram lists them: one branch per route (p364).
Figure 4.34 (p365): multiply along a branch, add the branches.

One picture

Example 4.26a (p363): walk the unit circle x=sintx=\sin t, y=costy=\cos t under the bowl z=4x2+3y2z=4x^2+3y^2. Your height is z(t)=3+sin2tz(t)=3+\sin^2 t.

At t=π/4t=\pi/4: the x-route gives +4+4, the y-route gives 3-3. You climb at 11.

A rate along a path is the sum of the rates through each input.

Heights drawn at ⅓ scale. Drag to turn.
Level 2 · compute itThree chain rules and implicit slopesand three labs

One independent variable

Theorem 4.8 · p361 dzdt=zxdxdt+zydydt \frac{dz}{dt}=\frac{\partial z}{\partial x}\frac{dx}{dt}+\frac{\partial z}{\partial y}\frac{dy}{dt}

x=g(t)x=g(t), y=h(t)y=h(t). Ordinary derivatives at tt; partials at (x(t),y(t))(x(t),y(t)).

Example 4.26a · p363 dzdt=(8x)(cost)+(6y)(sint)=2sintcost \frac{dz}{dt}=(8x)(\cos t)+(6y)(-\sin t)=2\sin t\cos t

Substitute x=sintx=\sin t, y=costy=\cos t at the end. Substituting first and differentiating 4sin2t+3cos2t4\sin^2t+3\cos^2t gives the same.

zz ends up depending on tt alone, so the left side is an ordinary derivative.

Two independent variables

Theorem 4.9 · p365 zu=zxxu+zyyu,zv=zxxv+zyyv \frac{\partial z}{\partial u}=\frac{\partial z}{\partial x}\frac{\partial x}{\partial u}+\frac{\partial z}{\partial y}\frac{\partial y}{\partial u},\qquad \frac{\partial z}{\partial v}=\frac{\partial z}{\partial x}\frac{\partial x}{\partial v}+\frac{\partial z}{\partial y}\frac{\partial y}{\partial v}

x=g(u,v)x=g(u,v), y=h(u,v)y=h(u,v). For z/u\partial z/\partial u, follow only the branches that end in uu (Figure 4.35).

Example 4.27 · p366 zu=3(6x2y)+4(2x+2y)=38u+18v \frac{\partial z}{\partial u}=3(6x-2y)+4(-2x+2y)=38u+18v

z=3x22xy+y2z=3x^2-2xy+y^2, x=3u+2vx=3u+2v, y=4uvy=4u-v; likewise z/v=18u+34v\partial z/\partial v=18u+34v.

Now the left side is partial: zz still depends on the other variable, which is held fixed.

Any number of variables

Theorem 4.10 · p367 wtj=wx1x1tj+wx2x2tj++wxmxmtj \frac{\partial w}{\partial t_j}=\frac{\partial w}{\partial x_1}\frac{\partial x_1}{\partial t_j}+\frac{\partial w}{\partial x_2}\frac{\partial x_2}{\partial t_j}+\cdots+\frac{\partial w}{\partial x_m}\frac{\partial x_m}{\partial t_j}

One term per intermediate variable xix_i that depends on tjt_j.

Example 4.29 (p368): w=f(x,y,z)w=f(x,y,z) with x,y,zx,y,z each a function of t,u,vt,u,v — a tree with 9 leaves, three formulas of three terms. Count the leaves that end in your variable: that is the number of terms.

Implicit differentiation

Theorem 4.11 · p369 F(x,y)=0:dydx=FxFy(Fy0) F(x,y)=0:\qquad \frac{dy}{dx}=-\frac{F_x}{F_y}\quad (F_y\neq0) F(x,y,z)=0:zx=FxFz,zy=FyFz(Fz0) F(x,y,z)=0:\qquad \frac{\partial z}{\partial x}=-\frac{F_x}{F_z},\quad \frac{\partial z}{\partial y}=-\frac{F_y}{F_z}\quad (F_z\neq0)
Example 4.30a · p370 3x22xy+y2+4x6y11=0:dydx=3xy+2xy+3 3x^2-2xy+y^2+4x-6y-11=0:\quad \frac{dy}{dx}=\frac{3x-y+2}{x-y+3}

At (2,1)(2,1) the slope is 74\tfrac74; tangent line y=74x52y=\tfrac74x-\tfrac52.

Differentiate FF as if xx and yy were free; the minus sign and the division put the constraint back.

Examples 4.26–4.30

Examplegivenresult
4.26a · p363z=4x2+3y2z=4x^2+3y^2, x=sintx=\sin t, y=costy=\cos tdzdt=2sintcost\dfrac{dz}{dt}=2\sin t\cos t
4.26b · p364z=x2y2z=\sqrt{x^2-y^2}, x=e2tx=e^{2t}, y=ety=e^{-t}dzdt=2e6t+1ete6t1\dfrac{dz}{dt}=\dfrac{2e^{6t}+1}{e^t\sqrt{e^{6t}-1}}
4.27 · p366z=3x22xy+y2z=3x^2-2xy+y^2, x=3u+2vx=3u+2v, y=4uvy=4u-v38u+18v38u+18v;  18u+34v\ 18u+34v
4.28 · p367w=3x22xy+4z2w=3x^2-2xy+4z^2, x=eusinvx=e^u\sin v, y=eucosvy=e^u\cos v, z=euz=e^uwu=2e2u(3sin2v2sinvcosv+4)w_u=2e^{2u}(3\sin^2v-2\sin v\cos v+4)
wv=2e2u(sin2v+3sinvcosvcos2v)w_v=2e^{2u}(\sin^2v+3\sin v\cos v-\cos^2v) *
4.29 · p368w=f(x,y,z)w=f(x,y,z); x,y,zx,y,z of t,u,vt,u,v9 leaves; three sums of three products
4.30a · p3703x22xy+y2+4x6y11=03x^2-2xy+y^2+4x-6y-11=0 at (2,1)(2,1)slope 74\tfrac74; y=74x52y=\tfrac74x-\tfrac52
4.30b · p371x2eyyzex=0x^2e^y-yze^x=0zx=2xeyyzexyex\dfrac{\partial z}{\partial x}=\dfrac{2xe^y-yze^x}{ye^x},  zy=x2eyzexyex\ \dfrac{\partial z}{\partial y}=\dfrac{x^2e^y-ze^x}{ye^x}

* The book's final line for w/v\partial w/\partial v in Example 4.28 is misprinted; the line before it simplifies to the form shown.

Lab 1 · a point on a path

example
0.79

Try: play the bowl. When the blue and amber terms cancel, the path runs along a contour and z(t) is flat.

Lab 2 · the tree diagram

case

Try: Example 4.29, then each of t, u, v. Every intermediate variable that depends on your variable contributes exactly one term.

Lab 3 · slopes from a level curve

curve
Drag the point; it stays on the curve.

Try: drag to the far left or right of an ellipse. There Fy=0F_y=0: the tangent is vertical and the formula has nothing to divide by.

Common mistakes

MistakeResultFix
Only one route8xcost8x\cos t in Example 4.26aone term per branch: add (6y)(sint)(6y)(-\sin t)
Answer left in xx and yy8xcost6ysint8x\cos t-6y\sin t "in terms of tt"substitute x(t)x(t), y(t)y(t) last
dz/dudz/du with two independent variableshides that vv is held fixedz/u\partial z/\partial u
Partials evaluated at ttfx(t,t)f_x(t,t) instead of fx(x(t),y(t))f_x(x(t),y(t))partials at the point on the path
Dropping the minus in Fx/Fy-F_x/F_yslope 74-\tfrac74 at (2,1)(2,1) in Example 4.30aFF is constant: the two routes cancel
Fy/FxF_y/F_x upside downslope 47\tfrac47 instead of 74\tfrac74the variable you differentiate by is on top
Misreading the treea vv-branch in z/u\partial z/\partial ukeep only leaves labelled with your variable

Practice and answers

Exercises from p371; the book's key: p862863, p868869.

Checkpoints 4.23–4.27
#taskanswer
4.23z=x23xy+2y2z=x^2-3xy+2y^2, x=3sin2tx=3\sin2t, y=4cos2ty=4\cos2tdzdt=46sin4t72cos4t\dfrac{dz}{dt}=-46\sin4t-72\cos4t
4.24z=2xyx+3yz=\dfrac{2x-y}{x+3y}, x=e2ucos3vx=e^{2u}\cos3v, y=e2usin3vy=e^{2u}\sin3vzu=0\dfrac{\partial z}{\partial u}=0,  zv=21(3sin3v+cos3v)2\ \dfrac{\partial z}{\partial v}=\dfrac{-21}{(3\sin3v+\cos3v)^2}
4.25w=x+2y4z2xy+3zw=\dfrac{x+2y-4z}{2x-y+3z}, x=e2ucos3vx=e^{2u}\cos3v, y=e2usin3vy=e^{2u}\sin3v, z=e2uz=e^{2u}wu=0\dfrac{\partial w}{\partial u}=0,  wv=1533sin3v+6cos3v(3+2cos3vsin3v)2\ \dfrac{\partial w}{\partial v}=\dfrac{15-33\sin3v+6\cos3v}{(3+2\cos3v-\sin3v)^2}
4.26tree for w=f(x,y)w=f(x,y), x,yx,y of t,u,vt,u,v6 leaves; e.g. wt=wxxt+wyyt\dfrac{\partial w}{\partial t}=\dfrac{\partial w}{\partial x}\dfrac{\partial x}{\partial t}+\dfrac{\partial w}{\partial y}\dfrac{\partial y}{\partial t} (Lab 2)
4.27x2+xyy2+7x3y26=0x^2+xy-y^2+7x-3y-26=0 at (3,2)(3,-2)dydx=114\dfrac{dy}{dx}=-\dfrac{11}{4};  y=114x+254\ y=-\dfrac{11}{4}x+\dfrac{25}{4}
Exercises
#taskanswerkey step
215w=xycoszw=xy\cos z, x=tx=t, y=t2y=t^2, z=arcsintz=\arcsin t3t24t41t2\dfrac{3t^2-4t^4}{\sqrt{1-t^2}}cos(arcsint)=1t2\cos(\arcsin t)=\sqrt{1-t^2}
217w=5x2+2y2w=5x^2+2y^2, x=3s+tx=-3s+t, y=s4ty=s-4t94s46t94s-46t;  46s+74t\ -46s+74ttwo branches each
219f=xyf=xy, polar x,yx,y: f/r\partial f/\partial rrsin2θr\sin2\theta2rsinθcosθ2r\sin\theta\cos\theta
221f=x2+y2f=x^2+y^2, x=tx=t, y=t2y=t^22t+4t32t+4t^3both methods agree
223f=xyf=xy, x=1tx=1-\sqrt t, y=1+ty=1+\sqrt t1-1f=1tf=1-t
227w=x2+y2+z2w=x^2+y^2+z^2, x=costx=\cos t, y=sinty=\sin t, z=etz=e^t2e2t2e^{2t}w=1+e2tw=1+e^{2t}
229u=exsinyu=e^x\sin y, x=ln2tx=-\ln2t, y=πty=\pi t at x=ln2x=\ln22(π4)\sqrt2(\pi-4)t=14t=\tfrac14
231x3+y2x3=0x^3+y^2x-3=03x2+y22xy-\dfrac{3x^2+y^2}{2xy}Fx/Fy-F_x/F_y
237exy+yey=1e^{xy}+ye^y=1yexyxexy+ey(1+y)-\dfrac{ye^{xy}}{xe^{xy}+e^y(1+y)}product rule in FyF_y
243z=x/yz=x/y, x=2cosux=2\cos u, y=3sinvy=3\sin v2sinu3sinv\dfrac{-2\sin u}{3\sin v};  2cosucosv3sin2v\ \dfrac{-2\cos u\cos v}{3\sin^2v}one branch each
245z=xyex/yz=xye^{x/y}, polar, r=2r=2, θ=π/6\theta=\pi/63e3\sqrt3\,e^{\sqrt3};  (243)e3\ (2-4\sqrt3)e^{\sqrt3}(x,y)=(3,1)(x,y)=(\sqrt3,1)
251cylinder V=πx2yV=\pi x^2y, x=t/2x=t/2, y=t/3y=t/3 at x=2x=24π4\pit=4t=4
253cone: r=3r'=3, h=2h'=-2 at r=13r=13, h=18h=18 (p373)1066π31116.31\tfrac{1066\pi}{3}\approx1116.31 cm³/min468π338π3468\pi-\tfrac{338\pi}{3}
255box surface area, each side +0.5+0.5 in/min12 in²/min2(x+y+z)2(x+y+z)
257the fly2 °C/s414+3134\cdot\tfrac14+3\cdot\tfrac13
Level 3 · why it worksWhere the rules come fromshort arguments

Why the routes add

The book's proof uses differentiability (p361). Near (x0,y0)(x_0,y_0):

zz0=fxΔx+fyΔy+E,EΔx2+Δy20 z-z_0=f_x\,\Delta x+f_y\,\Delta y+E,\qquad \frac{E}{\sqrt{\Delta x^2+\Delta y^2}}\to0 zz0Δt=fxΔxΔt+fyΔyΔt+EΔx2+Δy2Δx2+Δy2Δt \frac{z-z_0}{\Delta t}=f_x\frac{\Delta x}{\Delta t}+f_y\frac{\Delta y}{\Delta t}+\frac{E}{\sqrt{\Delta x^2+\Delta y^2}}\cdot\frac{\sqrt{\Delta x^2+\Delta y^2}}{\Delta t}

As Δt0\Delta t\to0 the last product is 0×x2+y2=00\times\sqrt{x'^2+y'^2}=0. Close up, the surface is its tangent plane, and on a plane the routes add exactly.

The chain rule as a dot product

dzdt=fx, fyx(t), y(t) \frac{dz}{dt}=\langle f_x,\ f_y\rangle\cdot\langle x'(t),\ y'(t)\rangle

Example 4.26a at t=π/4t=\pi/4: 5.66, 4.240.71, 0.71=1\langle 5.66,\ 4.24\rangle\cdot\langle 0.71,\ -0.71\rangle=1. Walk along a contour and zz does not change, so the vector of partials is perpendicular to every contour — the gradient of §4.6. Tick "show ∇f" in Lab 1 and watch the angle.

Where −Fx/Fy comes from

If F(x,y(x))=0F(x,y(x))=0 for every xx, the chain rule with t=xt=x gives (p370)

Fx1+Fydydx=0dydx=FxFy. F_x\cdot1+F_y\cdot\frac{dy}{dx}=0\quad\Longrightarrow\quad \frac{dy}{dx}=-\frac{F_x}{F_y}.

With z(x,y)z(x,y) on F(x,y,z)=0F(x,y,z)=0, hold yy fixed: Fx+Fzz/x=0F_x+F_z\,\partial z/\partial x=0. The route through xx and the route through yy must cancel, because FF never moves.

Why some routes cancel

In Checkpoint 4.24, uu multiplies both xx and yy by e2ue^{2u}: the point slides along a ray from the origin. And z=2xyx+3yz=\dfrac{2x-y}{x+3y} does not change when xx and yy are scaled together, so z/u=0\partial z/\partial u=0.

Such an ff is homogeneous (p372): f(kx,ky)=knf(x,y)f(kx,ky)=k^nf(x,y). Differentiating in kk at k=1k=1 is the chain rule again:

xfx+yfy=nf x\,f_x+y\,f_y=n\,f

For n=0n=0 the two routes cancel exactly. A zero in a chain-rule answer is often a symmetry, not luck.