01 / 21

Multivariable
Chain Rule

Learn how to differentiate compositions of functions with multiple variables: the essential tool for connecting rates of change across linked quantities.

AP Calculus

Why We Need a New Chain Rule

In single-variable calculus, the chain rule is simple: if \( y = f(g(t)) \), then \( \frac{dy}{dt} = f'(g(t)) \cdot g'(t) \). But what happens when \( f \) depends on two or more intermediate variables, each of which depends on \( t \)?

The Dependency Tree

A dependency tree (or tree diagram) maps how the final output connects to the independent variable through intermediate variables. Each path contributes a product of partial derivatives.

z x y t \(\frac{\partial z}{\partial x}\) \(\frac{\partial z}{\partial y}\) \(\frac{dx}{dt}\) \(\frac{dy}{dt}\)

Intuition: Adding Up Influences

Imagine you are hiking on a surface \( z = f(x,y) \). As time \( t \) passes, your position \( (x(t), y(t)) \) changes. The altitude \( z \) changes because:

Path through \( x \)
Moving east/west changes altitude at rate \( \frac{\partial z}{\partial x} \cdot \frac{dx}{dt} \)
Path through \( y \)
Moving north/south changes altitude at rate \( \frac{\partial z}{\partial y} \cdot \frac{dy}{dt} \)

The Chain Rule: Case 1

This is Case 1: one independent variable \( t \), two intermediate variables \( x \) and \( y \). The formula sums the contribution from each pathway in the dependency tree.

The Chain Rule: Case 2

This is Case 2: two independent variables \( s \) and \( t \). Now every derivative in the formula is partial, and we get one equation per independent variable.

The General Formula

The pattern is always the same: sum over all intermediate variables, each contributing a product of the partial of the output with respect to that intermediate, times the partial of the intermediate with respect to the independent variable.

Case 1 vs Case 2

Case 1 Case 2
Independent vars One: \( t \) Two+: \( s, t, \ldots \)
Intermediate vars \( x(t),\; y(t) \) \( x(s,t),\; y(s,t) \)
Result type Ordinary: \( \frac{dz}{dt} \) Partial: \( \frac{\partial z}{\partial s},\; \frac{\partial z}{\partial t} \)
Equations produced 1 1 per independent var
Derivative notation \( \frac{d}{dt} \) for intermediates \( \frac{\partial}{\partial s},\; \frac{\partial}{\partial t} \) throughout

How to Apply the Chain Rule

1
Draw the tree. Identify the output, intermediate, and independent variables. Sketch the dependency diagram.
2
List all paths. Trace every path from the output to the target independent variable through the tree.
3
Multiply along each path. Each edge is a partial derivative. Multiply the derivatives along each path.
4
Sum all paths. Add together the products from every path. This is your answer.
5
Substitute and simplify. Replace intermediate variables with their expressions in terms of the independent variable(s) if needed.

Example 1: Basic Application

Find \( \frac{dz}{dt} \) if \( z = x^2 y + 3y \), where \( x = \sin t \) and \( y = e^t \).

1
Partial derivatives of \( z \): \( \frac{\partial z}{\partial x} = 2xy \), \( \frac{\partial z}{\partial y} = x^2 + 3 \)
2
Derivatives of intermediates: \( \frac{dx}{dt} = \cos t \), \( \frac{dy}{dt} = e^t \)
3
Apply the chain rule: \( \frac{dz}{dt} = 2xy \cdot \cos t + (x^2 + 3) \cdot e^t \)
4
Substitute: \( \frac{dz}{dt} = 2(\sin t)(e^t)\cos t + (\sin^2 t + 3)e^t \)

Example 2: Case 2 with Two Independents

Let \( z = e^x \sin y \), where \( x = st^2 \) and \( y = s^2 t \). Find \( \frac{\partial z}{\partial s} \) and \( \frac{\partial z}{\partial t} \).

1
Partials of \( z \): \( \frac{\partial z}{\partial x} = e^x \sin y \), \( \frac{\partial z}{\partial y} = e^x \cos y \)
2
Partials of intermediates w.r.t. \( s \): \( \frac{\partial x}{\partial s} = t^2 \), \( \frac{\partial y}{\partial s} = 2st \)
3
Chain rule for \( s \): \( \frac{\partial z}{\partial s} = e^x \sin y \cdot t^2 + e^x \cos y \cdot 2st \)

Example 3: Three Intermediate Variables

Let \( w = x^2 + yz \), where \( x = t \), \( y = t^2 \), \( z = t^3 \). Find \( \frac{dw}{dt} \).

\(w\)
\(x\)
\(y\)
\(z\)
\(t\)

Connection to Implicit Differentiation

The multivariable chain rule also gives us a clean formula for implicit differentiation. If \( F(x, y) = 0 \) defines \( y \) implicitly as a function of \( x \), then:

This follows from applying the chain rule to \( F(x, y(x)) = 0 \) and solving for \( \frac{dy}{dx} \). The same idea extends: if \( F(x,y,z) = 0 \) defines \( z \) implicitly, then \( \frac{\partial z}{\partial x} = -\frac{F_x}{F_z} \).

The Chain Rule as a Dot Product

There is a beautiful compact form using the gradient. If \( z = f(x,y) \) and \( \mathbf{r}(t) = \langle x(t), y(t) \rangle \), then:

The chain rule is a dot product of the gradient of \( f \) and the velocity vector of the path. This viewpoint connects directly to directional derivatives: the rate of change of \( f \) along a curve equals the gradient dotted with the tangent vector.

Common Mistakes

Forgetting a Path
Only differentiating through \( x \) and ignoring the \( y \) pathway. Every intermediate variable contributes a term.
Wrong Notation
Writing \( \frac{dz}{dx} \) when \( z \) depends on multiple variables. Use \( \frac{\partial z}{\partial x} \) for partials.
Multiplying Instead of Adding
The paths are summed, not multiplied. Only derivatives along a single path are multiplied together.

Summary of Chain Rule Forms

Setup Formula Result Type
\( z=f(x,y),\; x=x(t),\; y=y(t) \) \( \frac{dz}{dt} = z_x\,x' + z_y\,y' \) Ordinary
\( z=f(x,y),\; x=x(s,t),\; y=y(s,t) \) \( \frac{\partial z}{\partial s} = z_x\,x_s + z_y\,y_s \) Partial
\( w = f(x_1,\ldots,x_n),\; x_i=x_i(t_1,\ldots,t_m) \) \( \frac{\partial w}{\partial t_j} = \sum_i w_{x_i}\,(x_i)_{t_j} \) Partial
Gradient form \( \frac{dz}{dt} = \nabla f \cdot \mathbf{r}'(t) \) Ordinary

Question 1 of 5

If \( z = xy^2 \), \( x = t^2 \), and \( y = t^3 \), what is \( \frac{dz}{dt} \)?

Question 2 of 5

How many terms appear in \( \frac{\partial w}{\partial t} \) if \( w = f(x, y, z) \) with \( x = x(s,t) \), \( y = y(s,t) \), \( z = z(s,t) \)?

Question 3 of 5

If \( F(x,y) = x^3 + xy - y^2 = 0 \), what is \( \frac{dy}{dx} \) using implicit differentiation via the chain rule?

Question 4 of 5

Let \( z = \ln(x^2 + y) \), \( x = e^t \), \( y = t^2 \). Which expression correctly gives \( \frac{dz}{dt} \)?

Question 5 of 5

The multivariable chain rule \( \frac{dz}{dt} = \frac{\partial z}{\partial x}\frac{dx}{dt} + \frac{\partial z}{\partial y}\frac{dy}{dt} \) can be written compactly as: