## Chain Rule: Problems and Solutions

### Chain Rule: Problems and Solutions

Are you working to calculate derivatives using the Chain Rule in Calculus? Let’s solve some common problems step-by-step so you can learn to solve them routinely for yourself.

Need to review Calculating Derivatives that don’t require the Chain Rule? That material is here.

Want to skip the Summary? Jump down to problems and their solutions.

For instance, $\left(x^2+1\right)^7$ is comprised of the inner function $x^2 + 1$ inside the outer function $(\boxed{\phantom{\cdots}})^7.$

As another example, $e^{\sin x}$ is comprised of the inner function $\sin x$ inside the outer function $e^{\boxed{\phantom{\cdots}}}.$

As yet another example, $\ln{(t^3 – 2t^2 +5)}$ is comprised of the inner function $t^3 – 2t^2 +5$ inside the outer function $\ln(\boxed{\phantom{\cdots}}).$

Since each of these functions is comprised of one function inside of another function — known as a **composite function** — we must use the Chain rule to find its derivative, as shown in the problems below.

**How can I tell what the inner and outer functions are?**

Here’s a foolproof method: Imagine calculating the value of the function for a particular value of $x$ and identify the steps you would take, because you’ll always automatically start with the inner function and work your way out to the outer function.

For example, imagine computing $\left(x^2+1\right)^7$ for $x=3.$ Without thinking about it, you would *first* calculate $x^2 + 1$ (which equals $3^2 +1 =10$), so that’s the inner function, guaranteed. *Then* you would next calculate $10^7,$ and so $(\boxed{\phantom{\cdots}})^7$ is the outer function.

This imaginary computational process works every time to identify correctly what the inner and outer functions are.

### Chain Rule

Consider a composite function whose outer function is $f(x)$ and whose inner function is $g(x).$ The composite function is thus $f(g(x)).$ Its derivative is given by:

\[\bbox[yellow,8px]{ \begin{align*}\left[ f\Big(g(x)\Big)\right]’ &= f’\Big(g(x)\Big) \cdot g'(x) \\[5px]&=\text{[derivative of the outer function, evaluated at the inner function] } \\[5px]&\qquad \times \text{ [derivative of the inner function]}

\end{align*}}\]

Alternatively, if we write $y = f(u)$ and $u = g(x),$ then

\[\bbox[yellow,8px]{\dfrac{dy}{dx} = \dfrac{dy}{du} \cdot \dfrac{du}{dx} }\]

Informally:

\[ \bbox[10px,border:2px solid blue]{\dfrac{df}{dx} = \left[\dfrac{df}{d\text{(stuff)}}\text{, with the same stuff inside} \right] \times \dfrac{d}{dx}\text{(stuff)} }\] Even though few people admit it, almost everyone thinks along the lines of the informal approach in the blue boxes above. We’ll illustrate in the problems below.

**Chain Rule Example #1**

Differentiate $f(x) = (x^2 + 1)^7$.

*Solutions.*

We’ll solve this using three different approaches — but we encourage you to become comfortable with the third approach as quickly as possible, because that’s the one you’ll use to compute derivatives *quickly* as the course progresses.

• *Solution 1*.

Let’s use the first form of the Chain rule above:

\[\bbox[10px,border:2px dashed blue]{\begin{align*}\left[ f\Big(g(x)\Big)\right]’ &= f’\Big(g(x)\Big) \cdot g'(x) \\[5px]&=\text{[derivative of the outer function, evaluated at the inner function] } \\[5px]&\qquad \times \text{ [derivative of the inner function]}

\end{align*}}\]
We have the outer function $f(u) = u^7$ and the inner function $u = g(x) = x^2 +1.$

Then $f'(u) = 7u^6,$ and $g'(x) = 2x.$ Then

\begin{align*}

f'(x) &= 7u^6 \cdot 2x \\[8px]
&= 7(x^2+1)^6 \cdot 2x \quad \cmark

\end{align*}

We could of course simplify the result algebraically to $14x(x^2+1)^2,$ but we’re leaving the result as written to emphasize the Chain rule term $2x$ at the end.

• *Solution 2*.

Let’s use the second form of the Chain rule above:

