Skip to main content

Chapter 8 CA8: Chain Rules

Section 8.1 The Single Variable Chain Rule

Recall that the chain rule for functions of one variable says:
\begin{equation*} \text{If } y=y(x) \text{ and } x=x(t) \text{ then } \dfrac{dy}{dt} = \dfrac{dy}{dx}\cdot \dfrac{dx}{dt}. \end{equation*}

Example 8.1.

Use the chain rule to find \(\dfrac{df}{dx}\) if \(f(u) = \sin(u)\) and \(u(x)=x^2+1\text{.}\)
Answer.
\(\dfrac{df}{dx} = 2x\cos(x^2+1)\)
Solution.
Via the chain rule:
\begin{alignat*}{1} \dfrac{df}{dx} \amp = \dfrac{df}{du}\dfrac{du}{dx}\\ \quad \amp = \cos(u)(2x)\\ \quad \amp = 2x\cos(x^2+1). \end{alignat*}
With multivariable functions there are many ways in which to form composite functions but there will be a chain rule for each possibility. In the following sections we will look at some of these.

Section 8.2 Multivariable Chain Rules

Begin by considering the case where \(z=z(x,y)\) and \(x=x(t)\text{,}\) \(y=y(t)\text{.}\) In this case we can think of \(z\) as defining a real valued function \(z=z(t)\text{.}\)

Example 8.2.

