- Use the chain rule when you have one independent variable
- Apply the chain rule with multiple changing variables
- Find derivatives implicitly when working with functions of multiple variables
Chain Rules for One or Two Independent Variables
In single-variable calculus, the chain rule was one of the most useful differentiation rules. It allowed us to find the derivative of the composition of two functions. The same thing is true for multivariable calculus, but now we have to deal with more than one form of the chain rule.
Chain Rule for Single-Variable Functions
For the derivative of a composite of two functions:
[latex]\frac{d}{dx}(f(g(x)))=f'(g(x))g'(x)[/latex]
where both [latex]f(x)[/latex] and [latex]g(x)[/latex] are functions of one variable.
In the above equation, both [latex]f(x)[/latex] and [latex]g(x)[/latex] are functions of one variable. What happens when [latex]f[/latex] is a function of two variables and [latex]g[/latex] is a function of one variable? Or when they’re both functions of two variables? The following theorem gives us the answer when we have one independent variable.
chain rule for one independent variable
Suppose that [latex]x=g(t)[/latex] and [latex]y=h(t)[/latex] are differentiable functions of [latex]t[/latex] and [latex]z=f(x, y)[/latex] is a differentiable function of [latex]x[/latex] and [latex]y[/latex]. Then [latex]z=f(x(t), y(t))[/latex] is a differentiable function of [latex]t[/latex] and
[latex]\dfrac{dz}{dt}=\dfrac{\partial{z}}{\partial{x}}\cdot\dfrac{dx}{dt}+\dfrac{\partial{z}}{\partial{y}}\cdot\dfrac{dy}{dt},[/latex]
where the ordinary derivatives are evaluated at [latex]t[/latex] and the partial derivatives are evaluated at [latex](x, y)[/latex].
Proof
The proof of this theorem uses the definition of differentiability of a function of two variables. Suppose that [latex]f[/latex] is differentiable at the point [latex]P(x_0, y_0)[/latex], where [latex]x_0=g(t_0)[/latex] and [latex]y_0=h(t_0)[/latex] for a fixed value of [latex]t_0[/latex]. We wish to prove that [latex]z=f(x(t), y(t))[/latex] is differentiable at [latex]t=t_0[/latex] and that the Chain Rule for One Independent Variable holds at that point as well.
Since [latex]f[/latex] is differentiable at [latex]P[/latex], we know that
[latex]\large{z(t)=f(x,y)=f(x_0,y_0)+f_x(x_0,y_0)(x-x_0)+f_y(x_0,y_0)(y-y_0)+E(x,y)},[/latex]
where [latex]\displaystyle{\lim_{(x,y)\to(x_0,y_0)}}\frac{E(x,y)}{\sqrt{(x-x_0)^2+(y-y_0)^2}}=0[/latex]. We then subtract [latex]z_0=f(x_0,y_0)[/latex] from both sides of this equation:
[latex]\begin{alignat}{2} z(t)-z(t_0) &= f(x(t),y(t))-f(x(t_0),y(t_0)) \\ &= f_x(x_0,y_0)(x(t)-x(t_0))+f_y(x_0,y_0)(y(t)-y(t_0))+E(x(t),y(t)). \\ \end{alignat}[/latex]
Next, we divide both sides by [latex]t-t_0[/latex]:
[latex]\frac{z(t)-z(t_0)}{t-t_0}=f_x(x_0,y_0)\left(\frac{x(t)-x(t_0)}{t-t_0}\right)+f_y(x_0,y_0)\left(\frac{y(t)-y(t_0)}{t-t_0}\right)+\frac{E(x(t),y(t))}{t-t_0}.[/latex]
Then we take the limit as [latex]t[/latex] approaches [latex]t_0[/latex]:
[latex]\displaystyle\lim_{t\to t_0}\frac{z(t)-z(t_0)}{t-t_0} = f_x(x_0,y_0)\displaystyle\lim_{t\to t_0}\left(\frac{x(t)-x(t_)}{t-t_0}\right)+f_y(x_0,y_0)\displaystyle\lim_{t\to t_0}\left(\frac{y(t)-y(t_0)}{t-t_0}\right)+ \displaystyle\lim_{t\to t_0}\frac{E(x(t),y(t))}{t-t_0}.[/latex]
The left-hand side of this equation is equal to [latex]dz/dt[/latex], which leads to
[latex]\frac{dz}{dt}=f_x(x_0,y_0)\frac{dx}{dt}+f_y(x_0,y_0)\frac{dy}{dt}+\displaystyle\lim_{t\to t_0}\frac{E(x(t),y(t))}{t-t_0}.[/latex]
The last term can be rewritten as
[latex]\begin{alignat}{2} \displaystyle\lim_{t\to t_0}\frac{E(x(t),y(t))}{t-t_0} &= \displaystyle\lim_{t\to t_0}\left(\frac{E(x,y)}{\sqrt{(x-x_0)^2+(y-y_0)^2}}\frac{\sqrt{(x-x_0)^2+(y-y_0)^2}}{t-t_0}\right) \\ &= \displaystyle\lim_{t\to t_0}\left(\frac{E(x,y)}{\sqrt{(x-x_0)^2+(y-y_0)^2}}\right)\displaystyle\lim_{t\to t_0}\left(\frac{\sqrt{(x-x_0)^2+(y-y_0)^2}}{t-t_0}\right). \\ \end{alignat}[/latex]
As [latex]t[/latex] approaches [latex]t_0, (x(t), y(t))[/latex] approaches [latex](x(t_0), y(t_0))[/latex], so we can rewrite the last product as
[latex]\displaystyle\lim_{(x,y)\to (x_0,y_0)}\left(\frac{E(x,y)}{\sqrt{(x-x_0)^2+(y-y_0)^2}}\right)\displaystyle\lim_{(x,y)\to (x_0,y_0)}\left(\frac{\sqrt{(x-x_0)^2+(y-y_0)^2}}{t-t_0}\right)[/latex]
Since the first limit is equal to zero, we need only show that the second limit is finite:
[latex]\begin{alignat}{2} \displaystyle\lim_{(x,y)\to (x_0,y_0)}\left(\frac{\sqrt{(x-x_0)^2+(y-y_0)^2}}{t-t_0}\right) &= \displaystyle\lim_{(x,y)\to (x_0,y_0)}\left(\sqrt{\frac{(x-x_0)^2+(y-y_0)^2}{(t-t_0)^2}}\right) \\ &= \displaystyle\lim_{(x,y)\to (x_0,y_0)}\left(\sqrt{\left(\frac{x-x_0}{t-t_0}\right)^2+\left(\frac{y-y_0}{t-t_0}\right)^2}\right) \\ &= \sqrt{\left(\displaystyle\lim_{(x,y)\to (x_0,y_0)}\left(\frac{x-x_0}{t-t_0}\right)\right)^2+\left( \displaystyle\lim_{(x,y)\to (x_0,y_0)}\left(\frac{y-y_0}{t-t_0}\right)\right)^2}. \end{alignat}[/latex]
Since [latex]x(t)[/latex] and [latex]y(t)[/latex] are both differentiable functions of [latex]t[/latex], both limits inside the last radical exist. Therefore, this value is finite. This proves the chain rule at [latex]t=t_0[/latex]; the rest of the theorem follows from the assumption that all functions are differentiable over their entire domains.
[latex]_\blacksquare[/latex]
Look closely at this chain rule. The first term is [latex]\frac{\partial z}{\partial x}\cdot\frac{dx}{dt}[/latex] and the second term is [latex]\frac{\partial z}{\partial y}\cdot\frac{dy}{dt}[/latex]. If we treat these derivatives like fractions, each product “simplifies”—the [latex]x[/latex] in the first term appears to cancel, as does the [latex]y[/latex] in the second term.
The variables [latex]x[/latex] and [latex]y[/latex] are called intermediate variables because they’re independent variables for [latex]f[/latex], but dependent variables for [latex]t[/latex]. Notice that we have two terms on the right side, and [latex]f[/latex] is a function of two variables. This pattern holds for functions with more variables too.
a. [latex]z=f(x,y)=4x^2+3y^2, x=x(t)=\sin{t},y=y(t)=\cos{t}[/latex]
b. [latex]z=f(x,y)=\sqrt{x^2-y^2},x=x(t)=e^{2t},y=y(t)=e^{-t}[/latex]
Tree Diagrams for the Chain Rule
A visual representation of the chain rule can be helpful. We use a tree diagram to remember the formula (Figure 1).

