# Multi-Variable Chain Rule

Page
The Multivariable Chain Rule – HMC Calculus Tutorial

Suppose that $z=f(x,y)$, where $x$ and $y$ themselves depend on one or more variables. Multivariable Chain Rules allow us to differentiate $z$ with respect to any of the variables involved:

Let $x=x(t)$ and $y=y(t)$ be differentiable at $t$ and suppose that $z=f(x,y)$ is differentiable at the point $(x(t),y(t))$. Then $z=f(x(t),y(t))$ is differentiable at $t$ and $$\frac{dz}{dt} = \frac{\partial z}{\partial x}\frac{dx}{dt} + \frac{\partial z}{\partial y}\frac{dy}{dt}.$$

Since $z=f(x,y)$ is differentiable at the point $(x,y)$, $$\Delta z = \frac{\partial z}{\partial x}\Delta x + \frac{\partial z}{\partial y}\Delta y + \varepsilon_1 \Delta x + \varepsilon_2 \Delta y$$ where $\varepsilon_1 \rightarrow 0$ and $\varepsilon_2 \rightarrow 0$ as $(\Delta x,\Delta y) \rightarrow (0,0)$. Thus, $$\frac{\Delta z}{\Delta t} = \frac{\partial z}{\partial x}\frac{\Delta x}{\Delta t} + \frac{\partial z}{\partial y}\frac{\Delta y}{\Delta t} + \varepsilon_1 \frac{\Delta x}{\Delta t} + \varepsilon_2\frac{\Delta y}{\Delta t}.$$ Taking the limit as $\Delta t \rightarrow 0$, \begin{eqnarray*} \lim_{\Delta t \rightarrow 0} \frac{\Delta z}{\Delta t} & = & \lim_{\Delta t \rightarrow 0} \left[\frac{\partial z}{\partial x}\frac{\Delta x}{\Delta t} + \frac{\partial z}{\partial y}\frac{\Delta y}{\Delta t} + \varepsilon_1 \frac{\Delta x}{\Delta t} + \varepsilon_2\frac{\Delta y}{\Delta t}\right] \\ \frac{dz}{dt} & = & \frac{\partial z}{\partial x}\frac{dx}{dt} + \frac{\partial z}{\partial y}\frac{dy}{dt} + \left(\lim_{\Delta t \rightarrow 0} \varepsilon_1 \right)\frac{dx}{dt} + \left(\lim_{\Delta t \rightarrow 0} \varepsilon_2 \right)\frac{dy}{dt}. \end{eqnarray*} But $\lim\limits_{\Delta t \rightarrow 0} \Delta x = \lim\limits_{\Delta t \rightarrow 0} \frac{\Delta x}{\Delta t} \Delta t = \frac{dx}{dt}\lim\limits_{\Delta t \rightarrow 0} \Delta t = 0$ and similarly $\lim\limits_{\Delta t \rightarrow 0} \Delta y= 0$, so $\lim\limits_{\Delta t \rightarrow 0} \varepsilon_1 = \lim\limits_{\Delta t \rightarrow 0} \varepsilon_2 = 0$. Thus, \begin{eqnarray*} \frac{dx}{dt} & = & \frac{\partial x}{\partial x}\frac{dx}{dt} + \frac{\partial z}{\partial y}\frac{dy}{dt} + (0)\frac{dx}{dt} + (0)\frac{dy}{dt} \\ & = & \frac{\partial x}{\partial x}\frac{dx}{dt} + \frac{\partial z}{\partial y}\frac{dy}{dt}. \end{eqnarray*} (proof taken from Calculus, by Howard Anton.)

Although the formal proof is not trivial, the variable-dependence diagram shown here provides a simple way to remember this Chain Rule. Simply add up the two paths starting at $z$ and ending at $t$, multiplying derivatives along each path.

###### Example

Let $z=x^2y-y^2$ where $x$ and $y$ are parametrized as $x=t^2$ and $y=2t$.

Then \begin{eqnarray*} \frac{dz}{dt} & = & \frac{\partial z}{\partial x}\frac{dx}{dt} + \frac{\partial z}{\partial y}\frac{dy}{dt}\\ & = & (2xy)(2t) + (x^2-2y)(2) \\ & = & (2t^2\cdot 2t)(2t) + \left( (t^2)^2-2(2t) \right) (2)\\ & = & 8t^4 + 2t^4 -8t \\ & = & 10t^4-8t. \end{eqnarray*}