\[\bbox[10px,border:2px dashed blue]{\dfrac{dy}{dx} = \dfrac{dy}{du} \cdot \dfrac{du}{dx} }\]
We have $y = u^7$ and $u = x^2 +1.$

Then $\dfrac{dy}{du} = 7u^6,$ and $\dfrac{du}{dx} = 2x.$ Hence

\begin{align*}

\dfrac{dy}{dx} &= 7u^6 \cdot 2x \\[8px]
&= 7(x^2+1)^6 \cdot 2x \quad \cmark

\end{align*}

• *Solution 3*.

With some experience, you won’t introduce a new variable like $u = \cdots$ as we did above.

Instead, you’ll think something like: “The function is a bunch of stuff to the 7th power. So the derivative is 7 times that same stuff to the 6th power, times the derivative of that stuff.”

\[ \bbox[10px,border:2px dashed blue]{\dfrac{df}{dx} = \left[\dfrac{df}{d\text{(stuff)}}\text{, with the same stuff inside} \right] \times \dfrac{d}{dx}\text{(stuff)}}\]
\begin{align*}

f(x) &= (\text{stuff})^7; \quad \text{stuff} = x^2 + 1 \\[12px]
\text{Then}\phantom{f(x)= }\\

\frac{df}{dx} &= 7(\text{stuff})^6 \cdot \left(\frac{d}{dx}(x^2 + 1)\right) \\[8px]
&= 7(x^2 + 1)^6 \cdot (2x) \quad \cmark

\end{align*}

*Note:* You’d never actually write “stuff = ….” Instead just hold in your head what that “stuff” is, and proceed to write down the required derivatives.

There are lots more completely solved example problems below!

\text{If} && f(x) &= (\text{stuff})^n, \\[8px] \text{then} &&\dfrac{df}{dx} &= n(\text{that stuff})^{n-1} \cdot \dfrac{d}{dx}(\text{that stuff})

\end{align*}

You’ll usually see this written as

$$\dfrac{d}{dx}\left(u^n \right) = n u^{n-1} \cdot \dfrac{du}{dx}$$

The following five problems illustrate.

*Solution 1 (quick, the way most people reason)*.

Think something like: “The function is some stuff to the eighth-power. So the derivative is eight times that same stuff to the seventh power, times the derivative of that stuff.”

\[ \bbox[10px,border:2px dashed blue]{\dfrac{df}{dx} = \left[\dfrac{df}{d\text{(stuff)}}\text{, with the same stuff inside} \right] \times \dfrac{d}{dx}\text{(stuff)}}\] \begin{align*}

f(x) &= (\text{stuff})^8; \quad \text{stuff} = 3x^2 – 4x + 5 \\[12px] \text{Then}\phantom{f(x)= }\\

\dfrac{df}{dx} &= 8(\text{stuff})^7 \cdot \dfrac{d}{dx}\left(3x^2 – 4x + 5\right) \\[8px] &= 8\left(3x^2 – 4x + 5\right)^7 \cdot (6x -4)\quad \cmark \\[8px] \end{align*}

*Note:*You’d never actually write out “stuff = ….” Instead just hold in your head what that “stuff” is, and proceed to write down the required derivatives.

*Solution 2 (more formal)*.

Let’s use the first form of the Chain rule above:

\[\bbox[10px,border:2px dashed blue]{\begin{align*}\left[ f\Big(g(x)\Big)\right]’ &= f’\Big(g(x)\Big) \cdot g'(x) \\[5px]&=\text{[derivative of the outer function, evaluated at the inner function] } \\[5px]&\qquad \times \text{ [derivative of the inner function]}

\end{align*}}\]
We have the outer function $f(u) = u^8$ and the inner function $u = g(x) = 3x^2 – 4x + 5.$

Then $f'(u) = 8u^7,$ and $g'(x) = 6x -4.$ Hence

\begin{align*}

f'(x) &= 8u^7 \cdot (6x – 4) \\[8px]
&= 8\left(3x^2 – 4x + 5\right)^7 \cdot (6x-4) \quad \cmark

\end{align*}

*Hint:*Recall $\tan^3 x = \big[\tan x\big]^3.$ Also recall that $\dfrac{d}{dx}\tan x = \sec^2 x.$

*Solution 1 (quick, the way most people reason)*.

Think something like: “The function is some stuff to the power of 3. So the derivative is 3 times that same stuff to the power of 2, times the derivative of that stuff.”

\[ \bbox[10px,border:2px dashed blue]{\dfrac{df}{dx} = \left[\dfrac{df}{d\text{(stuff)}}\text{, with the same stuff inside} \right] \times \dfrac{d}{dx}\text{(stuff)}}\]
\begin{align*}

f(x) &= \big[\text{stuff}\big]^3; \quad \text{stuff} = \tan x \\[12px]
\text{Then}\phantom{f(x)= }\\

\dfrac{df}{dx} &= 3\big[\text{stuff}\big]^2 \cdot \dfrac{d}{dx}(\tan x) \\[8px]
&= 3\big[\tan x\big]^2 \cdot \sec^2 x \\[8px]
&= 3\tan^2 x \cdot \sec^2 x \quad \cmark \\[8px]
\end{align*}

*Note:* You’d never actually write out “stuff = ….” Instead just hold in your head what that “stuff” is, and proceed to write down the required derivatives.

*Solution 2 (more formal) *.

Let’s use the first form of the Chain rule above:

\[\bbox[10px,border:2px dashed blue]{\begin{align*}\left[ f\Big(g(x)\Big)\right]’ &= f’\Big(g(x)\Big) \cdot g'(x) \\[5px]&=\text{[derivative of the outer function, evaluated at the inner function] } \\[5px]&\qquad \times \text{ [derivative of the inner function]}

\end{align*}}\]
We have the outer function $f(u) = u^3$ and the inner function $u = g(x) = \tan x.$

Then $f'(u) = 3u^2,$ and $g'(x) = \sec^2 x.$ (Recall that $(\tan x)’ = \sec^2 x.$)

Hence

\begin{align*}

f'(x) &= 3u^2 \cdot (\sec^2 x) \\[8px]
&= 3\big[\tan x\big]^2 \cdot \sec^2 x \\[8px]
&= 3\tan^2 x \cdot \sec^2 x \quad \cmark \\[8px]
\end{align*}

*Solution 1 (quick, the way most people reason)*.

Think something like: “The function is some stuff to the $-2$ power. So the derivative is $-2$ times that same stuff to the $-3$ power, times the derivative of that stuff.”

\[ \bbox[10px,border:2px dashed blue]{\dfrac{df}{dx} = \left[\dfrac{df}{d\text{(stuff)}}\text{, with the same stuff inside} \right] \times \dfrac{d}{dx}\text{(stuff)}}\]
\begin{align*}

f(x) &= (\text{stuff})^{-2}; \quad \text{stuff} = \cos x – \sin x \\[12px]
\text{Then}\phantom{f(x)= }\\

\dfrac{df}{dx} &= -2(\text{stuff})^{-3} \cdot \dfrac{d}{dx}(\cos x – \sin x) \\[8px]
&= -2(\cos x – \sin x)^{-3} \cdot (-\sin x – \cos x)\quad \cmark \\[8px]
\end{align*}

We could simplify the answer by factoring out the negative signs from the last term, but we prefer to stop there to keep the focus on the Chain rule.

*Note:* You’d never actually write out “stuff = ….” Instead just hold in your head what that “stuff” is, and proceed to write down the required derivatives.

*Solution 2 (more formal)*.

Let’s use the first form of the Chain rule above:

\[\bbox[10px,border:2px dashed blue]{\begin{align*}\left[ f\Big(g(x)\Big)\right]’ &= f’\Big(g(x)\Big) \cdot g'(x) \\[5px]&=\text{[derivative of the outer function, evaluated at the inner function] } \\[5px]&\qquad \times \text{ [derivative of the inner function]}

\end{align*}}\]
We have the outer function $f(u) = u^{-2}$ and the inner function $u = g(x) = \cos x – \sin x.$

Then $f'(u) = -2u^{-3},$ and $g'(x) = -\sin x – \cos x.$ (Recall that $(\cos x)’ = -\sin x,$ and $(\sin x)’ = \cos x.$)

Hence

\begin{align*}

f'(x) &= -2u^{-3} \cdot (-\sin x – \cos x) \\[8px]
&= -2(\cos x – \sin x)^{-3} \cdot (-\sin x – \cos x) \quad \cmark

\end{align*}

We could simplify the answer by factoring out the negative signs from the last term, but we prefer to stop there to keep the focus on the Chain rule.

*Solution 1 (quick, the way most people reason)*.

Think something like: “The function is some stuff to the 99th power. So the derivative is 99 times that same stuff to the 98th power, times the derivative of that stuff.”

\[ \bbox[10px,border:2px dashed blue]{\dfrac{df}{dx} = \left[\dfrac{df}{d\text{(stuff)}}\text{, with the same stuff inside} \right] \times \dfrac{d}{dx}\text{(stuff)}}\] \begin{align*}

f(x) &= (\text{stuff})^{99}; \quad \text{stuff} = x^5 + e^x \\[12px] \text{Then}\phantom{f(x)= }\\

\dfrac{df}{dx} &= 99(\text{stuff})^{98} \cdot \dfrac{d}{dx}\left(x^5 + e^x \right) \\[8px] &= 99\left(x^5 + e^x \right)^{98} \cdot (5x^4 + e^x)\quad \cmark \\[8px] \end{align*}

*Note:*You’d never actually write out “stuff = ….” Instead just hold in your head what that “stuff” is, and proceed to write down the required derivatives.

*Solution 2 (more formal)*.

Let’s use the first form of the Chain rule above:

\[\bbox[10px,border:2px dashed blue]{\begin{align*}\left[ f\Big(g(x)\Big)\right]’ &= f’\Big(g(x)\Big) \cdot g'(x) \\[5px]&=\text{[derivative of the outer function, evaluated at the inner function] } \\[5px]&\qquad \times \text{ [derivative of the inner function]}

\end{align*}}\]
We have the outer function $f(u) = u^{99}$ and the inner function $u = g(x) = x^5 + e^x.$

Then $f'(u) = 99u^{98},$ and $g'(x) = 5x^4 + e^x.$

Hence

\begin{align*}

f'(x) &= 99u^{98} \cdot (5x^4 + e^x) \\[8px]
&= 99\left(x^5 + e^x\right)^{98} \cdot \left(5x^4 + e^x\right) \quad \cmark

\end{align*}

*Solution 1*.

Think something like: “The function is $\sqrt{\text{stuff}}$. So the derivative is $\dfrac{1}{2}\dfrac{1}{\sqrt{\text{that same stuff}}}$, times the derivative of that stuff.”

\begin{align*}

\dfrac{d}{du}\left(\sqrt{u} \right) &= \dfrac{d}{du}\left(u^{\frac{1}{2}} \right) \\[8px] &= \frac{1}{2}u^{\left(\frac{1}{2} – 1 \right)} \\[8px] &= \frac{1}{2}u^{-1/2} \\[8px] &= \frac{1}{2}\frac{1}{\sqrt{u}}

\end{align*}

And let’s show $\left(x^2 + 1 \right)’ = 2x:$

\[ \begin{align*}

\dfrac{d}{dx}\left(x^2 + 1 \right) &= \dfrac{d}{dx}\left( x^2\right) + \cancelto{0}{\dfrac{d}{dx}(1)} \\[8px] &= 2x^1 \\[8px] &= 2x

\end{align*} \]

f(x) &= \sqrt{\text{stuff}}; \quad \text{stuff} = x^2 + 1 \\[12px] \text{Then}\phantom{f(x)= }\\

\dfrac{df}{dx} &= \frac{1}{2}\frac{1}{\sqrt{\text{stuff}}} \cdot \left(\frac{d}{dx}(\text{stuff})\right) \\[8px] &= \frac{1}{2}\frac{1}{\sqrt{{x^2 + 1}}}\cdot ( 2x ) \quad \cmark

\end{align*}

We could of course cancel the 2’s, but we’re leaving the result as-is so you can easily see how we applied the Chain rule.

*Solution 2*.

Let’s use the first form of the Chain rule above:

\[\bbox[10px,border:2px dashed blue]{\begin{align*}\left[ f\Big(g(x)\Big)\right]’ &= f’\Big(g(x)\Big) \cdot g'(x) \\[5px]&=\text{[derivative of the outer function, evaluated at the inner function] } \\[5px]&\qquad \times \text{ [derivative of the inner function]}

\end{align*}}\]
We have the outer function $f(u) = \sqrt{u}$ and the inner function $u = g(x) = x^2 + 1.$

Then $\left(\sqrt{u} \right)’ = \dfrac{1}{2}\dfrac{1}{ \sqrt{u}},$ and $\left(x^2 + 1 \right)’ = 2x.$

Hence

\begin{align*}

f'(x) &= \dfrac{1}{2}\dfrac{1}{ \sqrt{u}} \cdot 2x \\[8px]
&= \dfrac{1}{2}\dfrac{1}{ \sqrt{x^2+1}} \cdot 2x \quad \cmark

\end{align*}

\text{If} && f(x) &= e^{\text{(stuff)}}, \\[8px] \text{then} &&\dfrac{df}{dx} &= e^{\text{(that stuff)}}\cdot \dfrac{d}{dx}(\text{that stuff})

\end{align*}

You’ll usually see this written as

$$\dfrac{d}{dx}e^u = e^u \cdot \dfrac{du}{dx}$$

The next two problems illustrate.

*Solution 1 (quick, the way most people reason)*.

Think something like: “The function is $e$ to the power of some stuff. So the derivative is $e$ to the power of exactly the same stuff, times the derivative of that stuff.”

\[ \bbox[10px,border:2px dashed blue]{\dfrac{df}{dx} = \left[\dfrac{df}{d\text{(stuff)}}\text{, with the same stuff inside} \right] \times \dfrac{d}{dx}\text{(stuff)}}\] \begin{align*}

f(x) &= e^{\text{stuff}}; \quad \text{stuff} = \sin x \\[12px] \text{Then}\phantom{f(x)= }\\

\dfrac{df}{dx} &= \left(e^{\text{stuff}} \right) \left(\dfrac{d}{dx}\text{(stuff)} \right) \\[8px] &= e^{\sin x} \cos x \quad \cmark \\[8px] \end{align*}

*Note:*You’d never actually write out “stuff = ….” Instead just hold in your head what that “stuff” is, and proceed to write down the required derivatives.

*Solution 2 (more formal)*.

Let’s use the first form of the Chain rule above:

\[\bbox[10px,border:2px dashed blue]{\begin{align*}\left[ f\Big(g(x)\Big)\right]’ &= f’\Big(g(x)\Big) \cdot g'(x) \\[5px]&=\text{[derivative of the outer function, evaluated at the inner function] } \\[5px]&\qquad \times \text{ [derivative of the inner function]}

\end{align*}}\]
We have the outer function $f(u) = e^u$ and the inner function $u = g(x) = \sin x.$

Then $f'(u) = e^u,$ and $g'(x) = \cos x.$ Hence

\begin{align*}

f'(x) &= e^u \cdot \cos x \\[8px]
&= e^{\sin x} \cdot \cos x \quad \cmark

\end{align*}

*Solution 1 (quick, the way most people reason)*.

Think something like: “The function is $e$ to the power of some stuff. So the derivative is $e$ to the power of exactly the same stuff, times the derivative of that stuff.”

\[ \bbox[10px,border:2px dashed blue]{\dfrac{df}{dx} = \left[\dfrac{df}{d\text{(stuff)}}\text{, with the same stuff inside} \right] \times \dfrac{d}{dx}\text{(stuff)}}\] \begin{align*}

f(x) &= e^{\text{stuff}}; \quad \text{stuff} = x^7 – 4x^3 + x \\[12px] \text{Then}\phantom{f(x)= }\\

\dfrac{df}{dx} &= \left(e^{\text{stuff}} \right) \cdot \dfrac{d}{dx}\left(x^7 – 4x^3 + x \right) \\[8px] &= e^{\left(x^7 – 4x^3 + x \right)} \cdot \left(7x^6 – 12x^2 + 1 \right) \quad \cmark \\[8px] \end{align*}

*Note:*You’d never actually write out “stuff = ….” Instead just hold in your head what that “stuff” is, and proceed to write down the required derivatives.

*Solution 2 (more formal)*.

Let’s use the first form of the Chain rule above:

\[\bbox[10px,border:2px dashed blue]{\begin{align*}\left[ f\Big(g(x)\Big)\right]’ &= f’\Big(g(x)\Big) \cdot g'(x) \\[5px]&=\text{[derivative of the outer function, evaluated at the inner function] } \\[5px]&\qquad \times \text{ [derivative of the inner function]}

\end{align*}}\]
We have the outer function $f(u) = e^u$ and the inner function $u = g(x) = x^7 – 4x^3 + x.$

Then $f'(u) = e^u,$ and $g'(x) = 7x^6 -12x^2 +1.$ Hence

\begin{align*}

f'(x) &= e^u \cdot \left(7x^6 -12x^2 +1 \right)\\[8px]
&= e^{\sin x} \cdot \left(7x^6 -12x^2 +1 \right) \quad \cmark

\end{align*}

\text{If} && f(x) &= \sin\text{(stuff)}, \\[8px] \text{then} &&\dfrac{df}{dx} &= \cos\text{(that stuff)}\cdot \dfrac{d}{dx}(\text{that stuff})

\end{align*}

You’ll usually see this written as

$$\dfrac{d}{dx}\sin u = \cos u \cdot \dfrac{du}{dx}$$

$$ — $$

\begin{align*}

\text{If} && f(x) &= \cos\text{(stuff)}, \\[8px] \text{then} &&\dfrac{df}{dx} &= -\sin\text{(that stuff)}\cdot \dfrac{d}{dx}(\text{that stuff})

\end{align*}

You’ll usually see this written as

$$\dfrac{d}{dx}\cos u = -\sin u \cdot \dfrac{du}{dx}$$

$$ — $$

\begin{align*}

\text{If} && f(x) &= \tan\text{(stuff)}, \\[8px] \text{then} &&\dfrac{df}{dx} &= \sec^2\text{(that stuff)}\cdot \dfrac{d}{dx}(\text{that stuff})

\end{align*}

You’ll usually see this written as

$$\dfrac{d}{dx}\tan u = \sec^2 u \cdot \dfrac{du}{dx}$$

The next two problems illustrate.

*Solution 1 (quick, the way most people reason)*.

Think something like: “The function is sin(of some stuff). So the derivative is cos(of that same stuff), times the derivative of that stuff.”

\[ \bbox[10px,border:2px dashed blue]{\dfrac{df}{dx} = \left[\dfrac{df}{d\text{(stuff)}}\text{, with the same stuff inside} \right] \times \dfrac{d}{dx}\text{(stuff)}}\] \begin{align*}

f(x) &= \sin(\text{stuff}); \quad \text{stuff} = 2x \\[12px] \text{Then}\phantom{f(x)= }\\

\dfrac{df}{dx} &= \cos(\text{stuff}) \left(\dfrac{d}{dx}(\text{stuff}) \right) \\[4px] &= \cos(2x) \cdot(2) \quad \cmark

\end{align*}

*Solution 2 (more formal)*.

Let’s use the first form of the Chain rule above:

\[\bbox[10px,border:2px dashed blue]{\begin{align*}\left[ f\Big(g(x)\Big)\right]’ &= f’\Big(g(x)\Big) \cdot g'(x) \\[5px]&=\text{[derivative of the outer function, evaluated at the inner function] } \\[5px]&\qquad \times \text{ [derivative of the inner function]}

\end{align*}}\]
We have the outer function $f(u) = \sin u$ and the inner function $u = g(x) = 2x.$

Then $f'(u) = \cos u,$ and $g'(x) = 2.$ Hence

\begin{align*}

f'(x) &= \cos u \cdot 2 \\[8px]
&= \cos(2x) \cdot 2 \quad \cmark

\end{align*}

*Solution 1*.

Think something like: “The function is tan(of some stuff). So the derivative is $\sec^2 \text{(of that same stuff)}$, times the derivative of that stuff.”

\[ \bbox[10px,border:2px dashed blue]{\dfrac{df}{dx} = \left[\dfrac{df}{d\text{(stuff)}}\text{, with the same stuff inside} \right] \times \dfrac{d}{dx}\text{(stuff)}}\] \begin{align*}

f(x) &= \tan(\text{stuff}); \quad \text{stuff} = e^x \\[12px] \text{Then}\phantom{f(x)= }\\

\dfrac{df}{dx} &= \sec^2(\text{stuff}) \left(\dfrac{d}{dx}(\text{stuff}) \right) \\[4px] &= \sec^2(e^x) \cdot e^x \quad \cmark

\end{align*}

*Solution 2*.

Let’s use the first form of the Chain rule above:

\[\bbox[10px,border:2px dashed blue]{\begin{align*}\left[ f\Big(g(x)\Big)\right]’ &= f’\Big(g(x)\Big) \cdot g'(x) \\[5px]&=\text{[derivative of the outer function, evaluated at the inner function] } \\[5px]&\qquad \times \text{ [derivative of the inner function]}

\end{align*}}\]
We have the outer function $f(u) = \tan u$ and the inner function $u = g(x) = e^x.$

Then $f'(u) = \sec^2 u,$ and $g'(x) = e^x.$ Hence

\begin{align*}

f'(x) &= \sec^2 u \cdot e^x \\[8px]
&= \sec^2(e^x) \cdot e^x \quad \cmark

\end{align*}

*This problem combines the Product Rule with the Chain Rule.*

Differentiate $f(x) = \left(x^2 + 1 \right)^7 (3x – 7)^4.$

$$\left[ \left(x^2 + 1 \right)^7\right]’ = 7\left(x^2 + 1 \right)^6 \cdot (2x) $$

\begin{align*}

f(x) &= (\text{stuff})^7; \quad \text{stuff} = x^2 + 1 \\[12px] \text{Then}\phantom{f(x)= }\\

f'(x) &= 7(\text{stuff})^6 \cdot (x^2 + 1)’ \\[8px] &= 7(x^2 + 1)^6 \cdot (2x)

\end{align*}

Now let’s use the Product Rule:

\[ \begin{align*}

(f g)’ &= \qquad f’ g\qquad\qquad +\qquad\qquad fg’ \\[8px]
\left[\left(x^2 + 1 \right)^7 (3x – 7)^4 \right]’ &= \left[ \left(x^2 + 1 \right)^7\right]’ (3x – 7)^4\, + \,\left(x^2 + 1 \right)^7 \left[(3x – 7)^4 \right]’ \\[8px]
&= \left[7\left(x^2 + 1 \right)^6 \cdot (2x) \right](3x – 7)^4 + \left(x^2 + 1 \right)^7 \left[4(3x – 7)^3 \cdot (3) \right] \quad \cmark

\end{align*} \]
—–

We could of course simplify this expression algebraically:

$$f'(x) = 14x\left(x^2 + 1 \right)^6 (3x – 7)^4 + 12 \left(x^2 + 1 \right)^7 (3x – 7)^3 $$

We instead stopped where we did above to emphasize the way we’ve developed the result, which is what matters most here. (You don’t need us to show you how to do algebra!)

*This problem requires using the Chain Rule twice.*

Differentiate $f(x) = \cos(\tan(3x)).$

*Solution 1 (quick, the way most people reason).*

Think something like:

The overall function is $\cos(\tan(3x)).$

The outermost function is thus $\cos(\overbrace{\text{of some stuff A}}^{\tan(3x)}),$ and so the first part of the derivative is $-\sin(\text{of that exact same stuff A}).$ Hence we first write

$$f'(x) = -\sin(\tan(3x)) \times \cdots$$

Next, the first inside function is $\tan(\overbrace{\text{of some different stuff B}}^{3x}),$ and since the derivative of $\tan$ is $\sec^2,$ the next part of the derivative is $\sec^2(\text{of that exact same stuff B})$:

$$f'(x) = -\sin(\tan(3x)) \cdot \sec^2(3x) \times \cdots$$

Finally the second inside function is $3x,$ and its derivative is $3$ and so to finish we multiply by that:

$$f'(x) = -\sin(\tan(3x)) \cdot \sec^2(3x) \cdot 3 \quad \cmark$$

And you’re done! (Or as they say in some parts of the world, “And Bob’s your uncle!”)

*Solution 2 (more formal).*

