Chain Rule for Multivariable Functions

• By David A. Smith, Founder & CEO, Direct Knowledge
• David Smith has a B.S. and M.S. in Mathematics and has enjoyed teaching calculus, linear algebra, and number theory at both Tarrant County College and the University of Texas at Arlington. David is the Founder and current CEO of Direct Knowledge.

Introduction to the Chain Rule

Recall that the chain rule for functions of a single variable gives the rule for differentiating a composite function: if $y=f(x)$ and $x=g(t),$ where $f$ and $g$ are differentiable functions, then $y$ is a a differentiable function of $t$ and $$\frac{dy}{d t}=\frac{dy}{dx}\frac{dx}{dt}.$$

The Chain Rule with One Independent Variable

There are several versions of the chain rule for functions of more than one variable, each of them giving a rule for differentiating a composite function.

Theorem. (Chain Rule Involving One Independent Variable) Let $f(x,y)$ be a differentiable function of $x$ and $y$, and let $x=x(t)$ and $y=y(t)$ be differentiable functions of $t.$ Then $z=f(x,y)$ is a differentiable function of $t$ and $$\label{criindevar} \frac{d z}{d t}=\frac{\partial z}{\partial x}\frac{d x}{d t}+\frac{\partial z}{\partial y}\frac{d y}{d t}.$$

Proof. Because $z=f(x,y)$ is differentiable, we can write the increment $\Delta z$ in the following form: $$\Delta z=\frac{\partial z}{\partial x}\Delta x+\frac{\partial z}{\partial y}\Delta y+\epsilon_1\Delta x+\epsilon_2\Delta y$$ where $\epsilon_1\to 0$ and $\epsilon_2\to 0$ as both $\Delta x\to 0$ and $\Delta y\to 0.$ Dividing by $\Delta t\neq 0,$ we obtain $$\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}+\epsilon 1\frac{\Delta x}{\Delta t}+\epsilon_2\frac{\Delta y}{\Delta t}.$$ Because $x$ and $y$ are function of $t$, we can write their increments as $$\Delta x=x(t+\Delta t) -x(t) \qquad \text{and} \qquad \Delta y=y(t+\Delta t)-y(t).$$ We know that $x$ and $y$ vary continuously with $t$, because $x$ and $y$ are differentiable, and it follows that $\Delta x\to 0$ and $\Delta y\to 0$ as $\Delta t\to 0$ so that $\epsilon_1\to 0$ and $\epsilon_2\to 0$ as $\Delta t\to 0.$ Therefore, we have \begin{align} \frac{d z}{d t} & =\lim_{\Delta t\to 0}\frac{\Delta z}{\Delta t} \\ & =\lim_{\Delta t\to 0}\left(\frac{\partial z}{\partial x}\frac{\Delta x}{\Delta t}+\frac{\partial z}{\partial y}\frac{\Delta y}{\Delta t}+\epsilon_1\frac{\Delta x}{\Delta t}+\epsilon_2\frac{\Delta y}{\Delta t}\right) \\ & =\frac{\partial z}{\partial x}\frac{d x}{d t}+\frac{\partial z}{\partial y}\frac{d y}{d t}+(0)\frac{\Delta x}{\Delta t}+(0)\frac{\Delta y}{\Delta t} \end{align}
as desired.

Example. If $z=x^2y+3x y^4,$ where $x=e^t$ and $y=\sin t$, find $\frac{d z}{d t}.$

Solution. The chain rule gives, \begin{align} \frac{d z}{d t} &=\frac{\partial z}{\partial x}\frac{d x}{d t}+\frac{\partial z}{\partial y}\frac{d y}{d t} \\ & =\left(2e^t\sin t+3 \text{sin t}^4t\right)e^t +\left(e^{2t}+12e^t\sin ^3t\right) \cos t. \end{align} as desired.

Example. Two objects are traveling in elliptical paths given by the following parametric equations $$x_1(t)=2 \cos t, \quad y_1(t)=3 \sin t \quad x_2(t)=4 \sin 2 t, \quad y_2(t)=3 \cos 2t.$$ At what rate is the distance between the two objects changing when $t=\pi ?$