Since $x(t)=t^2$ and $y(t) = 2t$, \begin{eqnarray*} z & = & x^2y-y^2 \\ & = & \left( t^2 \right)^2(2t) -(2t)^2 \\ & = & 2t^5 -4t^2. \end{eqnarray*} We can now compute $\frac{dz}{dt}$ directly! $$\frac{dz}{dt} = 10t^4-8t,$$ as we obtained using the Chain Rule.

We now suppose that $x$ and $y$ are both multivariable functions.

Let $x=x(u,v)$ and $y=y(u,v)$ have first-order partial derivatives at the point $(u,v)$ and suppose that $z=f(x,y)$ is differentiable at the point $(x(u,v),y(u,v))$. Then $f(x(u,v),y(u,v))$ has first-order partial derivatives at $(u,v)$ given by \begin{eqnarray*} \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} \\ \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} . \end{eqnarray*}

Holding $v$ fixed and applying the first multivariable Chain Rule in this tutorial to $z~=~z(x(u),y(u))$, $$\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}.$$ Similarly, holding $u$ fixed and applying the Chain Rule to $z=z(x(u),y(u))$, $$\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}.$$ (proof taken from Calculus, by Howard Anton.)

Again, the variable-dependence diagram shown here indicates this Chain Rule by summing paths for $z$ either to $u$ or to $v$.

###### Example

Let $z=e^{x^{2}y}$, where $x(u,v)=\sqrt{uv}$ and $y(u,v) = 1/v$. Then \begin{eqnarray*} \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} \\ & = & \left( 2xye^{x^{2}y} \right) \left(\frac{\sqrt{v}}{2\sqrt{u}}\right) + \left(x^{2}e^{x^{2}y}\right)(0) \\ & = & 2\sqrt{uv} \cdot \frac{1}{v} e^{(\sqrt{uv})^{2} \cdot \frac{1}{v}} \cdot \frac{\sqrt{v}}{2\sqrt{u}} + (\sqrt{uv})^{2} \cdot e^{(\sqrt{uv})^{2} \cdot \frac{1}{v}} \cdot (0) \\ & = & e^{u} + 0 \\ & = & e^{u} \\ \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} \\ & = & \left( 2xye^{x^{2}y} \right) \left(\frac{\sqrt{u}}{2\sqrt{v}} \right) + \left(x^{2}e^{x^{2}y}\right) \left( -\frac{1}{v^{2}} \right) \\ & = & 2\sqrt{uv}\cdot\frac{1}{v} e^{(\sqrt{uv})^{2}\cdot\frac{1}{v}} \cdot \frac{\sqrt{u}}{2\sqrt{v}} + (\sqrt{uv})^{2}e^{(\sqrt{uv})^{2} \cdot \frac{1}{v}} \cdot \left( -\frac{1}{v^{2}}\right) \\ & = & \frac{u}{v}e^{u} – \frac{u}{v}e^{u} \\ & = & 0. \end{eqnarray*}

Since $x=\sqrt{uv}$ and $y=\frac{1}{v}$, \begin{eqnarray*} z & = & e^{x^2y} \\ & = & e^{(\sqrt{uv})^2\left( \frac{1}{v} \right)} \\ & = & e^{u}. \end{eqnarray*} Then, differentiating $z$ with respect to $u$ and $v$, respectively, \begin{eqnarray*} \frac{\partial z}{\partial u} & = & e^u \\ \frac{\partial z}{\partial v} & = & 0 \end{eqnarray*} as found using the Chain Rule!

These Chain Rules generalize to functions of three or more variables in a straight forward manner.

#### Key Concepts

• Let $x=x(t)$ and $y=y(t)$ be differentiable at $t$ and suppose that $z=f(x,y)$ is differentiable at the point $(x(t),y(t))$. Then $z=f(x(t),y(t))$ is differentiable at $t$ and $$\frac{dz}{dt} = \frac{\partial z}{\partial x}\frac{dx}{dt} + \frac{\partial z}{\partial y}\frac{dy}{dt}.$$

• Let $x=x(u,v)$ and $y=y(u,v)$ have first-order partial derivatives at the point $(u,v)$ and suppose that $z=f(x,y)$ is differentiable at the point $(x(u,v),y(u,v))$. Then $f(x(u,v),y(u,v))$ has first-order partial derivatives at $(u,v)$ given by \begin{eqnarray*} \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} \\ \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} . \end{eqnarray*}