Although it’s tedious to write out each separate function, let’s use an extension of the first form of the Chain rule above, now applied to $f\Bigg(g\Big(h(x)\Big)\Bigg)$:

\[\bbox[10px,border:2px dashed blue]{\begin{align*}\left[ f\Bigg(g\Big(h(x)\Big)\Bigg) \right]’ &= f’\Bigg(g\Big(h(x)\Big)\Bigg) \cdot g’\Big(h(x)\Big) \cdot h'(x) \\[5px]&=\text{[derivative of the outer function, evaluated at the middle function] } \\[5px]&\qquad \times \text{ [derivative of the middle function, evaluated at the inner function]} \\[5px]&\qquad \quad \times \text{ [derivative of the inner function]}\end{align*}}\]
We have the outer function $f(z) = \cos z,$ and the middle function $z = g(u) = \tan(u),$ and the inner function $u = h(x) = 3x.$

Then $f'(z) = -\sin z,$ and $g'(u) = \sec^2 u,$ and $h'(x) = 3.$ Hence:

\begin{align*}

f'(x) &= (-\sin z) \cdot (\sec^2 u) \cdot (3) \\[8px]
&= -\sin(\tan(3x)) \cdot \sec^2 (3x) \cdot 3 \quad \cmark

\end{align*}

*This problem requires using the Chain Rule three times.*

Differentiate $f(x) = \left(1 + \sin^9(2x + 3) \right)^2.$

*Hint:*Recall that $\sin^9(\cdots) = \big[\sin(\cdots) \big]^9.$

The outermost function is $(\overbrace{\text{some stuff A}}^{1 + \sin^9(2x + 3)})^2$, and so the first part of the derivative is $2\times(\text{that exact same stuff A})$:

\begin{align*}

f'(x) &= 2\left(1 + \sin^9(2x + 3) \right) \times \cdots \\

& \phantom{= 2\left(1 + \sin^9(2x + 3) \right) \cdot 9\sin^8(2x+3) \cdot \cos(2x+3)\cdot 2}

\end{align*}

Next we consider the first inside function (which was “stuff A”): $1 + (\overbrace{\text{some stuff B}}^{\sin(2x + 3)})^9.$ So the next part of the derivative is $9\times (\text{that exact same stuff B})^8$:

\begin{align*}

f'(x) &= 2\left(1 + \sin^9(2x + 3) \right) \cdot 9\big[\sin(2x+3)\big]^8 \times \cdots \\[8px] &= 2\left(1 + \sin^9(2x + 3) \right) \cdot 9\sin^8(2x+3) \times \cdots \\

& \phantom{= 2\left(1 + \sin^9(2x + 3) \right) \cdot 9\sin^8(2x+3) \cdot \cos(2x+3)\cdot 2}

\end{align*}

The next inside function (that was “stuff B”) is $\sin(\overbrace{\text{of some stuff C}}^{2x+3}),$ and so the next part of the derivative is $\cos(\text{of that exact same stuff C})$:

\begin{align*}

f'(x) &= 2\left(1 + \sin^9(2x + 3) \right) \cdot 9\sin^8(2x+3) \cdot \cos(2x+3)\times \cdots \\

& \phantom{= 2\left(1 + \sin^9(2x + 3) \right) \cdot 9\sin^8(2x+3) \cdot \cos(2x+3)\cdot 2}

\end{align*}

Finally, the last inside function (that was “stuff C”) is $2x +3$, and so the last part of the derivative is $2$:

$$ f'(x) = 2\left(1 + \sin^9(2x + 3) \right) \cdot 9\sin^8(2x+3) \cdot \cos(2x+3)\cdot 2 \quad \cmark$$

Whew: done!

Want access to *all* of our Calculus problems and solutions? Buy full access now — it’s quick and easy!

this was really easy to understand good job

Thanks for letting us know. We’re glad to have helped! : )

Extremely helpful and easy to understand

Thank you. We’re happy to have helped! : )

NICE

very good.nice.easy to understand

Thanks! That’s what we’re aiming for. : )

What a great site. No other site explains this nice. Huge thumbs up

Thank you, Hemang! That is _great_ to hear!! : )

This site is very helpful. Learnt a lot.

Thanks, Sridhar. We’re happy to have helped!