Chapter 6 CA6: Chain Rules
Section 6.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*}
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 6.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 6.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.
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.
Theorem 6.3. Chain Rule 1.
If \(z=z(x,y)\) and \(x=x(t)\text{,}\) \(y=y(t)\) are differentiable functions then
\begin{equation*}
\dfrac{dz}{dt} = \dfrac{\partial z}{\partial x}\cdot \dfrac{dx}{dt} + \dfrac{\partial z}{\partial y}\cdot \dfrac{dy}{dt}.
\end{equation*}
Example 6.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.
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 6.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{.}\)
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*}
Example 6.6.
The radius of a right circular cone is increasing at a rate of \(1.8\) cm/s while its height is decreasing at a rate of \(2.5\) cm/s. At what rate is the volume of the cone changing when the radius is \(120\) cm and the height is \(140\) cm?
Solution.
The volume \(V\) of right circular cone of radius \(r\) and height \(h\) is
\begin{equation*}
V(r,h) = \dfrac{1}{3}\pi r^2h.
\end{equation*}
Since both radius and the height are functions of time \(t\text{,}\) i.e. \(r=r(t)\) and \(h=h(t)\text{,}\) we can think of the volume as a function of time as well, i.e. \(V=V(t)\text{,}\) and the problem is asking us to find \(\dfrac{dV}{dt}\) when \(r=120\) and \(h=140\text{.}\) Now, by the chain rule:
\begin{equation*}
\dfrac{dV}{dt} = \dfrac{\partial V}{\partial r}\cdot \dfrac{dr}{dt} + \dfrac{\partial V}{\partial h}\cdot \dfrac{dh}{dt}.
\end{equation*}
Here
\begin{equation*}
\dfrac{\partial V}{\partial r} = \dfrac{2}{3}\pi rh \text{ and } \dfrac{\partial V}{\partial h} =\dfrac{1}{3}\pi r^2
\end{equation*}
and we are given that \(\dfrac{dr}{dt} = 1.8\) and \(\dfrac{dh}{dt} = -2.5\text{.}\) (Note that \(\dfrac{dh}{dt}\) is negative because the height is decreasing.) Thus, at \(r=120\) and \(h=140\)
\begin{alignat*}{1}
\dfrac{dV}{dt} \amp = \dfrac{2\pi}{3} \times 120 \times 140 \times 1.8 - \dfrac{\pi}{3}\times 120^2 \times 2.5\\
\amp = 8160\pi \ (\text{cm}^3\text{/s})
\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:
Theorem 6.7. Chain Rule 2.
If \(z=z(u)\) and \(u=u(x,y)\) are differentiable functions then
\begin{equation*}
\dfrac{\partial z}{\partial x} = \dfrac{dz}{du}\cdot\dfrac{\partial u}{\partial x} \quad \text{and} \quad \dfrac{\partial z}{\partial y} = \dfrac{dz}{du}\cdot\dfrac{\partial u}{\partial y}.
\end{equation*}
Example 6.8.
A spherical balloon holds a fixed amount of gas but its volume is dependent on the pressure \(P\) and temperature \(T\) of the gas according to
\begin{equation*}
V=k\dfrac{T}{P}, \quad k \ \text{ a constant}.
\end{equation*}
Determine expressions for the rate of change of the radius \(r\) of the balloon with respect to the pressure and temperature of the gas.
Answer.
Solution.
The volume \(V\) of a sphere of radius \(r\) is
\begin{equation*}
V = \dfrac{4}{3}\pi r^3.
\end{equation*}
Thus we can think of the radius of the balloon as a function of its volume, i.e.
\begin{equation*}
r(V) = CV^{\frac{1}{3}} \text{ where } C=\left(\dfrac{3}{4\pi}\right)^{\frac{1}{3}}
\end{equation*}
where the volume is, in turn, a function of the pressure and temperature of the gas, i.e.
\begin{equation*}
V(P,T) = kP^{-1}T.
\end{equation*}
Using Chain Rule 2:
\begin{alignat*}{1}
\dfrac{\partial r}{\partial P} \amp = \dfrac{dr}{dV}\dfrac{\partial V}{\partial P}\\
\amp = \left(\dfrac{1}{3}CV^{-\frac{2}{3}}\right)(-kTP^{-2})\\
\amp = -\dfrac{1}{3}Ck^{\frac{1}{3}}T^{\frac{1}{3}}P^{-\frac{4}{3}}.
\end{alignat*}
Similarly
\begin{alignat*}{1}
\dfrac{\partial r}{\partial T} \amp = \dfrac{dr}{dV}\dfrac{\partial V}{\partial T}\\
\amp = \left(\dfrac{1}{3}CV^{-\frac{2}{3}}\right)(kP^{-1})\\
\amp = \dfrac{1}{3}Ck^{\frac{1}{3}}T^{-\frac{2}{3}}P^{-\frac{1}{3}}.
\end{alignat*}
Example 6.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.
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:
Theorem 6.10. Chain Rule 3.
If \(z=z(x,y)\) and \(x=x(s,t)\text{,}\) \(y=y(s,t)\) are differentiable functions then
\begin{equation*}
\dfrac{\partial z}{\partial s} = \dfrac{\partial z}{\partial x} \cdot \dfrac{\partial x}{\partial s} + \dfrac{\partial z}{\partial y} \cdot \dfrac{\partial y}{\partial s}
\end{equation*}
\begin{equation*}
\dfrac{\partial z}{\partial t} = \dfrac{\partial z}{\partial x} \cdot \dfrac{\partial x}{\partial t} + \dfrac{\partial z}{\partial y} \cdot \dfrac{\partial y}{\partial t}
\end{equation*}
Example 6.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.
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.
Theorem 6.12. The General Chain Rule.
If \(z=z(x_1,x_2,\ldots,x_n)\) is a differentiable function of \(n\) variables \(x_1,x_2,\ldots,x_n\) and each \(x_i = x_i(t_1,t_2,\ldots,t_m)\) is a differentiable function of the \(m\) variables \(t_1,t_2,\ldots,t_m\) then
\begin{equation*}
\dfrac{\partial z}{\partial t_i} = \dfrac{\partial z}{\partial x_1} \cdot \dfrac{\partial x_1}{\partial t_i} + \dfrac{\partial z}{\partial x_2} \cdot \dfrac{\partial x_2}{\partial t_i} + \cdots + \dfrac{\partial z}{\partial x_n} \cdot \dfrac{\partial x_n}{\partial t_i}
\end{equation*}
for each \(i = 1,2,\ldots, m.\)
Example 6.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*}
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.
-
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{.}\)
-
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 6.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 6.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*}
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:
-
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";
-
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{6.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 (6.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{6.2}
\end{equation}
Returning to equation (6.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:
Theorem 6.15.
If the equation \(F(x,y) = 0\) implicitly defines the function \(y=y(x)\) then
\begin{equation*}
\dfrac{dy}{dx} = -\dfrac{F_x}{F_y} \text{ provided } F_y \neq 0.\
\end{equation*}
Example 6.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*}
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:
Theorem 6.17.
If \(F(x,y,z) = 0\) implicitly defines the function \(z=f(x,y)\) then
\begin{equation*}
\dfrac{\partial z}{\partial x} = -\dfrac{F_x}{F_z} \text{ and } \dfrac{\partial z}{\partial y} = -\dfrac{F_y}{F_z}, \text{ provided } F_z \neq 0. \
\end{equation*}
Example 6.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.
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*}