Solution. The distance $s$ between the two objects is given by $$s=\sqrt{\left(x_2-x_1\right)^2+\left(y_2-y_1\right)^2}$$ and that when $t=\pi ,$ we have $x_1=-2,$ $y_1=0,$ $x_2=0,$ and $y_2=3.$ So $$s=\sqrt{(0+2)^2+(3-0)^2}=\sqrt{13}.$$ When $t=\pi ,$ the partial derivatives of $s$ are as follows. \begin{align} & \left.\frac{\partial s}{\partial x_1}\right|_{t=\pi } =\left.\frac{-\left(x_2-x_1\right)}{\sqrt{\left(x_2-x_1\right){}^2+\left(y_2-y_1\right){}^2}} \right|_{t=\pi}=\frac{-2}{\sqrt{13}} \\ & \left.\frac{\partial s}{\partial y_1}\right|_{t=\pi } =\left.\frac{-\left(y_2-y_1\right)}{\sqrt{\left(x_2-x_1\right){}^2+\left(y_2-y_1\right){}^2}}\right|_{t=\pi} = \frac{-3}{\sqrt{13}} \\ & \left.\frac{\partial s}{\partial x_2}\right|_{t=\pi } =\left.\frac{\left(x_2-x_1\right)}{\sqrt{\left(x_2-x_1\right){}^2+\left(y_2-y_1\right){}^2}}\right|{t=\pi}=\frac{2}{\sqrt{13}} \\ & \left.\frac{\partial s}{\partial y_2}\right|_{t=\pi } =\left.\frac{\left(y_2-y_1\right)}{\sqrt{\left(x_2-x_1\right){}^2+\left(y_2-y_1\right){}^2}}\right|_{t=\pi}=\frac{3}{\sqrt{13}} \end{align} When $t=\pi ,$ the derivatives of $x_1,$ $y_1,$ $x_2,$ and $y_2$ are \begin{align} & \left.\frac{d x_1}{dt}\right|_{t=\pi }=-2 \sin t|{t=\pi }=0 & & \left.\frac{d y_1}{dt}\right|_{t=\pi }=3 \cos t|{t=\pi }=-3 \\ & \left.\frac{d x_2}{dt}\right|_{t=\pi }=8 \cos 2t|{t=\pi }=8 & & \left.\frac{d y_2}{dt}\right|_{t=\pi }=-6 \sin 2t|{t=\pi }=0 \end{align} So using the chain rule $$\frac{d s}{d t} =\frac{\partial s}{\partial x_1}\frac{d x_1}{d t}+\frac{\partial s}{\partial y_1}\frac{d y_1}{d t}+\frac{\partial s}{\partial x_2}\frac{d x_2}{d t}+\frac{\partial s}{\partial y_2}\frac{d y_2}{d t}$$ When $t=\pi$, we find that the distance is changing at a rate of \begin{equation*} \left.\frac{d s}{d t} \right|_{t=\pi} =\left(\frac{-2}{\sqrt{13}}\right)(0)+\left(\frac{-3}{\sqrt{13}}\right)(-3)+\left(\frac{2}{\sqrt{13}}\right)(8)+\left(\frac{3}{\sqrt{13}}\right)(0) =\frac{25}{\sqrt{13}}. \end{equation*}

The Chain Rule with Two Independent Variables

Next we work through an example which illustrates how to find partial derivatives of two variable functions whose variables are also two variable functions. The proof of this chain rule is motivated by appealing to a previously proven chain rule with one independent variable.

Theorem. (Chain Rule Involving Two Independent Variables) Suppose $z=f(x,y)$ is a differentiable function at $(x,y)$ and that the partial derivatives of $x=x(u,v)$ and $y=y(u,v)$ exist at $(u,v).$ Then the composite function $z=f(x(u,v),y(u,v))$ is differentiable at $(u,v)$ with $$\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} \qquad \text{and} \qquad \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}.$$

Example. If $z=e^x\sin y$ where $x=s t^2$ and $y=s^2t$, find $\frac{\partial z}{\partial s}$ and $\frac{\partial z}{\partial t}.$

Solution. Applying the chain rule we obtain \begin{align} \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} \\ & =\left(e^x\sin y\right)\left(t^2\right)+\left(e^x\cos y\right)( s t) \\ & =t^2e^{s t^2}\sin \left(s^2 t\right)+2s t e^{s t^2}\cos \left(s^2t\right) \end{align} and \begin{align} \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} \\ & =\left(e^x\sin y\right)(2 s t)+\left(e^x\cos y\right)\left(2 s^2\right) \\ & =2 s t e^{s t^2}\sin \left(s^2 t\right)+s^2 e^{s t^2}\cos \left(s^2t\right). \end{align}

Example. The Cauchy-Riemann equations are $$\frac{\partial u}{\partial x}=\frac{\partial v}{\partial y} \qquad \text{and} \qquad \frac{\partial u}{\partial y}=-\frac{\partial v}{\partial x}$$ where $u=u(x,y)$ and $v=v(x,y).$ Show that if $x$ and $y$ are expressed in terms of polar coordinates, the Cauchy-Riemann equations become $$\frac{\partial u}{\partial r}=\frac{1}{r}\frac{\partial v}{\partial \theta } \qquad \text{and} \qquad \frac{\partial v}{\partial r}=\frac{-1}{r}\frac{\partial u}{\partial \theta }.$$

