# 14.4: The Chain Rule

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

Consider the surface \(z=x^2y+xy^2\), and suppose that \(x=2+t^4\) and \(y=1-t^3\). We can think of the latter two equations as describing how \(x\) and \(y\) change relative to, say, time. Then

\[z=x^2y+xy^2=(2+t^4)^2(1-t^3)+(2+t^4)(1-t^3)^2\]

tells us explicitly how the \(z\) coordinate of the corresponding point on the surface depends on \(t\). If we want to know \(dz/dt\) we can compute it more or less directly---it's actually a bit simpler to use the chain rule:

\[\eqalign{ {dz\over dt}&=x^2y'+2xx'y+x2yy'+x'y^2\cr &=(2xy+y^2)x'+(x^2+2xy)y'\cr &=(2(2+t^4)(1-t^3)+(1-t^3)^2)(4t^3)+((2+t^4)^2+2(2+t^4)(1-t^3))(-3t^2)\cr }\]

If we look carefully at the middle step, \(dz/dt=(2xy+y^2)x'+(x^2+2xy)y'\), we notice that \(2xy+y^2\) is \(\partial z/\partial x\), and \(x^2+2xy\) is \(\partial z/\partial y\). This turns out to be true in general, and gives us a new chain rule:

Theorem 14.4.1

Suppose that \(z=f(x,y)\), \(f\) is differentiable, \(x=g(t)\), and \(y=h(t)\). Assuming that the relevant derivatives exist,

\[{dz\over dt}={\partial z\over \partial x}{dx\over dt}+ {\partial z\over \partial y}{dy\over dt}. \]

Proof

If \(f\) is differentiable, then

\[\Delta z=f_x(x_0,y_0)\Delta x+f_y(x_0,y_0)\Delta y+\epsilon_1\Delta x + \epsilon_2\Delta y,\]

where \(\epsilon_1\) and \(\epsilon_2\) approach 0 as \((x,y)\) approaches \((x_0,y_0)\). Then

\[\eqalignno{ {\Delta z\over\Delta t}&= f_x{\Delta x\over\Delta t}+f_y{\Delta y\over\Delta t}+\epsilon_1{\Delta x\over\Delta t} + \epsilon_2{\Delta y\over\Delta t}.& (14.4.1)\cr }\]

As \(\Delta t\) approaches 0, \((x,y)\) approaches \((x_0,y_0)\) and so

\[\eqalign{ \lim_{\Delta t\to0}{\Delta z\over\Delta t} &= {dz\over dt}\cr \lim_{\Delta t\to0}\epsilon_1{\Delta x\over\Delta t} &= 0\cdot{dx\over dt} \cr \lim_{\Delta t\to0}\epsilon_2{\Delta y\over\Delta t} &= 0\cdot{dy\over dt} \cr }\]

and so taking the limit of (14.4.1) as \(\Delta t\) goes to 0 gives

\[ {dz\over dt}= f_x{dx\over dt}+f_y{dy\over dt}, \]

as desired.

We can write the chain rule in way that is somewhat closer to the single variable chain rule:

\[{df\over dt}=\langle f_x,f_y\rangle\cdot\langle x',y'\rangle,\]

or (roughly) the derivatives of the outside function "times'' the derivatives of the inside functions. Not surprisingly, essentially the same chain rule works for functions of more than two variables, for example, given a function of three variables \(f(x,y,z)\), where each of \(x\), \(y\) and \(z\) is a function of \(t\),

\[{df\over dt}=\langle f_x,f_y,f_z\rangle\cdot\langle x',y',z'\rangle.\]

We can even extend the idea further. Suppose that \(f(x,y)\) is a function and \(x=g(s,t)\) and \(y=h(s,t)\) are functions of two variables \(s\) and \(t\). Then \(f\) is "really'' a function of \(s\) and \(t\) as well, and

\[{\partial f\over\partial s}=f_xg_s+f_yh_s\qquad {\partial f\over\partial t}=f_xg_t+f_yh_t.\]

The natural extension of this to \(f(x,y,z)\) works as well.

Recall that we used the ordinary chain rule to do implicit differentiation. We can do the same with the new chain rule.

Example 14.4.2

\(x^2+y^2+z^2 = 4\) defines a sphere, which is not a function of \(x\) and \(y\), though it can be thought of as two functions, the top and bottom hemispheres. We can think of \(z\) as one of these two functions, so really \(z=z(x,y)\), and we can think of \(x\) and \(y\) as particularly simple functions of \(x\) and \(y\), and let \(f(x,y,z)=x^2+y^2+z^2\). Since \(f(x,y,z)=4\), \(\partial f/\partial x=0\), but using the chain rule:

\[\eqalign{ 0={\partial f\over\partial x}&=f_x{\partial x\over\partial x}+ f_y{\partial y\over\partial x}+f_z{\partial z\over \partial x}\cr &=(2x)(1)+(2y)(0)+(2z){\partial z\over\partial x},\cr }\]

noting that since \(y\) is temporarily held constant its derivative \({\partial y/\partial x}=0\). Now we can solve for \(\partial z/\partial x\):

\[{\partial z\over \partial x}=-{2x\over 2z}=-{x\over z}. \]

In a similar manner we can compute \(\partial z/\partial y\).