Chain Rule for Multivariable Functions
Textbook Reference
| Primary source | OpenStax Calculus Volume 3, Section 4.5: “The Chain Rule” |
| Direct link | https://openstax.org/books/calculus-volume-3/pages/4-5-the-chain-rule |
| Textbook used in class | Stewart, Calculus, Section 14.5: “The Chain Rule” (Examples 1, 2, 3) |
Quick Reference
Case 1 ($z = f(x,y)$, $x = x(t)$, $y = y(t)$): $$\frac{dz}{dt} = \frac{\partial f}{\partial x}\frac{dx}{dt} + \frac{\partial f}{\partial y}\frac{dy}{dt}.$$
Case 2 ($z = f(x,y)$, $x = x(s,t)$, $y = y(s,t)$): $$\frac{\partial z}{\partial s} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial s} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial s}, \qquad \frac{\partial z}{\partial t} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial t} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial t}.$$
Motivation
Suppose the temperature of a room is $T(x,y)$ and a particle moves along a path $x(t)$, $y(t)$. The rate at which the temperature experienced by the particle changes is not simply $\partial T/\partial t$ (there is no explicit $t$ dependence in $T$). Instead, it is $(\partial T/\partial x)(dx/dt) + (\partial T/\partial y)(dy/dt)$: temperature changes due to both the $x$-direction motion and the $y$-direction motion.
The multivariable chain rule systematizes exactly this type of composition, and it generalizes naturally to any number of variables and intermediate parameters.
Key Concepts
1. Tree Diagrams
A tree diagram is a structured way to organize chain rule terms:
- The top node is the dependent variable ($z$).
- Middle nodes are intermediate variables ($x$, $y$).
- Leaf nodes are the independent variables ($t$ or $s, t$).
Each path from the top to a leaf contributes one product of partial derivatives. The total derivative is the sum over all such paths.
For Case 1: two paths $z \to x \to t$ and $z \to y \to t$, giving $(\partial z/\partial x)(dx/dt) + (\partial z/\partial y)(dy/dt)$.
2. Case 2 (Two Intermediate Variables)
When $z = f(x,y)$ and $x, y$ both depend on $s$ and $t$, there are four paths in the tree: $$\frac{\partial z}{\partial s} = \frac{\partial z}{\partial x}\frac{\partial x}{\partial s} + \frac{\partial z}{\partial y}\frac{\partial y}{\partial s}.$$ $$\frac{\partial z}{\partial t} = \frac{\partial z}{\partial x}\frac{\partial x}{\partial t} + \frac{\partial z}{\partial y}\frac{\partial y}{\partial t}.$$
Worked Examples
Example 1. Let $z = x^2 y + y^3$, $x = \sin t$, $y = \cos t$. Find $dz/dt$ at $t = 0$.
$$\frac{dz}{dt} = (2xy)\cos t + (x^2 + 3y^2)(-\sin t).$$
At $t = 0$: $x = 0$, $y = 1$.
$$\frac{dz}{dt}\bigg|_{t=0} = (2\cdot 0\cdot 1)(1) + (0 + 3)(-0) = 0.$$
Example 2. Let $z = e^x\sin y$, $x = st^2$, $y = s^2 t$. Find $\partial z/\partial s$.
$$\frac{\partial z}{\partial s} = e^x\sin y \cdot t^2 + e^x\cos y \cdot 2st.$$
Substituting back: $\frac{\partial z}{\partial s} = e^{st^2}(t^2\sin(s^2 t) + 2st\cos(s^2 t))$.
$\partial z/\partial t$ can be computed by substituting $x$ and $y$ as functions of $t$, then differentiating directly. You can do this, but only after substituting all the way through to eliminate $x$ and $y$. The chain rule formula is more efficient and avoids expanding complicated compositions. However, if you do substitute first, the result MUST agree with the chain rule -- substituting is a valid check.
Leveled Practice
Problem 1. Let $w = xy + yz$, $x = e^t$, $y = e^{2t}$, $z = e^{3t}$. Find $dw/dt$.
Show answer
$w_x = y$, $w_y = x+z$, $w_z = y$.
$dw/dt = y\cdot e^t + (x+z)\cdot 2e^{2t} + y\cdot 3e^{3t}$.
At general $t$: $= e^{2t}\cdot e^t + (e^t + e^{3t})\cdot 2e^{2t} + e^{2t}\cdot 3e^{3t}$
$= e^{3t} + 2e^{3t} + 2e^{5t} + 3e^{5t} = 3e^{3t} + 5e^{5t}$.