The Multivariable Chain Rule
Differentiate a composition when several inputs each depend on other variables, by summing one contribution per path through the dependency diagram.
What a learner can do afterwards
- Draw the dependency diagram, identify its derivative products and check the chain rule's differentiability assumptions
- Differentiate z = f(x, y) with x and y both functions of t
- Handle two intermediate variables and two independent ones
1 · Read
The tangent plane adds first-order changes from x and y. Suppose f is differentiable at (x(t),y(t)) and both inputs are differentiable at t. Write f_x=∂f/∂x and f_y=∂f/∂y. For z=f(x,y), dz/dt=f_x dx/dt+f_y dy/dt. Evaluate outer partials at the input pair. Draw z above x,y, then t below; link z to both intermediates and each to t. Existing partials alone do not establish differentiability.
For z=x²+3y², the outer partials are 2x and 6y. Set x=2t and y=t. The inner derivatives are 2 and 1, so dz/dt=2x(2)+6y(1)=14t. At t=2 the rate is 28. Substitution checks this: z=7t². For z=Ax+By, use A dx/dt+B dy/dt. For z=xy, the outer partials are y and x, giving y dx/dt+x dy/dt.
For differentiable f,x,y with independent inputs s,t, use partial derivatives. Hold t fixed to find ∂z/∂s=f_x ∂x/∂s+f_y ∂y/∂s. Hold s fixed to find ∂z/∂t=f_x ∂x/∂t+f_y ∂y/∂t. Evaluate outer partials at (x(s,t),y(s,t)) and inner partials at (s,t). For example, ∂(st)/∂s=t and ∂(s+t)/∂s=1. Keep each intermediate paired with its own outer partial.
Use input values when evaluating f_x and f_y, not the pair of inner derivatives. Supplied local rates are enough to calculate the output rate. If f_x=3, f_y=-2, dx/dt=4 and dy/dt=1 at the same moment and position, then dz/dt=3(4)+(-2)(1)=10. Full formulas for f,x,y are unnecessary when these derivative values are known.
You can solve the chain-rule equation for an unknown inner rate. If f_y≠0, then ∂y/∂s=(∂z/∂s-f_x ∂x/∂s)/f_y. First subtract the known contribution, then divide by f_y. For example, f_x=2, f_y=3, ∂x/∂s=3 and ∂z/∂s=12 give 12=6+3 ∂y/∂s, so ∂y/∂s=2.
Use radians: (cos t)'=-sin t and (sin t)'=cos t. For z=x²+y², x=2cos t and y=2sin t, the two contributions are -8cos t sin t and 8sin t cos t. They cancel, giving dz/dt=0. Contributions can cancel even when neither is zero. A zero factor removes only its own term: for z=x+y, dx/dt=0 and dy/dt=2 give dz/dt=2.
The vector form uses ∇f=(f_x,f_y) and r'=(dx/dt,dy/dt). Their dot product is f_x dx/dt+f_y dy/dt, so dz/dt=∇f·r'. If f is temperature in °C, x,y are distances in cm and t is seconds, each product has units (°C/cm)(cm/s)=°C/s. Both contributions must have matching units before you add them.
Check differentiability, multiply along each path and add. Evaluate outer partials at the input values. With two independent inputs, hold the other input fixed.
The lesson, questions, worked solutions and flashcards were written for this learning dataset.
The readings, practice questions and flashcards were written for this learning dataset. Linked videos: Khan Academy, via YouTube.
More to read
Combine the input rates
At a differentiable point of a surface, a small input change produces the first-order change f_x Δx+f_y Δy. When both inputs follow a differentiable path, the corresponding time derivative is dz/dt=f_x dx/dt+f_y dy/dt.
Evaluate f_x and f_y at the position reached by the path. The input pair tells you where on the surface to measure its slopes. The derivatives dx/dt and dy/dt tell you how fast the inputs change. They multiply the slopes; they do not replace the position coordinates.
For example, suppose f_x=-2, f_y=6, dx/dt=3 and dy/dt=1 at a moment. The contributions are -6 and 6, giving an output rate of zero. Neither contribution vanishes. They cancel when added.
The theorem requires differentiability of the outer function at the input point and differentiability of the path at the time considered. Knowing only that two coordinate partials exist does not establish the outer function's differentiability.
Keep track of the target input
If g is differentiable at t and h is differentiable at g(t), then the derivative of h(g(t)) is h'(g(t))g'(t). Keep g(t) as the input of the outer derivative and use g'(t) as a separate factor.
For z=f(x(s,t),y(s,t)), the final output has two independent inputs. To find ∂z/∂s, hold t fixed. Multiply f_x by ∂x/∂s and f_y by ∂y/∂s, then add. To find ∂z/∂t, hold s fixed and use the two inner t partials. Assume x,y are differentiable at the independent input pair and f is differentiable at the resulting intermediate pair.
Consider z=x+y with x=s+2t and y=3s-t. Changing s while holding t fixed gives ∂z/∂s=1+3=4. Changing t while holding s fixed gives ∂z/∂t=2-1=1. The different targets produce different rates.
Draw a link for each direct dependence. For this composition, link z to x and y, then each intermediate to s and t. Select paths ending at the requested input. Pair every outer partial with the inner partial of the same intermediate. At independent inputs (a,b), evaluate inner partials at (a,b) and outer partials at (x(a,b),y(a,b)). These generally different pairs correspond to the same independent input values.
Explore more
2 · Watch
Take it off screen
Where it sits
Learn first
Optional connections
16 questions wait behind this lesson, each with its answer explained. Every answer feeds the sky: stars light as they are learned, and dim when it is time to come back.