If \(z=x^2+2xy+3y^2\) and \(x=t+1\text{,}\) \(y=t-1\) then find \(z'(t)\) by substituting the expressions for \(x\) and \(y\) into \(z\) and then differentiating.
Answer.
\(\dfrac{dz}{dt} = 12t-4\)
Solution.
On substituting \(x\) and \(y\) into \(z\)
\begin{alignat*}{1} z(t) \amp = (t+1)^2 + 2(t+1)(t-1)+3(t-1)^2\\ \quad \amp = 6t^2-4t+2 \end{alignat*}
Thus
\begin{equation*} \dfrac{dz}{dt} = 12t-4. \end{equation*}
Now for a function \(f\) of two variables the linear approximation (or ’’small change’’) formula says:
\begin{equation*} \Delta f \approx \dfrac{\partial f}{\partial x}\Delta x + \dfrac{\partial f}{\partial y}\Delta y. \end{equation*}
Thus
\begin{equation*} \dfrac{\Delta f}{\Delta t} \approx \dfrac{\partial f}{\partial x}\frac{\Delta x}{\Delta t} + \dfrac{\partial f}{\partial y}\frac{\Delta y}{\Delta t}. \end{equation*}
This formula becomes more accurate as \(\Delta t \to 0\) and from the limit we obtain the following chain rule.

Example 8.4.

If \(z=x^2+2xy+3y^2\) and \(x=t+1\text{,}\) \(y=t-1\) then find \(z'(t)\) by using the chain rule.
Answer.
\(\dfrac{dz}{dt} = 12t-4\)
Solution.
Here
\begin{equation*} \dfrac{\partial z}{\partial x} = 2x + 2y, \ \dfrac{\partial z}{\partial y} = 2x + 6y, \ \dfrac{dx}{dt} = 1 = \dfrac{dy}{dt}. \end{equation*}
So, via the chain rule
\begin{alignat*}{1} \dfrac{dz}{dt} \amp = (2x+2y)\times 1 + (2x+6y)\times 1\\ \quad \amp = 4x+8y\\ \quad \amp = 4(t+1)+8(t-1)\\ \quad \amp = 12t-4. \end{alignat*}

Example 8.5.

Use the chain rule to find \(z'(t)\) when \(z(x,y) = \sqrt{x^2+y^2}\) and \(x(t) = e^{2t}, \ y(t)=e^{-2t}\text{.}\)
Answer.
\(\dfrac{dz}{dt} = \dfrac{2(e^{6t} - e^{-2t})}{\sqrt{e^{8t}+1}}\)
Solution.
Here
\begin{equation*} \dfrac{\partial z}{\partial x} = \dfrac{x}{\sqrt{x^2+y^2}}, \ \dfrac{\partial z}{\partial y} = \dfrac{y}{\sqrt{x^2+y^2}}, \ \dfrac{dx}{dt} = 2e^{2t}, \ \dfrac{dy}{dt} = -2e^{-2t}. \end{equation*}
So, via the chain rule
\begin{alignat*}{1} \dfrac{dz}{dt} \amp = \dfrac{x}{\sqrt{x^2+y^2}}\times 2e^{2t} + \dfrac{y}{\sqrt{x^2+y^2}}\times (-2e^{-2t})\\ \quad \amp = \dfrac{e^{2t}2e^{2t}}{\sqrt{e^{4t} + e^{-4t}}} -\dfrac{e^{-2t}2e^{-2t}}{\sqrt{e^{4t} + e^{-4t}}}\\ \quad \amp = \dfrac{2(e^{6t} - e^{-2t})}{\sqrt{e^{8t}+1}}. \end{alignat*}
Consider the case now where \(z=z(u)\) and \(u=u(x,y)\text{.}\) In this case we can think of \(z\) as defining a function of two variables \(z=z(x,y)\) and hence has partial derivatives with respect to these variables. The relevant chain rules for this case are:

Example 8.9.

Use the appropriate chain rules to calculate \(\dfrac{\partial z}{\partial x}\) and \(\dfrac{\partial z}{\partial y}\) when
\begin{equation*} z = \dfrac{u}{u+1} \text{ and } u = 3x^5-5xy^2. \end{equation*}
Answer.
\(\dfrac{\partial z}{\partial x} = \dfrac{15x^4-5y^2}{(3x^5-5xy^2+1)^2}\)
\(\dfrac{\partial z}{\partial y} = \dfrac{-10xy}{(3x^5-5xy^2+1)^2}\)
Solution.
Using Chain Rule 2:
\begin{equation*} \dfrac{\partial z}{\partial x} = \dfrac{dz}{du}\dfrac{\partial u}{\partial x} \text{ and } \dfrac{\partial z}{\partial y} = \dfrac{dz}{du}\dfrac{\partial u}{\partial y}. \end{equation*}
Now, (via the quotient rule)
\begin{equation*} \dfrac{dz}{du} = \dfrac{(u+1)(1) - u(1)}{(u+1)^2} = \dfrac{1}{(u+1)^2} \end{equation*}
and
\begin{equation*} \dfrac{\partial u}{\partial x} = 15x^4-5y^2 \text{ and } \dfrac{\partial u}{\partial y} = -10xy. \end{equation*}
Thus
\begin{equation*} \dfrac{\partial z}{\partial x} = \dfrac{15x^4-5y^2}{(3x^5-5xy^2+1)^2} \text{ and } \dfrac{\partial z}{\partial y} = \dfrac{-10xy}{(3x^5-5xy^2+1)^2}. \end{equation*}
Next consider the case where \(z=z(x,y)\) and \(x=x(s,t)\text{,}\) \(y=y(s,t)\text{.}\) In this case we can think of \(z\) as defining a function of two variables \(z=z(s,t)\text{.}\) The relevant chain rules for this case are:

Example 8.11.

Use the appropriate chain rules to find \(\dfrac{\partial z}{\partial s}\) and \(\dfrac{\partial z}{\partial t}\) when
\begin{equation*} z = \dfrac{x}{y} \text{ and } x = se^t, \quad y = 1+se^{-t}. \end{equation*}
Answer.
\(\dfrac{\partial z}{\partial s} = \dfrac{e^t}{(1+se^{-t})^2}\)
\(\dfrac{\partial z}{\partial t} = \dfrac{se^t+2s^2}{(1+se^{-t})^2}\)
Solution.
Here
\begin{equation*} \dfrac{\partial z}{\partial x} = \dfrac{1}{y}, \quad \dfrac{\partial z}{\partial y} = -\dfrac{x}{y^2} \end{equation*}
and
\begin{equation*} \dfrac{\partial x}{\partial s} = e^t, \quad \dfrac{\partial x}{\partial t} = se^t, \quad \dfrac{\partial y}{\partial s}=e^{-t}, \quad \dfrac{\partial y}{\partial t}=-se^{-t}. \end{equation*}
Thus, by Chain Rule 3
\begin{alignat*}{1} \dfrac{\partial z}{\partial s} \amp = \dfrac{\partial z}{\partial x} \cdot \dfrac{\partial x}{\partial s} + \dfrac{\partial z}{\partial y} \cdot \dfrac{\partial y}{\partial s}\\ \amp = \left(\dfrac{1}{1+se^{-t}}\right)(e^t) + \left(\dfrac{-se^t}{(1+se^{-t})^2}\right)(e^{-t})\\ \amp = \dfrac{e^t}{(1+se^{-t})^2} \end{alignat*}
and
\begin{alignat*}{1} \dfrac{\partial z}{\partial t} \amp = \dfrac{\partial z}{\partial x} \cdot \dfrac{\partial x}{\partial t} + \dfrac{\partial z}{\partial y} \cdot \dfrac{\partial y}{\partial t}\\ \amp = \left(\dfrac{1}{1+se^{-t}}\right)(se^t) + \left(\dfrac{-se^t}{(1+se^{-t})^2}\right)(-se^{-t})\\ \amp = \dfrac{se^t + 2s^2}{(1+se^{-t})^2} \end{alignat*}
The chain rules given above are just special cases of the general chain rule.

Example 8.13.

Find \(\dfrac{\partial w}{\partial u}\) if \(w(x,y,z) = 2x^2+5y^2+z^3\) and
\begin{equation*} x(r,s,t,u) = r+s+t+u, \quad y(r,s,t,u)=r^2,\quad z(r,s,t,u) = \sqrt{r-s+t-u} \end{equation*}
Answer.
\(\dfrac{\partial w}{\partial u} = 4(r+s+t+u) - \dfrac{3\sqrt{r-s+t-u}}{2}\)
Solution.
By the general Chain Rule
\begin{alignat*}{1} \dfrac{\partial w}{\partial u} \amp = \dfrac{\partial w}{\partial x}\dfrac{\partial x}{\partial u} + \dfrac{\partial w}{\partial y}\dfrac{\partial y}{\partial u} + \dfrac{\partial w}{\partial z}\dfrac{\partial z}{\partial u}\\ \amp = (4x)(1) + (10y)(0) + (3z^2)\left(\dfrac{1}{2}(r-s+t-u)^{-\frac{1}{2}}(-1)\right)\\ \amp = 4(r+s+t+u) - \dfrac{3\sqrt{r-s+t-u}}{2} \end{alignat*}

Exercises Example Tasks

1.
Use the appropriate chain rules to find \(\dfrac{\partial z}{\partial x}\) and \(\dfrac{\partial z}{\partial y}\) when
\begin{equation*} z(u,v)=u^2v+e^v \quad \text{and} \quad u(x,y) = \ln(y-x), \quad v(x,y) = x+xy. \end{equation*}
2.
Two straight roads intersect at right angles. Car A is moving on one road approaches the intersection at \(25\) km/h while Car B moving on the other road approaches the intersection at \(30\) km/h. At what rate is the distance between the cars changing when A is \(0.3\) km from the intersection and B is \(0.4\) km from the intersection?
3.
Show that any function of the form
\begin{equation*} z = f(x+at) + g(x-at) \end{equation*}
is a solution of the wave equation
\begin{equation*} \dfrac{\partial^2 z}{\partial t^2} = a^2\dfrac{\partial^2 z}{\partial x^2}. \end{equation*}
4.
  1. If \(z=z(x,y)\) and \(x=x(\theta)\) and \(y=y(\theta)\) find an appropriate chain rule for \(\dfrac{d^2z}{d\theta^2}\text{.}\)
  2. Using the result of part (a) find \(\dfrac{d^2z}{d\theta^2}\) when \(z(x,y)=x^2+2y\) and \(x(\theta) = 5\cos(\theta)\) and \(y(\theta) = 5\sin(\theta)\text{.}\)

Section 8.3 Implicit Differentiation

We can use our chain rules to produce another way looking at implicit differentiation. Assuming that the equation
\begin{equation*} F(x,y) = 0 \end{equation*}
implicitly defines the function \(y=y(x)\text{,}\) recall that implicit differentiation gives us a way of finding a formula for \(\dfrac{dy}{dx}\text{.}\)

Example 8.14.

Use implicit differentiation to find a formula for \(\dfrac{dy}{dx}\) for the function \(y=y(x)\) implicitly defined by the equation
\begin{equation*} x\cos(y) + y\cos(x) =x\text{.} \end{equation*}
Answer.
\(\dfrac{dy}{dx} = \dfrac{1-\cos(y)+y\sin(x)}{\cos(x)-x\sin(y)}\)
Solution.
Differentiating both sides of the equation with respect to \(x\)
\begin{alignat*}{1} \dfrac{d}{dx}\left(x\cos(y) + y\cos(x)\right) \amp = \dfrac{d}{dx}(x)\\ \left(-x\sin(y)\dfrac{dy}{dx} + \cos(y)\right) + \left(-y\sin(x)+\cos(x)\dfrac{dy}{dx}\right) \amp = 1\\ \dfrac{dy}{dx}\left(\cos(x)-x\sin(y)\right) \amp = 1-\cos(y) +y\sin(x)\\ \dfrac{dy}{dx} \amp = \dfrac{1-\cos(y)+y\sin(x)}{\cos(x)-x\sin(y)} \end{alignat*}
For the example above, we can construct the surface
\begin{equation*} f(x,y)=x\cos(y)-y\cos(x)-x \end{equation*}
and plot this using the Sage cell below. The constant \(c\) that determines the level curves \(f(x,y)=c\) can be varied with the slider. The level curves are shown in blue, and the slopes given by \(\dfrac{dy}{dx}\) are shown as little grey line segments. The slope of each segment is given by evaluating \(\dfrac{dy}{dx}\) at its \((x,y)\) position. (Note that these slopes are tangential to the curve, as they must be.) Furthermore:
  1. by selecting the "show3d" option, you can also see the 3D plot of \(z=f(x,y)\) and a "water level" of \(z=c\text{.}\) In this case, the curves \(f(x,y)=c\) represent the "shoreline";
  2. by selecting the "gradient" option, you can show the gradient vectors \(\nabla f(x,y)\) (red arrows), which are of course perpendicular to the level curves (and thus the grey slopes).
To use the chain rules to find a formula for \(\dfrac{dy}{dx}\) for the function implicitly defined by the equation
\begin{equation} F(x,y)=0\tag{8.1} \end{equation}
let
\begin{equation*} z=F(x,y) \text{ and } x=x(t), \quad y=y(t). \end{equation*}
Thus we can think of \(F\) as being a function of the one variable \(t\text{,}\) and so, by Chain Rule 1,
\begin{equation*} \dfrac{dz}{dt} = \dfrac{\partial F}{\partial x}\dfrac{dx}{dt} + \dfrac{\partial F}{\partial y}\dfrac{dy}{dt}. \end{equation*}
Now we are thinking of equation (8.1) as defining a function of one variable \(y=y(x)\text{,}\) so let \(x=x\) and \(y=y(x)\) and hence
\begin{equation} \dfrac{dz}{dx} = \dfrac{\partial F}{\partial x}\times (1) + \dfrac{\partial F}{\partial y}\dfrac{dy}{dx} = F_x + F_y \dfrac{dy}{dx}.\tag{8.2} \end{equation}
Returning to equation (8.1), on differentiating both sides with respect to \(x\text{,}\) we obtain
\begin{alignat*}{1} \dfrac{dz}{dx} \amp= \dfrac{d}{dx}(0)\\ F_x + F_y \dfrac{dy}{dx} \amp = 0. \end{alignat*}
from which we obtain, provided \(F_y\neq 0\text{,}\)
\begin{equation*} \dfrac{dy}{dx} = -\dfrac{F_x}{F_y}. \end{equation*}
Thus we can find a formula for \(\dfrac{dy}{dx}\) via partial differentiation as opposed to implicit differentiation. In summary:

Example 8.16.

Use partial differentiation to find a formula for \(\dfrac{dy}{dx}\) for the function \(y=y(x)\) implicitly defined by the equation
\begin{equation*} x\cos(y) + y\cos(x) =x\text{.} \end{equation*}
Answer.
\(\dfrac{dy}{dx} = \dfrac{1-\cos(y)+y\sin(x)}{\cos(x)-x\sin(y)}\)
Solution.
Let
\begin{equation*} F(x,y) = x\cos(y) + y\cos(x) - x\text{.} \end{equation*}
Then
\begin{equation*} \dfrac{\partial F}{\partial x} = \cos(y)-y\sin(x)-1 \text{ and } \dfrac{\partial F}{\partial y} = -x\sin(y)+\cos(x). \end{equation*}
Thus
\begin{alignat*}{1} \dfrac{dy}{dx} \amp = -\dfrac{F_x}{F_y}\\ \amp = \dfrac{1-\cos(y)+y\sin(x)}{\cos(x)-x\sin(y)}. \end{alignat*}
A similar argument can extend this result to functions of more than one variable. For example:

Example 8.18.

Use partial differentiation to find formulas for \(\dfrac{\partial z}{\partial s} \text{ and } \dfrac{\partial z}{\partial t}\) for the function \(z=z(s,t)\) implicitly defined by the equation
\begin{equation*} z^2 +\cos(s) + \ln(st) = 3. \end{equation*}
Answer.
\(\dfrac{\partial z}{\partial s} = \dfrac{\sin(s)-\frac{1}{s}}{2z}\)
\(\dfrac{\partial z}{\partial t} = -\dfrac{1}{2zt}\)
Solution.
Let
\begin{equation*} F(s,t,z) = z^2 + \cos(s) + \ln(st)-3\text{.} \end{equation*}
Then
\begin{equation*} F_s = -\sin(s)+\dfrac{1}{s}, \quad F_t=\dfrac{1}{t}, F_z=2z. \end{equation*}
Thus
\begin{equation*} \dfrac{\partial z}{\partial s} = -\dfrac{F_s}{F_z} = \dfrac{\sin(s)-\frac{1}{s}}{2z} \end{equation*}
\begin{equation*} \dfrac{\partial z}{\partial t} = -\dfrac{F_t}{F_z}=-\dfrac{1}{2zt}. \end{equation*}

Exercises Example Tasks

1.
Using partial differentiation (as opposed to implicit differentiation) find \(\dfrac{\partial z}{\partial x}\) at \((x,y,z) = (1,2,1)\) when the function \(z(x,y)\) is defined by the equation
\begin{equation*} (x-y)e^z + (y-z)e^x + (z-x)e^y = 0. \end{equation*}