# 2.9: One More Tool – the Chain Rule

- Page ID
- 89721

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

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

\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\id}{\mathrm{id}}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\kernel}{\mathrm{null}\,}\)

\( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\)

\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\)

\( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)

\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)

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

\( \newcommand{\vectorC}[1]{\textbf{#1}} \)

\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

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

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

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

\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)We have built up most of the tools that we need to express derivatives of complicated functions in terms of derivatives of simpler known functions. We started by learning how to evaluate

- derivatives of sums, products and quotients
- derivatives of constants and monomials

These tools allow us to compute derivatives of polynomials and rational functions. In the previous sections, we added exponential and trigonometric functions to our list. The final tool we add is called the chain rule. It tells us how to take the derivative of a composition of two functions. That is if we know \(f(x)\) and \(g(x)\) and their derivatives, then the chain rule tells us the derivative of \(f\big(g(x)\big)\text{.}\)

Before we get to the statement of the rule, let us look at an example showing how such a composition might arise (in the “real-world”).

You are out in the woods after a long day of mathematics and are walking towards your camp fire on a beautiful still night. The heat from the fire means that the air temperature depends on your position. Let your position at time \(t\) be \(x(t)\text{.}\) The temperature of the air at position \(x\) is \(f(x)\text{.}\) What instantaneous rate of change of temperature do you feel at time \(t\text{?}\)

- Because your position at time \(t\) is \(x=x(t)\text{,}\) the temperature you feel at time \(t\) is \(F(t)=f\big(x(t)\big)\text{.}\)
- The instantaneous rate of change of temperature that you feel is \(F'(t)\text{.}\) We have a complicated function, \(F(t)\text{,}\) constructed by composing two simpler functions, \(x(t)\) and \(f(x)\text{.}\)
- We wish to compute the derivative, \(F'(t) = \dfrac{d}{dt} f( x(t) )\text{,}\) of the complicated function \(F(t)\) in terms of the derivatives, \(x'(t)\) and \(f'(x)\text{,}\) of the two simple functions. This is exactly what the chain rule does.

## Statement of the Chain Rule

Let \(a \in \mathbb{R}\) and let \(g(x)\) be a function that is differentiable at \(x=a\text{.}\) Now let \(f(u)\) be a function that is differentiable at \(u=g(a)\text{.}\) Then the function \(F(x) = f(g(x))\) is differentiable at \(x=a\) and

\begin{align*} F'(a) &=f'\big(g(a)\big)\,g'(a) \end{align*}

Here, as was the case earlier in this chapter, we have been very careful to give the point at which the derivative is evaluated a special name (i.e. \(a\)). But of course this evaluation point can really be any point (where the derivative is defined). So it is very common to just call the evaluation point “\(x\)” rather than give it a special name like “\(a\)”, like this:

Let \(f\) and \(g\) be differentiable functions then

\begin{align*} \dfrac{d}{dx} f\big( g( x) \big) &= f'\big(g(x)\big) \cdot g'(x) \end{align*}

Notice that when we form the composition \(f\big(g(x)\big)\) there is an “outside” function (namely \(f(x)\)) and an “inside” function (namely \(g(x)\)). The chain rule tells us that when we differentiate a composition that we have to differentiate the outside and then multiply by the derivative of the inside.

\begin{align*} \dfrac{d}{dx} f\big( g( x) \big) &= \underbrace{f'\big(g(x)\big)}_\text{diff outside} \cdot \underbrace{g'(x)}_\text{diff inside} \end{align*}

Here is another statement of the chain rule which makes this idea more explicit.

Let \(y = f(u)\) and \(u = g(x)\) be differentiable functions, then

\begin{align*} \dfrac{dy}{dx} &= \dfrac{dy}{du} \cdot \dfrac{du}{dx} \end{align*}

This particular form is easy to remember because it looks like we can just “cancel” the \(\mathrm{d}u\) between the two terms.

\begin{align*} \dfrac{dy}{dx} &= \frac{\mathrm{d}{y}}{\cancel{\mathrm{d}u}} \cdot \frac{\cancel{\mathrm{d}{u}}}{\mathrm{d}x} \end{align*}

Of course, \(\mathrm{d}u\) is not, by itself, a number or variable ^{1} that can be cancelled. But this is still a good memory aid.

The hardest part about applying the chain rule is recognising when the function you are trying to differentiate is really the composition of two simpler functions. This takes a little practice. We can warm up with a couple of simple examples.

Let \(f(u) = u^5\) and \(g(x) = \sin(x)\text{.}\) Then set \(F(x) = f\big(g(x)\big) = \big(\sin(x)\big)^5\text{.}\) To find the derivative of \(F(x)\) we can simply apply the chain rule — the pieces of the composition have been laid out for us. Here they are.

\begin{align*} f(u) &= u^5 & f'(u) &= 5u^4\\ g(x) &= \sin(x) & g'(x) &= \cos x \end{align*}

We now just put them together as the chain rule tells us

\begin{align*} \dfrac{dF}{dx} &= f'\big(g(x)\big) \cdot g'(x)\\ &= 5\big(g(x)\big)^4 \cdot \cos(x) & \text{since } f'(u) = 5u^4\\ &= 5 \big(\sin(x)\big)^4 \cdot \cos(x) \end{align*}

Notice that it is quite easy to extend this to any power. Set \(f(u) = u^n\text{.}\) Then follow the same steps and we arrive at

\begin{align*} F(x) &= (\sin(x))^n & F'(x) &= n \big(\sin(x) \big)^{n-1} \cos(x) \end{align*}

This example shows one of the ways that the chain rule appears very frequently — when we need to differentiate the power of some simpler function. More generally we have the following.

Let \(f(u) = u^n\) and let \(g(x)\) be any differentiable function. Set \(F(x) = f\big(g(x)\big) = g(x)^n\text{.}\) Then

\begin{align*} \dfrac{dF}{dx} = \dfrac{d}{dx} \big( g(x)^n \big) &= n g(x)^{n-1} \cdot g'(x) \end{align*}

This is precisely the result in Example 2.6.6 and Lemma 2.6.7.

Let \(f(u) = \cos(u)\) and \(g(x) = 3x-2\text{.}\) Find the derivative of

\begin{align*} F(x) &= f\big(g(x)\big) = \cos(3x-2). \end{align*}

Again we should approach this by first writing down \(f\) and \(g\) and their derivatives and then putting everything together as the chain rule tells us.

\begin{align*} f(u) &= \cos(u) & f'(u) &= -\sin(u)\\ g(x) &= 3x-2 & g'(x) &= 3 \end{align*}

So the chain rule says

\begin{align*} F'(x) &= f'\big(g(x)\big) \cdot g'(x)\\ &= -\sin\big( g(x) \big) \cdot 3\\ &= -3 \sin(3x-2) \end{align*}

This example shows a second way that the chain rule appears very frequently — when we need to differentiate some function of \(ax+b\text{.}\) More generally we have the following.

Let \(a,b \in \mathbb{R}\) and let \(f(x)\) be a differentiable function. Set \(g(x) = ax+b\text{.}\) Then

\begin{align*} \dfrac{d}{dx} f(ax+b) &= \dfrac{d}{dx} f\big(g(x)\big)\\ &= f'\big(g(x)\big) \cdot g'(x)\\ &= f'(ax+b) \cdot a \end{align*}

So the derivative of \(f(ax+b)\) with respect to \(x\) is just \(a f'(ax+b)\text{.}\)

The above is a very useful result that follows from the chain rule, so let's make it a corollary to highlight it.

Let \(a,b \in \mathbb{R}\) and let \(f(x)\) be a differentiable function, then

\begin{align*} \dfrac{d}{dx} f(ax+b) &= af'(ax+b). \end{align*}

Let us now go back to our motivating campfire example. There we had

\begin{align*} f(x) &= \text{ temperature at position $x$}\\ x(t) &= \text{ position at time $t$}\\ F(t) &= f(x(t)) = \text{ temperature at time $t$} \end{align*}

The chain rule gave

\begin{align*} F'(t) &= f'\big(x(t)\big) \cdot x'(t) \end{align*}

Notice that the units of measurement on both sides of the equation agree — as indeed they must. To see this, let us assume that \(t\) is measured in seconds, that \(x(t)\) is measured in metres and that \(f(x)\) is measured in degrees. Because of this \(F(x(t))\) must also be measured in degrees (since it is a temperature).

What about the derivatives? These are rates of change. So

- \(F'(t)\) has units \(\frac{\rm degrees}{\rm second}\text{,}\)
- \(f'(x)\) has units \(\frac{\rm degrees}{\rm metre}\text{,}\) and
- \(x'(t)\) has units \(\frac{\rm metre}{\rm second}\text{.}\)

Hence the product

\begin{align*} f'\big(x(t)\big) \cdot x'(t) & \text{ has units } = \frac{\rm degrees}{\rm metre} \cdot \frac{\rm metre}{\rm second} = \frac{\rm degrees}{\rm second}. \end{align*}

has the same units as \(F'(t)\text{.}\) So the units on both sides of the equation agree. Checking that the units on both sides of an equation agree is a good check of consistency, but of course it does not prove that both sides are in fact the same.

## (Optional) — Derivation of the Chain Rule

First, let's review what our goal is. We have been given a function \(g(x)\text{,}\) that is differentiable at some point \(x=a\text{,}\) and another function \(f(u)\text{,}\) that is differentiable at the point \(u=b = g(a)\text{.}\) We have defined the composite function \(F(x) = f\big(g(x)\big)\) and we wish to show that

\begin{align*} F'(a) &= f'\big(g(a)\big) \cdot g'(a) \end{align*}

Before we can compute \(F'(a)\text{,}\) we need to set up some ground work, and in particular the definitions of our given derivatives:

\begin{align*} f'(b) &= \lim_{H \to 0} \frac{f(b+H)-f(b)}{H} & \text{and }&& g'(a) &= \lim_{h \to 0} \frac{g(a+h)-g(a)}{h}. \end{align*}

We are going to use similar manipulation tricks as we did back in the proofs of the arithmetic of derivatives in Section 2.5. Unfortunately, we have already used up the symbols “\(F\)” and “\(H\)”, so we are going to make use the Greek letters \(\gamma, \varphi\text{.}\)

As was the case in our derivation of the product rule it is convenient to introduce a couple of new functions. Set

\begin{align*} \varphi(H) &= \frac{f(b+H)-f(b)}{H} \end{align*}

Then we have

\begin{align*} \lim_{H \to 0} \varphi(H) &= f'(b) = f'\big(g(a)\big) & \text{since } b=g(a), \end{align*}

and we can also write (with a little juggling)

\begin{align*} f(b+H) &= f(b) + H \varphi(H) \end{align*}

Similarly set

\begin{align*} \gamma(h) &= \frac{g(a+h)-g(a)}{h} \end{align*}

which gives us

\begin{align*} \lim_{h \to 0} \gamma(h) &= g'(a) & \text{ and } && g(a+h) &= g(a) + h \gamma(h). \end{align*}

Now we can start computing

\begin{align*} F'(a) &= \lim_{h \to 0} \frac{F(a+h)-F(a)}{h}\\ &= \lim_{h \to 0} \frac{f\big(g(a+h)\big)-f\big(g(a)\big)}{h} \end{align*}

We know that \(g(a) = b\) and \(g(a+h) = g(a) + h \gamma(h))\text{,}\) so

\begin{align*} F'(a) &= \lim_{h \to 0} \frac{f\big(g(a) + h\gamma(h) \big)-f\big(g(a)\big)}{h}\\ &= \lim_{h \to 0} \frac{f(b + h\gamma(h) )-f(b)}{h} \end{align*}

Now for the sneaky bit. We can turn \(f(b + h\gamma(h) )\) into \(f(b+H)\) by setting

\begin{gather*} H = h\gamma(h) \end{gather*}

Now notice that as \(h \to 0\) we have

\begin{align*} \lim_{h \to 0} H &= \lim_{h \to 0} h \cdot \gamma(h)\\ &= \lim_{h \to 0} h \cdot \lim_{h \to 0} \gamma(h)\\ &= 0 \cdot g'(a) = 0 \end{align*}

So as \(h\to 0\) we also have \(H \to 0\text{.}\)

We now have

\begin{align*} F'(a) &= \lim_{h \to 0} \frac{f\big(b + H\big)-f(b)}{h}\\ &= \lim_{h \to 0} \underbrace{\frac{f\big(b + H\big)-f(b)}{H}}_{= \varphi(H) } \cdot \underbrace{\frac{H}{h}}_{ = \gamma(h)} & \text{if } H= h \gamma(h) \ne 0\\ &= \lim_{h \to 0}\big( \varphi(H) \cdot \gamma(h) \big)\\ &= \lim_{h \to 0} \varphi(H) \cdot \lim_{h \to 0} \gamma(h) & \text{since $H\to0$ as $h\to 0$}\\ &= \lim_{H \to 0} \varphi(H) \cdot \lim_{h \to 0} \gamma(h) &= f'(b) \cdot g'(a) \end{align*}

This is exactly the RHS of the chain rule. It is possible to have \(H=0\) in the second line above. But that possibility is easy to deal with:

- If \(g'(a)\ne 0\text{,}\) then, since \(\lim_{h \to 0} \gamma(h) = g'(a)\text{,}\) \(H= h \gamma(h)\) cannot be \(0\) for small nonzero \(h\text{.}\) Technically, there is an \(h_0\gt 0\) such that \(H= h \gamma(h)\ne 0\) for all \(0 \lt |h| \lt h_0\text{.}\) In taking the limit \(h\to 0\text{,}\) above, we need only consider \(0 \lt |h| \lt h_0\) and so, in this case, the above computation is completely correct.
- If \(g'(a)=0\text{,}\) the above computation is still fine provided we exclude all \(h\)'s for which \(H= h \gamma(h)\ne 0\text{.}\) When \(g'(a)=0\text{,}\) the right hand side, \(f'\big(g(a)\big) \cdot g'(a)\text{,}\) of the chain rule is \(0\text{.}\) So the above computation gives
\[ \lim_{\genfrac{}{}{0pt}{}{h \to 0}{\gamma(h)\ne 0}} \frac{f\big(b + H\big)-f(b)}{h} =f'\big(g(a)\big) \cdot g'(a) = 0 \nonumber \]

On the other hand, when \(H=0\text{,}\) we have \(f\big(b + H\big)-f(b)=0\text{.}\) So\[ \lim_{\genfrac{}{}{0pt}{}{h \to 0}{\gamma(h) = 0}} \frac{f\big(b + H\big)-f(b)}{h} =0 \nonumber \]

too. That's all we need.

## Chain Rule Examples

We'll now use the chain rule to compute some more derivatives.

Find \(\dfrac{d}{dx}\big(1+3x\big)^{75}\text{.}\)

This is a concrete version of Example 2.9.8. We are to find the derivative of a function that is built up by first computing \(1+3x\) and then taking the \(75^{\rm th}\) power of the result. So we set

\begin{align*} f(u)&=u^{75} & f'(u)&=75 u^{74}\\ g(x)&=1+3x & g'(x)&=3\\ F(x)&=f\big(g(x)\big)=g(x)^{75}=\big(1+3x\big)^{75} \end{align*}

By the chain rule

\begin{align*} F'(x)&= f'\big(g(x)\big)\,g'(x) = 75\, g(x)^{74} \,g'(x) = 75\, \big(1+3x\big)^{74} \cdot 3\\ &= 225\, \big(1+3x\big)^{74} \end{align*}

Find \(\dfrac{d}{dx}\sin(x^2)\text{.}\)

In this example we are to compute the derivative of \(\sin\) with a (slightly) complicated argument. So we apply the chain rule with \(f\) being \(\sin\) and \(g(x)\) being the complicated argument. That is, we set

\begin{align*} f(u)&=\sin u & f'(u)&=\cos u\\ g(x)&=x^2 & g'(x)&=2x\\ F(x)&=f\big(g(x)\big)=\sin\big(g(x)\big)=\sin(x^2) \end{align*}

By the chain rule

\begin{align*} F'(x)&= f'\big(g(x)\big)\,g'(x) = \cos\big(g(x)\big) \,g'(x) = \cos(x^2) \cdot 2x\\ &= 2x\cos(x^2) \end{align*}

Find \(\dfrac{d}{dx}\root{3}\of{\sin(x^2)}\text{.}\)

In this example we are to compute the derivative of the cube root of a (moderately) complicated argument, namely \(\sin(x^2)\text{.}\) So we apply the chain rule with \(f\) being “cube root” and \(g(x)\) being the complicated argument. That is, we set

\begin{align*} f(u)&=\root{3}\of{u}=u^{\tfrac{1}{3}} & f'(u)&=\tfrac{1}{3}u^{-\tfrac{2}{3}}\\ g(x)&=\sin(x^2) & g'(x)&=2x\cos(x^2)\\ F(x)&=f\big(g(x)\big)=\root{3}\of{g(x)}=\root{3}\of{\sin(x^2)} \end{align*}

In computing \(g'(x)\) here, we have already used the chain rule once (in Example 2.9.12). By the chain rule

\begin{align*} F'(x)&= f'\big(g(x)\big)\,y'(x) = \tfrac{1}{3} g(x)^{-\tfrac{2}{3}} \cdot 2x\cos(x^2)\\ &= \frac{2x}{3}\,\frac{\cos(x^2)}{[\sin(x^2)]^{\frac{2}{3}}} \end{align*}

Find the derivative of \(\dfrac{d}{dx} f(g(h(x)))\text{.}\)

This is very similar to the previous example. Let us set \(F(x) = f(g(h(x)))\) with \(u=g(h(x))\) then the chain rule tells us

\begin{align*} \dfrac{dF}{dx} &= \dfrac{df}{du} \cdot \dfrac{du}{dx}\\ &= f'(g(h(x))) \cdot \dfrac{d}{dx} g(h(x))\\ \end{align*}

We now just apply the chain rule again

\begin{align*} &= f'(g(h(x))) \cdot g'(h(x)) \cdot h'(x). \end{align*}Indeed it is not too hard to generalise further (in the manner of Example 2.6.6 to find the derivative of the composition of 4 or more functions (though things start to become tedious to write down):

\begin{align*} \dfrac{d}{dx} f_1(f_2(f_3(f_4(x)))) &= f'_1(f_2(f_3(f_4(x)))) \cdot \dfrac{d}{dx} f_2(f_3(f_4(x)))\\ &= f'_1(f_2(f_3(f_4(x)))) \cdot f'_2(f_3(f_4(x))) \cdot \dfrac{d}{dx} f_3(f_4(x))\\ &= f'_1(f_2(f_3(f_4(x)))) \cdot f'_2(f_3(f_4(x))) \cdot f'_3(f_4(x)) \cdot f'_4(x) \end{align*}

We can also use the chain rule to recover Corollary 2.4.6 and from there we can use the product rule to recover the quotient rule.

We want to differentiate \(F(x) = \frac{1}{g(x)}\) so set \(f(u) = \frac{1}{u}\) and \(u=g(x)\text{.}\) Then the chain rule tells us

\begin{align*} \dfrac{d}{dx} \left\{\frac{1}{g(x)}\right\} = \dfrac{dF}{dx} &= \dfrac{df}{du} \cdot \dfrac{du}{dx}\\ &= \frac{-1}{u^2} \cdot g'(x)\\ &= -\frac{g'(x)}{g(x)^2}. \end{align*}

Once we know this, a quick application of the product rule will give us the quotient rule.

\begin{align*} &\dfrac{d}{dx} \left\{ \frac{f(x)}{g(x)} \right\} = \dfrac{d}{dx} \left\{ f(x) \cdot \frac{1}{g(x)} \right\} & \text{use PR}\\ &= f'(x)\cdot \frac{1}{g(x)} + f(x) \cdot \dfrac{d}{dx} \left\{\frac{1}{g(x)}\right\} & \text{use the result from above}\\ &= f'(x)\cdot \frac{1}{g(x)} - f(x) \cdot \frac{g'(x)}{g(x)^2} & \text{place over a common denominator}\\ &= \frac{f'(x) \cdot g(x) - f(x) \cdot g'(x)}{g(x)^2} \end{align*}

which is exactly the quotient rule.

Compute the following derivative:

\begin{gather*} \dfrac{d}{dx}\cos\left(\frac{x^5\sqrt{3+x^6}}{{(4+x^2)}^3}\right) \end{gather*}

This time we are to compute the derivative of \(\cos\) with a really complicated argument.

- So, to start, we apply the chain rule with \(g(x)=\frac{x^5\sqrt{3+x^6}}{{(4+x^2)}^3}\) being the really complicated argument and \(f\) being \(\cos\text{.}\) That is, \(f(u)=\cos(u)\text{.}\) Since \(f'(u)=-\sin(u)\text{,}\) the chain rule gives
\begin{gather*} \dfrac{d}{dx}\cos\bigg(\frac{x^5\sqrt{3+x^6}}{{(4+x^2)}^3}\,\bigg) =-\sin\bigg(\frac{x^5\sqrt{3+x^6}}{{(4+x^2)}^3}\,\bigg)\ \dfrac{d}{dx} \left\{\frac{x^5\sqrt{3+x^6}}{{(4+x^2)}^3} \right\} \end{gather*}

- This reduced our problem to that of computing the derivative of the really complicated argument \(\tfrac{x^5\sqrt{3+x^6}}(click for details)
`Callstack: at (Bookshelves/Calculus/CLP-1_Differential_Calculus_(Feldman_Rechnitzer_and_Yeager)/03:_Derivatives/3.09:_One_More_Tool__the_Chain_Rule), /content/body/div[3]/article[6]/div/ul/li[2]/span[1], line 1, column 5`

(click for details)\ {(4+x^2)}^{-3}\text{,}\) and then apply the product rule to reduce the problem to that of computing the derivatives of the three pieces.`Callstack: at (Bookshelves/Calculus/CLP-1_Differential_Calculus_(Feldman_Rechnitzer_and_Yeager)/03:_Derivatives/3.09:_One_More_Tool__the_Chain_Rule), /content/body/div[3]/article[6]/div/ul/li[2]/span[2], line 1, column 5`

- Here goes (recall Example 2.6.6):
\begin{align*} \dfrac{d}{dx}\big[x^5\,{(3+x^6)}^{\frac{1}{2}}\ {(4+x^2)}^{-3}\big] &=\dfrac{d}{dx}\big[x^5\big] \cdot {(3+x^6)}^{\frac{1}{2}}\cdot {(4+x^2)}^{-3}\\ &\phantom{=} +x^5\cdot \dfrac{d}{dx}\big[{(3+x^6)}^{\frac{1}{2}}\big] \cdot {(4+x^2)}^{-3}\\ &\phantom{=} +x^5\cdot {(3+x^6)}^{\frac{1}{2}}\cdot \dfrac{d}{dx}\big[{(4+x^2)}^{-3}\big] \end{align*}

This has reduced our problem to computing the derivatives of \(x^5\text{,}\) which is easy, and of \({(3+x^6)}^{\frac{1}{2}}\) and \({(4+x^2)}^{-3}\text{,}\) both of which can be done by the chain rule. Doing so,\begin{align*} \dfrac{d}{dx}\big[x^5\,{(3+x^6)}^{\frac{1}{2}}\ {(4+x^2)}^{-3}\big] &=\overbrace{\dfrac{d}{dx}\big[x^5\big]}^{5x^4} \cdot{(3+x^6)}^{\frac{1}{2}}\cdot {(4+x^2)}^{-3}\\ & \phantom{=}+x^5\cdot \overbrace{\dfrac{d}{dx}\big[{(3+x^6)}^{\frac{1}{2}}\big]}^ {\frac{1}{2}(3+x^6)^{-\frac{1}{2}}\cdot 6x^5} \cdot {(4+x^2)}^{-3}\\ &\phantom{=} +x^5\cdot{(3+x^6)}^{\frac{1}{2}}\cdot \overbrace{\dfrac{d}{dx}\big[{(4+x^2)}^{-3}\big]}^ {-3{(4+x^2)}^{-4}\cdot 2x} \end{align*}

- Now we can clean things up in a sneaky way by observing
- differentiating \(x^5\text{,}\) to get \(5x^4\text{,}\) is the same as multiplying \(x^5\) by \(\frac{5}{x}\text{,}\) and
- differentiating \({(3+x^6)}^{\frac{1}{2}}\) to get \(\frac{1}{2}(3+x^6)^{-\frac{1}{2}}\cdot 6x^5\) is the same as multiplying \({(3+x^6)}^{\frac{1}{2}}\) by \(\frac{3x^5}{3+x^6}\text{,}\) and
- differentiating \({(4+x^2)}^{-3}\) to get \(-3{(4+x^2)}^{-4}\cdot 2x\) is the same as multiplying \({(4+x^2)}^{-3}\) by \(-\frac{6x}{4+x^2}\text{.}\)

Using these sneaky tricks we can write our solution quite neatly:

\begin{align*} &\dfrac{d}{dx}\cos\bigg(\frac{x^5\sqrt{3+x^6}}

(click for details)`Callstack: at (Bookshelves/Calculus/CLP-1_Differential_Calculus_(Feldman_Rechnitzer_and_Yeager)/03:_Derivatives/3.09:_One_More_Tool__the_Chain_Rule), /content/body/div[3]/article[6]/div/ul/li[4]/p[2]/span[1], line 1, column 5`

(click for details){{(4+x^2)}^3}\ \bigg\{\frac{5}{x}+\frac{3x^5}{3+x^6}-\frac{6x}{4+x^2}\bigg\} \end{align*}`Callstack: at (Bookshelves/Calculus/CLP-1_Differential_Calculus_(Feldman_Rechnitzer_and_Yeager)/03:_Derivatives/3.09:_One_More_Tool__the_Chain_Rule), /content/body/div[3]/article[6]/div/ul/li[4]/p[2]/span[2], line 1, column 5`

- This method of cleaning up the derivative of a messy product is actually something more systematic in disguise — namely logarithmic differentiation. We will come to this later.

## Exercises

Stage 1

Suppose the amount of kelp in a harbour depends on the number of urchins. Urchins eat kelp: when there are more urchins, there is less kelp, and when there are fewer urchins, there is more kelp. Suppose further that the number of urchins in the harbour depends on the number of otters, who find urchins extremely tasty: the more otters there are, the fewer urchins there are.

Let \(O\text{,}\) \(U\text{,}\) and \(K\) be the populations of otters, urchins, and kelp, respectively.

- Is \(\dfrac{dK}{dU}\) positive or negative?
- Is \(\dfrac{dU}{dO}\) positive or negative?
- Is \(\dfrac{dK}{dO}\) positive or negative?

Remark: An urchin barren is an area where unchecked sea urchin grazing has decimated the kelp population, which in turn causes the other species that shelter in the kelp forests to leave. Introducing otters to urchin barrens is one intervention to increase biodiversity. A short video with a more complex view of otters and urchins in Canadian waters is available on YouTube: `https://youtu.be/ASJ82wyHisE`

Suppose \(A, B, C, D\) and \(E\) are functions describing an interrelated system, with the following signs: \(\dfrac{dA}{dB} \gt 0\text{,}\) \(\dfrac{dB}{dC} \gt 0\text{,}\) \(\dfrac{dC}{dD} \lt 0\text{,}\) and \(\dfrac{dD}{dE} \gt 0\text{.}\) Is \(\dfrac{dA}{dE}\) positive or negative?

Stage 2

Evaluate the derivative of \(f(x)=\cos(5x+3)\text{.}\)

Evaluate the derivative of \(f(x)=\left({x^2+2}\right)^5\text{.}\)

Evaluate the derivative of \(T(k)=\left({4k^4+2k^2+1}\right)^{17}\text{.}\)

Evaluate the derivative of \(f(x)=\sqrt{\dfrac{x^2+1}{x^2-1}}\text{.}\)

Evaluate the derivative of \(f(x)=e^{\cos(x^2)}\text{.}\)

Evaluate \(f'(2)\) if \(f(x) = g\big(x/h(x)\big)\text{,}\) \(h(2) = 2\text{,}\) \(h'(2) = 3\text{,}\) \(g'(1) = 4\text{.}\)

Find the derivative of \(e^{x\cos(x)}\text{.}\)

Evaluate \(f'(x)\) if \(f(x) = e^{x^2+\cos x}\text{.}\)

Evaluate \(f'(x)\) if \(f(x) = \sqrt{\dfrac{x-1}{x+2}}\text{.}\)

Differentiate the function

\[ f(x)=\frac{1}{x^2}+\sqrt{x^2-1} \nonumber \]

and give the domain where the derivative exists.

Evaluate the derivative of \(f(x)=\dfrac{\sin 5x}{1+x^2}\)

Evaluate the derivative of \(f(x)=\sec(e^{2x+7})\text{.}\)

Find the tangent line to the curve \(y=\left(\tan^2 x +1\right)\left(\cos^2 x\right)\) at the point \(x=\dfrac{\pi}{4}\text{.}\)

The position of a particle at time \(t\) is given by \(s(t)=e^{t^3-7t^2+8t}\text{.}\) For which values of \(t\) is the velocity of the particle zero?

What is the slope of the tangent line to the curve \(y=\tan\left(e^{x^2}\right)\) at the point \(x=1\text{?}\)

Differentiate \(y=e^{4x}\tan x\text{.}\) You do not need to simplify your answer.

Evaluate the derivative of the following function at \(x=1\text{:}\) \(f(x)=\dfrac{x^3}{1+e^{3x}}\text{.}\)

Differentiate \(e^{\sin^2(x)}\text{.}\)

Compute the derivative of \(y=\sin\left(e^{5x}\right)\)

Find the derivative of \(e^{\cos(x^2)}\text{.}\)

Compute the derivative of \(y=\cos\big(x^2+\sqrt{x^2+1}\big)\)

Evaluate the derivative.

\[ y=(1+x^2)\cos^2 x \nonumber \]

Evaluate the derivative.

\[ y=\frac{e^{3x}}{1+x^2} \nonumber \]

Find \(g'(2)\) if \(g(x)=x^3h(x^2)\text{,}\) where \(h(4)=2\) and \(h'(4)=-2\text{.}\)

At what points \((x,y)\) does the curve \(y=xe^{-(x^2-1)/2}\) have a horizontal tangent?

A particle starts moving at time \(t=1\text{,}\) and its position thereafter is given by

\[ s(t)=\sin\left(\frac{1}{t}\right). \nonumber \]

When is the particle moving in the negative direction?

Compute the derivative of \(f(x)=\dfrac{e^{x}}{\cos^3 (5x-7)}\text{.}\)

Evaluate \(\displaystyle \dfrac{d}{dx}\left\{x e^{2x} \cos 4x\right\}\text{.}\)

Stage 3

A particle moves along the Cartesian plane from time \(t=-\pi/2\) to time \(t=\pi/2\text{.}\) The \(x\)-coordinate of the particle at time \(t\) is given by \(x=\cos t\text{,}\) and the \(y\)-coordinate is given by \(y=\sin t\text{,}\) so the particle traces a curve in the plane. When does the tangent line to that curve have slope \(-1\text{?}\)

Show that, for all \(x \gt 0\text{,}\) \(e^{x+x^2} \gt 1+x\text{.}\)

We know that \(\sin (2x) = 2\sin x \cos x\text{.}\) What other trig identity can you derive from this, using differentiation?

Evaluate the derivative of \(f(x)=\sqrt[3]{\dfrac{e^{\csc x^2}}{ \sqrt{x^3-9} \tan x }}\text{.}\) You do not have to simplify your answer.

Suppose a particle is moving in the Cartesian plane over time. For any real number \(t \geq 0\text{,}\) the coordinate of the particle at time \(t\) is given by \((\sin t, \cos^2 t)\text{.}\)

- Sketch a graph of the curve traced by the particle in the plane by plotting points, and describe how the particle moves along it over time.
- What is the slope of the curve traced by the particle at time \(t=\dfrac{10\pi}{3}\text{?}\)