In this diagram, the leftmost corner represents [latex]z=f(x,y)[/latex]. Since [latex]f[/latex] has two independent variables, two lines come from this corner. The upper branch corresponds to [latex]x[/latex] and the lower branch corresponds to [latex]y[/latex].
Since both variables depend on [latex]t[/latex], one branch comes from [latex]x[/latex] and one from [latex]y[/latex]. Each branch on the far right shows the path traveled to reach it. The top branch follows [latex]x[/latex] then [latex]t[/latex], so it’s labeled [latex]\frac{\partial z}{\partial x}\times\frac{dx}{dt}[/latex]. The bottom branch follows [latex]y[/latex] then [latex]t[/latex], labeled [latex]\frac{\partial z}{\partial y}\times\frac{dy}{dt}[/latex].
To get [latex]\frac{dz}{dt}[/latex], add all the terms on the rightmost side of the diagram.
Chain Rule for Two Independent Variables
Now suppose [latex]z=f(x,y)[/latex] is a function of [latex]x[/latex] and [latex]y[/latex], and both [latex]x=g(u,v)[/latex] and [latex]y=h(u,v)[/latex] are functions of [latex]u[/latex] and [latex]v[/latex].
chain rule for two independent variables
Suppose [latex]x=g(u, v)[/latex] and [latex]y=h(u, v)[/latex] are differentiable functions of [latex]u[/latex] and [latex]v[/latex], and [latex]z=f(x, y)[/latex] is a differentiable function of [latex]x[/latex] and [latex]y[/latex]. Then, [latex]z=f(g(u, v), h(u, v))[/latex] is a differentiable function of [latex]u[/latex] and [latex]v[/latex], and
[latex]\dfrac{\partial z}{\partial u}=\dfrac{\partial z}{\partial x}\dfrac{\partial x}{\partial u}+\dfrac{\partial z}{\partial y}\dfrac{\partial y}{\partial u}[/latex]
and
[latex]\dfrac{\partial x}{\partial v}=\dfrac{\partial z}{\partial x}\dfrac{\partial x}{\partial v}+\dfrac{\partial z}{\partial y}\dfrac{\partial y}{\partial v}[/latex]
We can draw a tree diagram for each of these formulas as well.

To find [latex]\frac{\partial z}{\partial u}[/latex], start from the left side of the diagram and follow only the branches ending with [latex]u[/latex]. Add the terms at the end of those branches. For [latex]\frac{\partial z}{\partial v}[/latex], follow only the branches ending with [latex]v[/latex].
[latex]z=f(x,y)=3x^2-2xy+y^2,x=x(u,v)=3u+2v,y=y(u,v)=4u-v[/latex]