Solution. Using $x=r \cos \theta$ and $y=r \sin \theta$ we can state the chain rule to be used: $$\frac{\partial u}{\partial r}=\frac{\partial u}{\partial x}\frac{\partial x}{\partial r}+\frac{\partial u}{\partial y}\frac{\partial y}{\partial r} \qquad \text{and} \qquad \frac{\partial v}{\partial \theta }=\frac{\partial v}{\partial x}\frac{\partial x}{\partial \theta }+\frac{\partial v}{\partial y}\frac{\partial y}{\partial \theta }.$$ By the chain rule $$\frac{\partial u}{\partial r}=\frac{\partial u}{\partial x}\cos \theta +\frac{\partial u}{\partial y}\sin \theta \qquad \text{and} \qquad \frac{\partial v}{\partial \theta }=-\frac{\partial v}{\partial x}(r \sin \theta )+\frac{\partial v}{\partial y}(r \cos \theta ).$$ Substituting, $$\frac{\partial u}{\partial x}=\frac{\partial v}{\partial y} \qquad \text{and} \qquad \frac{\partial u}{\partial y}=-\frac{\partial v}{\partial x},$$ we obtain $$\frac{\partial u}{\partial r}=\frac{\partial v}{\partial y}\cos \theta -\frac{\partial v}{\partial x} \sin \theta$$ and so $$\frac{\partial u}{\partial r}=\frac{1}{r}\left[\frac{\partial v}{\partial y}(r \cos \theta )-\frac{\partial v}{\partial x}(r \sin \theta )\right]=\frac{1}{r}\frac{\partial v}{\partial \theta }.$$ Similarly the chain rule is to be used $$\frac{\partial v}{\partial r}=\frac{\partial v}{\partial x}\frac{\partial x}{\partial r}+\frac{\partial v}{\partial y}\frac{\partial y}{\partial r} \qquad \text{and} \qquad \frac{\partial u}{\partial \theta }=\frac{\partial u}{\partial x}\frac{\partial x}{\partial \theta }+\frac{\partial u}{\partial y}\frac{\partial y}{\partial \theta }.$$ By the chain rule $$\frac{\partial v}{\partial r}=\frac{\partial v}{\partial x}\cos \theta +\frac{\partial v}{\partial y}\sin \theta$$ and $$\frac{\partial u}{\partial \theta }=-\frac{\partial u}{\partial x}(r \sin \theta )+\frac{\partial u}{\partial y}(r \cos \theta ).$$ Substituting $$\frac{\partial u}{\partial x}=\frac{\partial v}{\partial y}\qquad \text{and} \qquad \frac{\partial u}{\partial y}=-\frac{\partial v}{\partial x},$$ we obtain $$\frac{\partial v}{\partial r}=-\frac{\partial u}{\partial y}\cos \theta -\frac{\partial u}{\partial x} \sin \theta$$ and also \begin{equation*} \frac{\partial u}{\partial r}=-\frac{1}{r}\left[\frac{\partial u}{\partial y}(r \cos \theta )-\frac{\partial u}{\partial x}(r \sin \theta )\right]=-\frac{1}{r}\frac{\partial u}{\partial \theta }. \end{equation*}

The Chain Rule with Several Independent Variables

Theorem. (Chain Rule Involving Several Independent Variable) If $w=f\left(x_1,\ldots,x_n\right)$ is a differentiable function of the $n$ variables $x_1,…,x_n$ which in turn are differentiable functions of $m$ parameters $t_1,…,t_m$ then the composite function is differentiable and $$\frac{\partial w}{\partial t_1}=\sum_{k=1}^n \frac{\partial w}{\partial x_k}\frac{\partial x_k}{\partial t_1}, \quad … \quad , \frac{\partial w}{\partial t_m}=\sum_{k=1}^n \frac{\partial w}{\partial x_k}\frac{\partial x_k}{\partial t_m}.$$

Example. Write out the chain rule for the case for the case when $n=4$ and $m=2$ where $w=f(x,y,z,t),$ $x=x(u,v),$ $y=y(u,v),$ $z=z(u,v),$ and $t(u,v).$

Solution. The chain rule for the case when $n=4$ and $m=2$ yields the following the partial derivatives: $$\frac{\partial w}{\partial u}=\frac{\partial w}{\partial x}\frac{\partial x}{\partial u}+\frac{\partial w}{\partial y}\frac{\partial y}{\partial u}+\frac{\partial w}{\partial z}\frac{\partial z}{\partial u}+\frac{\partial w}{\partial t}\frac{\partial t}{\partial u}$$ and $$\frac{\partial w}{\partial v}=\frac{\partial w}{\partial x}\frac{\partial x}{\partial v}+\frac{\partial w}{\partial y}\frac{\partial y}{\partial v}+\frac{\partial w}{\partial z}\frac{\partial z}{\partial v}+\frac{\partial w}{\partial t}\frac{\partial t}{\partial v}.$$ The chain rule for the case when $n=4$ and $m=2.$