Chain Rule

Click here for a printable docx version of this page.

Composite Functions

We’ve taken a lot of derivatives over the course of the last few sections. However, if you look back they have all been functions similar to the following kinds of functions.

$$R\left( z \right) = \sqrt z \hspace{0.5in}f\left( t \right) = {t^{50}}\hspace{0.5in}g\left(x\right) = \sin \left( x \right)$$

These are all fairly simple functions in that the "insides" of the functions are all just the independent variable. In reality, the functions used in various areas of study are typically more involved, such as the following functions.

$$R\left( z \right) = \sqrt {5z - 8} \hspace{0.4in}f\left( t \right) = \left( {2{t^3} + \cos \left( t \right)} \right)^{50}$$ $$g\left(x\right) = \sin \left( {\sqrt[3]{{3{x^2}}} + \cos \left( {5x} \right)} \right)$$

We may find ourselves wanting the derivative of such functions, but none of our derivative rules will work on these. These types of functions are called composite. In the composition of two functions, the outputs of one function become the inputs of the other.

It will be helpful for us to recognize the individual functions which are being composed to form the new function. Let's practice this.

Determine two functions that, when composed, yield the given function. Note, neither of your two functions should be just the given independent variable.
  1. $R\left(z\right)=\sqrt{5z-8}$

  2. Let $g\left(z\right)=5z-8$. Then $R\left(z\right)$ looks like $R\left(z\right)=\sqrt{g\left(z\right)}$.

    We see that the remainder of the $R\left(z\right)$ function is the basic square root function. So let $f\left(z\right)=\sqrt{z}$.

    Thus our two functions are $f\left(z\right)=\sqrt{z}$ and $g\left(z\right)=5z-8$. When composed, as in $\left(f\circ g\right)\left(z\right)$, we get, $$\left(f\circ g\right)\left(z\right)=\sqrt{g\left(z\right)}=\sqrt{5z-8}=R\left(z\right),$$ as desired.


  3. $f\left(t\right)=\left({2{t^3}+\cos\left(t\right)}\right)^{50}$

  4. Let $g\left(t\right)=2t^3+\cos(t)$. Then $f\left(t\right)$ looks like $f\left(t\right)=\left(g\left(t\right)\right)^{50}$.

    We see that the remainder of the $f\left(t\right)$ function is the basic 50$^\text{th}$ power function. So let $k\left(t\right)=t^{50}$. Note that we should not name this new function $f\left(t\right)$ as $f\left(t\right)$ already exists; it is the overall given function.

    Thus our two functions are $k\left(t\right)=t^{50}$ and $g\left(t\right)=2t^3+\cos(t)$. When composed, as in $\left(k\circ g\right)\left(t\right)$, we get, $$\left(k\circ g\right)\left(t\right)=\left(g\left(t\right)\right)^{50}=\left({2{t^3}+\cos\left(t\right)}\right)^{50}=f\left(t\right),$$ as desired.


  5. $g\left(x\right)=\sin\left({\sqrt[3]{{3{x^2}}}+\cos\left({5x}\right)}\right)$

  6. Let $u\left(x\right)=\sqrt[3]{{3{x^2}}}+\cos\left({5x}\right)$. Note we should not call this $g\left(x\right)$ as that is the name of the overall given function. Then $g\left(x\right)$ looks like $g\left(x\right)=\sin\left(u\left(x\right)\right)$.

    We see that the remainder of the $g\left(x\right)$ function is the basic sine function. So let $f\left(x\right)=\sin{x}$.

    Thus our two functions are $f\left(x\right)=\sin{x}$ and $u\left(x\right)=\sqrt[3]{{3{x^2}}}+\cos\left({5x}\right)$. When composed, as in $\left(f\circ u\right)\left(x\right)$, we get, $$\left(f\circ u\right)\left(x\right)=\sin\left(u\left(x\right)\right)=\sin\left({\sqrt[3]{{3{x^2}}}+\cos\left({5x}\right)}\right)=g\left(x\right),$$ as desired.

    If you look closely at our function $u\left(x\right)$, you may see that it is comprised of other composite functions; $\sqrt[3]{3x^2}$ and $\cos\left(5x\right)$ are both composite. See if you can determine the functions needed to be composed to yield these two expressions.



Try to first determine what the "inside" function is. This may help with what the "outer" function is.


The Chain Rule

Let's take a look at the composite function, $R\left( z \right) = \sqrt {5z - 8}$. In the section on the definition of the derivative, we used the definition of the derivative to compute $R'\left( z \right)$. We found that,

$$R'\left(z\right)=\frac{5}{{2\sqrt{5z-8}}}.$$

If we were to just use the power rule on this, ignoring the inside, we would get,

$$\frac{1}{2}{\left({5z-8}\right)^{-\frac{1}{2}}}=\frac{1}{{2\sqrt{5z-8}}}$$

which is not the derivative that we computed using the definition. It is close, but it’s not the same. So, the power rule alone simply won’t work to get the derivative here. We would need to multiply this by 5 to get to $R'\left(z\right)$.

In the previous example, we found that for $f\left(z\right)=\sqrt{z}$ and $g\left(z\right)=5z-8$, $R\left(z\right)=\left(f\circ g\right)\left(z\right)$. Additionally, notice that $g'\left(z\right)=5$. Could this be the missing $5$ for our derivative of $R\left(z\right)$?


The Chain Rule for Derivatives

Suppose that we have two functions $f\left(x\right)$ and $g\left(x\right)$ and they are both differentiable.

  1. If we define $F\left(x\right)=\left({f\circ g}\right)\left(x\right)$ then the derivative of $F\left(x\right)$ is, $$F'\left(x\right)=f'\left({g\left(x\right)}\right)\cdot g'\left( x\right).$$
  2. If we have $y=f\left(u\right)$ and $u=g\left(x\right)$, so that $y=f\left(g\left(x\right)\right)$, then the derivative of $y$ with respect to $x$ is, $$\frac{{dy}}{{dx}}=\frac{{dy}}{{du}}\cdot\frac{{du}}{{dx}}.$$

This proof will use the notation from the first part.

Suppose that $f\left(x\right)$ and $g\left(x\right)$ are both differentiable and let $F\left(x\right)=\left({f\circ g}\right)\left(x\right)$. Before using the limit definition of the derivative, we define two new functions. It will become apparent soon why we do this.

First, as $g(x)$ is differentiable, define $v(h)$ as

$$v\left( h \right) = \left\{ {\begin{array}{*{20}{l}}{\displaystyle \frac{{g\left( {x + h} \right) - g\left( x \right)}}{h} - g'\left( x \right)}&{{\mbox{ if }}h \ne 0}\\0&{{\mbox{ if }}h = 0}\end{array}} \right. $$

and notice that $v(h)$ is continuous at $h=0$ as $\mathop {\lim }\limits_{h \to 0} v\left( h \right) = 0 = v\left( 0 \right)$.

Assuming $h\neq0$, we get

$$g\left( {x + h} \right) = g\left( x \right) + h\cdot\left( {v\left( h \right) + g'\left( x \right)} \right)\hspace{6em}(1)$$

which is, in fact, valid for $h=0$.

Now as $f(x)$ is differentiable, we define a similar function, though will have different variables from the first.

$$w\left( k \right) = \left\{ {\begin{array}{*{20}{l}}{\displaystyle \frac{{f\left( {z + k} \right) - f\left( z \right)}}{k} - f'\left( z \right)}&{{\mbox{ if }}k \ne 0}\\0&{{\mbox{ if }}k = 0}\end{array}} \right.$$

Do not get excited about the different letters here all we did was use $k$ instead of $h$ and let $x=z$. Nothing fancy here, but the change of letters will be useful down the road. And as before, $w(k)$ is continuous at $k=0$ and for all values of $k$,

$$f\left( {z + k} \right) = f\left( z \right) + k\cdot\left( {w\left( k \right) + f'\left( z \right)} \right).\hspace{6em}(2)$$

Now we come to using the definition of derivative for the function $F(x)=f(g(x))$.

$$\begin{align*} F'(x) &= \lim_{h\to0}\frac{F(x+h)-F(x)}{h} \\ &= \lim_{h\to0}\frac{f(g(x+h))-f(g(x))}{h} \end{align*}$$

Using equation $(1)$ from above to rewrite $g(x+h)$, we get

$$=\lim_{h\to0}\frac{f\left[g\left( x \right) + h\cdot\left( {v\left( h \right) + g'\left( x \right)} \right)\right]-f(g(x))}{h}.$$

Using equation $(2)$ and allowing $z=g(x)$ and $k=h\cdot\left( {v\left( h \right) + g'\left( x \right)} \right)$, we get

$$\begin{align*} F'(x)=\ldots &= \lim_{h\to0}\frac{f(z) + k\cdot\left( {w\left( k \right) + f'(z)} \right)-f(g(x))}{h} \\ &= \lim_{h\to0}\frac{f(g(x)) + k\cdot\left( {w\left( k \right) + f'(g(x))} \right)-f(g(x))}{h} \\ &= \lim_{h\to0}\frac{k\cdot\left( {w\left( k \right) + f'(g(x))} \right)}{h} \\ &= \lim_{h\to0}\frac{\left(h\cdot\left( {v\left( h \right) + g'\left( x \right)} \right)\right)\cdot\left(w\left[h\cdot\left( {v\left( h \right) + g'\left( x \right)} \right)\right]+f'(g(x))\right)}{h} \\ &= \lim_{h\to0}\left(v\left( h \right) + g'\left( x \right)\right)\cdot\left(w\left[h\cdot\left( {v\left( h \right) + g'\left( x \right)} \right)\right]+f'(g(x))\right) \\ &= \left(\lim_{h\to0} v\left( h \right) + g'\left( x \right)\right)\cdot\left(\lim_{h\to0} w\left[h\cdot\left( {v\left( h \right) + g'\left( x \right)} \right)\right]+f'(g(x))\right). \end{align*}$$

Now we know that $v(h)$ is continuous at $h=0$ and $v(0)=0$, the first of the two remaining limits will be $0$. For the second limit, note that $\displaystyle\lim_{h\to0}h\cdot\left( v(h) + g'(x)\right)=0$ and $w$ is continuous at $0$. Thus

$$\lim_{h\to0} w\left[h\cdot\left( {v\left( h \right) + g'\left( x \right)} \right)\right]=w\left[\lim_{h\to0}h\cdot\left( {v\left( h \right) + g'\left( x \right)} \right)\right]=w(0)=0.$$

So, in fact, the second limit is also $0$. Continuing with our derivative of $F(x)$, we have,

$$\begin{align*} F'(x)=\ldots &= \left(\lim_{h\to0} v\left( h \right) + g'\left( x \right)\right)\cdot\left(\lim_{h\to0} w\left[h\cdot\left( {v\left( h \right) + g'\left( x \right)} \right)\right]+f'(g(x))\right) \\ &= \left(0 + g'(x)\right)\cdot\left(0+f'(g(x))\right) \\ &= f'(g(x))\cdot g'(x) \end{align*}$$

as desired.


The Chain Rule is so widely used, it is extremely important that one takes the time to fully understand.

Each of the two forms given above have their uses, and certain forms may be more suited to certain problems. In general, you may use either version.

Now, let’s go back and use the Chain Rule on the function $R\left(z\right)$.

Use the Chain Rule with $R\left(z\right)=\sqrt{5z-8}$ to verify that $R'\left(z\right)=\dfrac{5}{{2\sqrt{5z-8}}}$


Recall the two functions needed to be composed to yield $R\left(z\right)$. Determine the derivatives of these two functions to help with the derivative of $R\left(z\right)$.

Note that $R\left(z\right)=\left(f\circ g\right)\left(z\right)$ for $f\left(z\right)=\sqrt{z}$ and $g\left(z\right)=5z-8$. According to the chain rule, to get $R'\left(z\right)$, we will also need to know the individual derivatives of $f\left(z\right)$ and $g\left(z\right)$.

$$\begin{array}{lll} f\left(z\right)=\sqrt{z} & \hspace{.25in} \color{MidnightBlue}{g\left(z\right)=5z-8} \\ f'\left(z\right)=\dfrac{1}{2}z^{-1/2}=\dfrac{1}{2\sqrt{z}} & \hspace{.25in}\textcolor{Maroon}{g'\left(z\right)=5} \end{array}$$

By the chain rule,

$$\begin{array}{rl} R'\left(z\right)&=f'\left(\color{MidnightBlue}{g\left(z\right)}\right)\cdot \color{Maroon}{g'\left(z\right)}\\ &=\dfrac{1}{2\sqrt{\color{MidnightBlue}{g\left(z\right)}}}\cdot \color{Maroon}{5}\\ &=\dfrac{1}{2\sqrt{\color{MidnightBlue}{5z-8}}}\cdot\color{Maroon}{5}\\ &=\dfrac{5}{2\sqrt{5z-8}}, \end{array}$$

as expected.


Here, we will use the 2nd form of the Chain Rule, to see how it is used.

Taking $y=R\left(z\right)$, let $\textcolor{MidnightBlue}{u=5z-8}$ and so $y=\sqrt{\textcolor{MidnightBlue}{u}}$. Our goal is to find $\dfrac{dy}{dz}$.

By the chain rule, we need to find $\dfrac{dy}{du}$ and $\dfrac{du}{dz}$. As $y=\sqrt{\textcolor{MidnightBlue}{u}} = \textcolor{MidnightBlue}{{u}} ^{1/2}$ and $\textcolor{MidnightBlue}{u=5z-8}$, we get

$$\begin{array}{rl} \dfrac{dy}{du}&= \dfrac{d}{du}(\textcolor{MidnightBlue}{u}^{1/2})\\ &=\dfrac{1}{2}\textcolor{MidnightBlue}{u}^{-1/2}\\ \textcolor{Plum}{\dfrac{dy}{du}}&=\textcolor{Plum}{\dfrac{1}{2\sqrt{u}}}\\ \end{array}$$ and $$\begin{array}{rl} \dfrac{du}{dz}&= \dfrac{d}{dz}(\textcolor{MidnightBlue}{5z - 8})\\ \textcolor{Maroon}{\dfrac{du}{dz}}&=\textcolor{Maroon}{5}.\\ \end{array}$$

Thus $R'\left(z\right)=\dfrac{dy}{dz}$ is

$$\begin{array}{rl} \dfrac{dy}{dz}&=\textcolor{Plum}{\dfrac{dy}{du}}\cdot\textcolor{Maroon}{\dfrac{du}{dz}} \\ &=\textcolor{Plum}{\dfrac{1}{2\sqrt{\textcolor{MidnightBlue}{u}}}}\cdot \textcolor{Maroon}{5}\\ &=\dfrac{1}{2\sqrt{\textcolor{MidnightBlue}{5z-8}}}\cdot\textcolor{Maroon}{5}\\ &=\dfrac{5}{2\sqrt{5z-8}}. \end{array}$$

Note that we do not want to keep any $u$'s in our answer as that is not the original independent variable. So we just substitute $u=5z-8$ back into the expression.


In general, we don’t need to do all the composition stuff in using the Chain Rule, though it can be helpful for many. Let’s take the function from the previous example and rewrite it slightly.

$$R\left( z \right) = \underbrace {\left( {5z - 8} \right)}_{{\mbox{inside function}}}\,\,\underbrace {^{\,\,\,\,\,\,\frac{1}{2}\,\,\,\,\,\,\,\,}}_{{\mbox{ outside }}\atop {\mbox{function}}}$$

This function has an "inside function" and an "outside function". The outside function is the square root or the exponent of $1/2$, depending on how you want to think of it, and the inside function is the stuff that we’re taking the square root of or raising to the $1/2$, again depending on how you want to look at it. The derivative is then,

$$R'\left( z \right) = \overbrace {\frac{1}{2}{{\underbrace {\left( {5z - 8} \right)}_{{\mbox{inside function}}\atop{\mbox{left alone}}}}^{ - \frac{1}{2}}}}^{{\mbox{derivative of}}\atop{\mbox{outside function}}}\,\,\,\cdot\underbrace {\,\,\,\,\left( 5 \right)\,\,\,\,}_{{\mbox{derivative of}}\atop{\mbox{inside function}}}$$

In general, this is how we think of the chain rule. We identify the "inside function" and the "outside function". We then differentiate the outside function leaving the inside function alone and multiply all of this by the derivative of the inside function. In its general form this is,

$$F'\left( x \right) = \underbrace {\,\,\,\,\,f'\,\,\,\,\,}_{{\mbox{derivative of}}\atop{\mbox{outside function}}}\,\,\,\,\underbrace {\,\,\left( {g\left( x \right)} \right)\,\,}_{{\mbox{inside function}}\atop{\mbox{left alone}}}\,\,\cdot\,\,\,\underbrace {\,\,\,g'\left( x \right)\,\,\,}_{{\mbox{times derivative}}\atop{\mbox{of inside function}}}$$
Use the Chain Rule

We can always identify the "outside function" in the examples below by asking ourselves how we would evaluate the function. For instance in the $R\left(z\right)$ case from Example 2, if we were to ask ourselves what $R\left(2\right)$ is, we would first evaluate the expression under the radical and then finally take the square root of this result. The square root is the last operation that we perform in the evaluation and this is also the outside function. The outside function will always be the last operation you would perform if you were going to evaluate the function.

Let’s take a look at some examples of the Chain Rule.


Differentiate each of the following.

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

  2. Note that the outer function is $g\left(x\right)=\sin\left(x\right)$ and the inner function is $\textcolor{MidnightBlue}{h\left(x\right)=3x^2+x}$. As $\textcolor{Plum}{g'\left(x\right)=\cos\left(x\right)}$ and $\textcolor{Maroon}{h'\left(x\right)=6x+1}$, then

    $$\begin{array}{rl} f'\left(x\right) &=\textcolor{Plum}{g'}\left(\textcolor{MidnightBlue}{h\left(x\right)}\right)\cdot \textcolor{Maroon}{h'\left(x\right)} \\ &=\textcolor{Plum}{\cos}\left(\textcolor{MidnightBlue}{h\left(x\right)}\right)\cdot\textcolor{Maroon}{\left(6x+1\right)} \\ &=\textcolor{Plum}{\cos}\left(\textcolor{MidnightBlue}{3x^2+x}\right)\cdot\textcolor{Maroon}{\left(6x+1\right)} \\ &=\left(6x+1\right)\cos\left(3x^2+x\right). \end{array}$$

    Let's look at this final answer from the "inside/outside" perspective. With that point of view, we have: $$f'\left( x \right) = \overbrace {\cos{{\underbrace {\left( {3x^2+x} \right)}_{{\mbox{inside function}}\atop{\mbox{left alone inside}}}}}}^{{\mbox{derivative of}}\atop{\mbox{outside function}}}\,\cdot\,\,\underbrace {\,\,\,\,\left( 6x+1 \right)\,\,\,\,}_{{\mbox{derivative of}}\atop{\mbox{inside function}}}$$


    Let's do the example again from the Leibniz perspective. Let $y = \sin(3x^2+x)$. We want to find $\dfrac{dy}{dx}$. We can name the inner function $\textcolor{MidnightBlue}{u = 3x^2 + x}$, and therefore rewrite the original function as $y = \sin(\textcolor{MidnightBlue}{u})$. According to version 2 of the Chain Rule, then, $$\dfrac{dy}{dx} = \dfrac{dy}{du}\cdot\dfrac{du}{dx}.$$ Let's look at this a bit at a time, using Leibniz notation to help us along the way.

    $$\begin{array}{rl} \dfrac{dy}{dx} &= \dfrac{d\textcolor{Plum}{y}}{du}\cdot\dfrac{d\textcolor{MidnightBlue}{u}}{dx}\\ &= \frac{d}{du}(\textcolor{Plum}{\sin(u)}) \cdot \frac{d}{dx}(\textcolor{MidnightBlue}{3x^2+x})\\ &= \cos(\textcolor{MidnightBlue}{u}) \cdot (6x+1)\\ &= \cos(\textcolor{MidnightBlue}{3x^2+x})\cdot(6x+1)\\ \end{array}$$

  3. $f\left( t \right) = {\left( {2{t^3} + \cos \left( t \right)} \right)^{50}}$

  4. In this case the outside function is the exponent of 50 and the inside function is everthing being raised to that power of 50, that is, $2t^3+\cos(t)$. The derivative is then

    $$\begin{array}{rl} f'(t) &= \overbrace {50{{\underbrace {\left( {2t^3+\cos(t)} \right)}_{{\mbox{inside function}}\atop{\mbox{left alone inside}}}}^{49}}}^{{\mbox{derivative of}}\atop{\mbox{outside function}}}\,\cdot\,\,\underbrace {\,\,\,\,\dfrac{d}{dt}\left( 2t^3 + \cos(t) \right)\,\,\,\,}_{{\mbox{derivative of}}\atop{\mbox{inside function}}}\\ &\\ &= 50\left(6t^2-\sin(t)\right)\left(2t^3+\cos(t)\right)^{49}\\ \end{array}$$

    Again, we'll take the Leibniz perspective. If we let $\textcolor{MidnightBlue}{u = 2t^3 + \cos(t)}$, then our function becomes $y = f(u) = u^{50}$. Now we differentiate.

    $$\begin{array}{rl} \dfrac{dy}{dt} &= \dfrac{dy}{du}\cdot\dfrac{du}{dt}\\ &= \dfrac{d}{du}(u^{50}) \cdot \dfrac{d}{dt}(2t^3 + \cos(t))\\ &= 50\textcolor{MidnightBlue}{u}^{49} \cdot (6t^2 - \sin(t))\\ &= 50(\textcolor{MidnightBlue}{2t^3 + \cos(t)})\cdot (6t^2 - \sin(t))\\ \end{array}$$
  5. $P\left( t \right) = {\cos ^4}\left( t \right) + \cos \left( {{t^4}} \right)$

  6. There are two points to this problem. First, there are two terms in this function and each will require a different application of the chain rule. That will often be the case so don’t expect just a single chain rule when doing these problems. Second, we need to be very careful in choosing the outside and inside function for each term.

    Recall that the first term can be written as $\cos^4(t)=\left(\cos(t)\right)^4$. So, in the first term the outside function is the exponent of 4 and the inside function is the cosine.

    In the second term it’s exactly the opposite. In the second term the outside function is the cosine and the inside function is $t^4$. Thus the derivative of the function is

    $$\begin{align*} P'\left( t \right) & = \overbrace{4\underbrace{\left(\cos(t)\right)^3}_{{\mbox{inside function}}\atop{\mbox{left alone inside}}}}^{{\mbox{derivative of}}\atop{\mbox{outside function}}} \cdot \underbrace{\textcolor{Maroon}{\frac{d}{dt}(\cos(t))}}_{{\mbox{derivative of}}\atop{\mbox{inside function}}} + \overbrace{(-\sin(\underbrace{t^4}_{{\mbox{inside function}}\atop{\mbox{left alone inside}}}))}^{{\mbox{derivative of}}\atop{\mbox{outside function}}}\cdot\underbrace{\textcolor{Plum}{\frac{d}{dt}(t^4)}}_{{\mbox{derivative of}}\atop{\mbox{inside function}}} \\ &\\ & = 4{\cos ^3}\left( t \right)\left( { \textcolor{Maroon}{- \sin \left( t \right)}} \right) - \sin \left( {{t^4}} \right)\left( \textcolor{Plum}{{4{t^3}}} \right)\\ &\\ & = - 4\sin \left( t \right){\cos ^3}\left( t \right) - 4{t^3}\sin \left( {{t^4}} \right) \end{align*}$$


There's an important tip in that last example that we don't want to miss!

❗Note❗

When differentiating $\text{trig}^{\text{power}}(\text{stuff})$, rewrite it as $\left(\text{trig}(\text{stuff})\right)^{\text{power}}$ in order to apply the Chain Rule properly.

For example, if differentiating $f(x) = \sin^5(x^4+1)$, think of it instead as $f(x) = \left(\sin(x^4+1)\right)^5$.


Sometimes these can get quite complicated and require many applications of the chain rule along with other more involved rules we will learn soon. It’s usually best to be careful with these and write out a couple of extra steps rather than trying to do it all in one step in your head. Using the chain rule should come easier with practice, so it is vital that you do many practice problems of varying difficulty.

Use the Chain Rule

Let's do another example. Pay close attention to the inside function.

Determine $f'\left(y\right)$ if

$$f\left( y \right) = \sqrt {2y + {{\left( {3y + 4{y^2}} \right)}^3}}.$$

Instead of writing out the individual details and then hoping to put everything together correctly for the correct derivative, we will follow along (using the chain rule) one step at a time.

$$\begin{align*} f'\left( y \right) & = \frac{1}{2}{\left( {2y + {{\left( {3y + 4{y^2}} \right)}^3}} \right)^{ - \frac{1}{2}}}\frac{d}{{dy}}\left[ {2y + {{\left( {3y + 4{y^2}} \right)}^3}} \right]\\ & = \frac{1}{2}{\left( {2y + {{\left( {3y + 4{y^2}} \right)}^3}} \right)^{ - \frac{1}{2}}}\left( {2 + 3{{\left( {3y + 4{y^2}} \right)}^2}\frac{d}{{dy}}\left[ {3y + 4y^2} \right]} \right)\\ & = \frac{1}{2}{\left( {2y + {{\left( {3y + 4{y^2}} \right)}^3}} \right)^{ - \frac{1}{2}}}\left( {2 + 3{{\left( {3y + 4{y^2}} \right)}^2}\left( {3 + 8y} \right)} \right) \end{align*}$$

Notice that this problem required two uses of the chain rule; one within the other.

Derivatives of Cosecant and Secant

The Chain Rule can also help us with the rules for taking the derivatives of the cosecant and secant functions.

Recall that $\csc(x)=\frac{1}{\sin(x)}=\left(\sin(x)\right)^{-1}$. Note that this is NOT the same as $\sin^{-1}(x)$, which is the inverse sine function and will be discussed later.

So for $\csc(x)=\left(\sin(x)\right)^{-1}$, we can see that $\sin(x)$ is the inside function, being raised to the power of $-1$. We can use the chain rule for finding its derivative.

$$\begin{align*} \frac{d}{dx}\left[\csc(x)\right] &= \frac{d}{dx}\left[\left(\sin(x)\right)^{-1}\right] \\ &= -1\cdot\left(\sin(x)\right)^{-2}\cdot\cos(x) \\ &= \frac{-\cos(x)}{\sin^2(x)} \\ &= \frac{-1}{\sin(x)}\cdot\frac{\cos(x)}{\sin(x)} \\ &= -\csc(x)\cot(x). \end{align*}$$

A similar argument can be done for finding the derivative of $\sec(x)$. We give its derivative here, but leave the proof for the derivative of $\sec(x)$ as an exercise.

Derivatives of Trigonometric Functions

We recap the derivatives of the trigonometric functions we have learned so far.

$$\begin{align*} \frac{d}{dx}\left[\sin(x)\right]=\cos(x) && \frac{d}{dx}\left[\csc(x)\right]=-\csc(x)\cot(x) \\ \frac{d}{dx}\left[\cos(x)\right]=-\sin(x) && \frac{d}{dx}\left[\sec(x)\right]=\sec(x)\tan(x) \\ \end{align*}$$

Now that we have these new derivatives, we can practice the chain rule even more!

Determine $\dfrac{dy}{dx}$ if $y=\sec(1-5x)$.


In this case, the outside function is secant and the inside is $\textcolor{MidnightBlue}{1-5x}$.

$$\begin{align*} \frac{dy}{dx} &= \sec(\textcolor{MidnightBlue}{1-5x})\tan(\textcolor{MidnightBlue}{1-5x})\cdot\textcolor{Maroon}{\frac{d}{dx}(1-5x)}\\ &=\sec(1-5x)\tan(1-5x)\cdot\textcolor{Maroon}{-5} \\ &= -5\sec(1-5x)\tan(1-5x). \end{align*}$$

In this case the derivative of the outside function is secant times tangent. As we need to keep the original inside, $1-5x$, this needs to go as the inputs in both secant and tangent.


Let's once again recap a very important point from the previous example.

❗Note❗

When differentiating $\sec(\text{stuff})$ or $\csc(\text{stuff})$ using the Chain Rule, the "stuff" must go inside both functions in the derivative.

For example $\frac{d}{dx}(\sec(2x)) = \sec(2x)\tan(2x)\cdot\frac{d}{dx}(2x)$.


Use the derivatives of secant and cosecant

Practice Problems

In exercises 1-7, differentiate each function.

  1. $f\left( x \right) = {\left( {6{x^2} + 7x} \right)^4}$

  2. For this problem the outside function is (hopefully) clearly the exponent of 4 on the parenthesis while the inside function is the polynomial that is being raised to the power. The derivative is then, $$\begin{align*} f'\left( x \right) &= 4\left( 6x^2 + 7x \right)^3\left( 12x + 7 \right) \\ &= 4\left( 12x + 7 \right)\left( 6x^2 + 7x \right)^3. \end{align*}$$

  3. $g\left( t \right) = {\left( {4{t^2} - 3t + 2} \right)^{ - 2}}$

  4. For this problem the outside function is the exponent of -2 on the parenthesis while the inside function is the polynomial that is being raised to the power. The derivative is then, $$\begin{align*} g'\left(t\right) &=-2\left(4t^2-3t+2\right)^{-3}\left(8t-3\right) \\ &=-2\left(8t-3\right)\left(4t^2-3t+2\right)^{-3}. \end{align*}$$

  5. $y = \sqrt[3]{{1 - 8z}}$

  6. For this problem, it may be easier to convert the root to a fractional exponent. $$y = \sqrt[3]{{1 - 8z}}=(1-8z)^{\frac{1}{3}}$$ Now, the outside function is the exponent of $\frac{1}{3}$ while the inside function is the polynomial that is being raised to the power (or the polynomial inside the root – depending upon how you want to think about it). The derivative is then, $$\begin{align*} \frac{{dy}}{{dz}} &= \frac{1}{3}{\left( {1 - 8z} \right)^{ -\frac{2}{3}}}\left( { - 8} \right) \\ &=- \frac{8}{3}\left(1 - 8z\right)^{-\frac{2}{3}} \\ &\phantom{bb}\hspace{3em}\text{OR} \\ &=-\,\frac{8}{3(1-8z)^{\frac{2}{3}}}. \end{align*}$$

  7. $h\left( w \right) = \sin \left( {{w^6}} \right) + {\sin ^6}\left( w \right)$

  8. For this problem each term will require a separate application of the Chain Rule and don’t forget that, $$\sin^6(w)=\left(\sin(w)\right)^6$$ So, in the first term the outside function is the sine function, while the sine function is the inside function in the second term. The derivative is then, $$\begin{align*} h'\left(w\right) &=\cos\left(w^6\right)6w^5+6\left(\sin(w)\right)^5 \cos\left(w\right) \\ &=6w^5\cos\left(w^6\right)+6\sin^5\left(w\right)\cos\left(w\right). \end{align*}$$

  9. $g\left( z \right) = 3{z^7} - \sin \left( {{z^2} + 6} \right)$

  10. For this problem the first term requires no Chain Rule and the second term will require the Chain Rule. The derivative is then, $$\begin{align*} g'\left( z \right) &=21z^6-2z\cos\left(z^2+6\right). \end{align*}$$

  11. $f\left( x \right) = {\left( {\sqrt[3]{{12x}} + {{\cos }^2}\left( {3x} \right)} \right)^{ - 1}}$

  12. This problem will require multiple uses of the Chain Rule and so we’ll step though the derivative process to make each use clear.

    Here is the first step of the derivative and we’ll need to use the Chain Rule in this step.

    $$f'\left(x\right)=-1\left(\sqrt[3]{12x}+\cos^2\left(3x\right)\right)^{-2}\cdot\frac{d}{dx}\left[\left(12x\right)^{\frac{1}{3}}+\cos^2\left(3x\right)\right].$$

    As we can see the derivative from the previous step will also require the Chain Rule on each of the terms.

    The derivative from this step is,

    $$f'\left(x\right)=-\left(\sqrt[3]{12x}+\cos^2\left(3x\right)\right)^{-2}\left(\frac{1}{3}\left(12x\right)^{-\frac{2}{3}}(12)+2\cos\left(3x\right)\cdot\frac{d}{dx}\left[\cos\left(3x\right)\right]\right).$$

    The second term will again use the Chain Rule as we can see. The derivative is then,

    $$\begin{align*} f'\left(x\right) &=-\left(\sqrt[3]{12x}+\cos^2\left(3x\right)\right)^{-2}\left(\frac{1}{3}\left(12x\right)^{-\frac{2}{3}}(12)+2\cos\left(3x\right)\left(-\sin\left(3x\right)3\right)\right) \\ &=-\left(\sqrt[3]{12x}+\cos^2\left(3x\right)\right)^{-2}\left(4\left(12x\right)^{-\frac{2}{3}}-6\cos\left(3x\right)\sin\left(3x\right)\right). \end{align*}$$

  13. $R(w)=\csc(7w)$

  14. For this problem the outside function is the trig function and the inside function is the stuff inside of the trig function. The derivative is then, $$\begin{align*} R'(w) &= -7\csc(7w)\cot(7w). \end{align*}$$ In dealing with functions like cosecant (or secant for that matter) be careful to make sure that the inside function gets substituted into both terms of the derivative of the outside function. One of the more common mistakes with this kind of problem is to only substitute the $7w$ into only the cosecant or only the cotangent instead of both as it should be.


  15. Find the tangent line to $f(x)=4\sqrt{2x}-5x$ at $x=2$.

  16. We know that the derivative of the function at $x=2$ will give us the slope of the tangent line at this point, so we’ll need the derivative of the function. Differentiating the first term will require the Chain Rule as well. $$\begin{align*} f\left(x\right) &=4\left(2x\right)^{\frac{1}{2}}-5x \\ \\ f'\left(x\right) &=4\left(\frac{1}{2}\right)\left(2x\right)^{-\frac{1}{2}}\cdot 2-5 \\ &=4\left(2x\right)^{-\frac{1}{2}}-5 \\ &=\frac{4}{\sqrt{2x}}-5. \end{align*}$$

    Now all we need to do is evaluate the function and the derivative at the point in question.

    $$\begin{align*} f\left(2\right) &=4\sqrt{2\cdot2}-5\left(2\right)=-2 \\ \\ f'\left(2\right) &=\frac{4}{\sqrt{2\cdot2}}-5=-3. \end{align*}$$

    Finally, we need to write down the equation of the tangent line.

    $$\begin{align*} y+2 &=-3\left(x-2\right) \\ &\phantom{bb}\text{OR} \\ y &=-3x+4. \end{align*}$$
  17. The position of an object moving on a horizontal line is given by $s(t)=\sin(3t)-2t+4$ feet for $0\leq t\leq 3$ seconds. Determine whether the object is moving to the left or right at the following times. Also determine the object's instantaneous velocity at these times.
    1. $t=0$ seconds

    2. We know that the derivative of the position function gives us the velocity function of the object and so we’ll first need the derivative of this function. The first term will require the use of the Chain rule.

      $$\begin{align*} v\left(t\right)=s'\left(t\right) &=\cos\left(3t\right)\cdot3-2 \\ &=3\cos\left(3t\right)-2. \end{align*}$$

      Now all that we need to do is to compute: $s'\left(0\right)=3\cos\left(0\right)-2=1$. This is positive and so we know the object is moving to the right. It's instantaneous velocity at this time is 1 foot per second.


    3. $t=\dfrac{\pi}{4}$ seconds

    4. Using the velocity function (the derivative of the position function) from the previous part, we compute:

      $$\begin{align*} s'\left(\frac{\pi}{4}\right) &=3\cos\left(\frac{3\pi}{4}\right)-2 \\ &=-\frac{3\sqrt{2}}{2}-2 \\ &\approx -4.12132. \end{align*}$$

      This is negative and so we know the object is moving to the left. It's instantaneous velocity at this time is about -4.12132 feet per second, or $-\frac{3\sqrt{2}}{2}-2$ feet per second to be exact.


  18. Determine the fourth derivative of $\displaystyle f\left( w \right) = 7\sin \left( \frac{w}{3} \right) + \cos \left( {1 - 2w} \right)$.

  19. Not much to this problem other than to take four derivatives so each step will show each successive derivative until we get to the fourth. The first derivative is then,

    $$f'\left( w \right) = \frac{7}{3}\cos \left( \frac{w}{3}\right) + 2\sin \left( {1 - 2w} \right).$$

    The second derivative is,

    $$f''\left( w \right) = - \frac{7}{9}\sin \left( \frac{w}{3} \right) - 4\cos \left( {1 - 2w} \right).$$

    The third derivative is,

    $$f'''\left( w \right) = - \frac{7}{{27}}\cos \left(\frac{w}{3}\right) - 8\sin \left( {1 - 2w} \right).$$

    The fourth, and final derivative for this problem, is,

    $${f^{\left( 4 \right)}}\left( w \right) = \frac{7}{{81}}\sin \left( \frac{w}{3}\right) + 16\cos \left( {1 - 2w} \right).$$


Assignment Problems

For problems 1 – 16 differentiate the given function.
  1. $g\left( x \right) = {\left( {3 - 8x} \right)^{11}}$

  2. $g\left( z \right) = \sqrt[7]{{9{z^3}}}$

  3. $h\left( t \right) = {\left( {9 + 2t - {t^3}} \right)^6}$

  4. $y = \sqrt {{w^3} + 8{w^2}}$

  5. $R\left( v \right) = {\left( {14{v^2} - 3v} \right)^{ - 2}}$

  6. $ H\left( w \right) = \dfrac{2}{{{{\left( {6 - 5w} \right)}^8}}}$

  7. $f\left( x \right) = \sin \left( {4x + 7{x^4}} \right)$

  8. $g\left( z \right) = \cos \left( {\sin \left( z \right) + {z^2}} \right)$

  9. $A\left( t \right) = \cos \left( t \right) - \sqrt[6]{{1 - \sin \left( t \right)}}$

  10. $k\left( w \right) = {\left( {{w^4} - 1} \right)^5} + \sqrt {2 + 9w}$

  11. $h\left( x \right) = \sqrt[3]{{{x^2} - 5x + 1}} + {\left( {9x + 4} \right)^{ - 7}}$

  12. $f\left( x \right) = \sqrt {{x^2} + \sqrt {1 + 4x} }$

  13. $u = {\left( {6 + \cos \left( {8w} \right)} \right)^5}$

  14. $f\left( z \right) = {\cos ^2}\left( {1 + {{\cos }^2}\left( z \right)} \right)$

  15. $h(u)=\csc(u^2-u)$

  16. $g(z)=\sec^8(z)+\sec(z^8)$


  17. Find the tangent line to $f\left( x \right) = {\left( {2 - 4{x^2}} \right)^5}$ at $x=1$.

  18. Determine where $ U\left( w \right) = 3\cos \left( {\dfrac{w}{2}} \right) + w - 3$ is increasing and decreasing in the interval $\left[ { - 10,10} \right]$.

  19. If the position of an object is given by $s\left( t \right) = 4\cos \left( {2t} \right) - 10t + 7$, determine where, if anywhere, the object is not moving in the interval $\left[ {0,4} \right]$.

  20. Determine where $f\left( x \right) = 6\sin \left( {2x} \right) - 7\cos \left( {2x} \right) - 3$ is increasing and decreasing in the interval $\left[ { - 3,2} \right]$.

  21. Determine the fourth derivative of $\displaystyle y = 9\sin \left( z \right) - \sin \left( {4z} \right) + 7\cos \left( \frac{2x}{3} \right)$.

  22. Let $F(x) = f(g(x))$. Explain what $F'(x) = f'(g(x))\cdot g'(x)$ tells us to do. Explain each piece of the notation.

Note: The following content is adapted from OpenStax and is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Access for free at https://openstax.org/books/calculus-volume-1/pages/1-introduction.
Creative Commons License

For the following exercises, use the information in the following table to find $h′(a)$ at the given value for $a$.

$\begin{array}{|c|c|c|c|c|} \hline x & f(x) & f'(x) & g(x) & g'(x)\\ \hline 0 & 2 & 5 & 0 & 2\\ \hline 1 & 1 & -2 & 3 & 0\\ \hline 2 & 4 & 4 & 1 & -1\\ \hline 3 & 3 & -3 & 2 & 3\\ \hline \end{array}$

  1. $h(x) = f(g(x))$. Find $h'(0)$.

  2. $h(x) = g(f(x))$. Find $h'(0)$.

  3. $h(x) = (x^4 + g(x))^{-2}$. Find $h'(1)$.

  4. $h(x) = \left(\dfrac{f(x)}{g(x)}\right)^2$. Find $h'(3)$.

  5. $h(x) = f(x+f(x))$. Find $h'(1)$.

  6. $h(x) = (1 + g(x))^3$. Find $h'(2)$.

  7. $h(x) = g(2+f(x^2))$. Find $h'(1)$.

  8. $h(x) = f(g(\sin(x)))$. Find $h'(0)$.




  9. A mass hanging from a vertical spring is in simple harmonic motion as given by the following position function, where $ t$ is measured in seconds and $s$ is in inches: $$s(t) = -3\cos(\pi t + \frac{\pi}{4}).$$
    1. Determine the position of the spring at $t=1.5 s$.
    2. Find the velocity of the spring at t=1.5 s.

  10. The formula for the area of a circle is $A=\pi r^2$, where $r$ is the radius of the circle. Suppose a circle is expanding, meaning that both the area $A$ and the radius $ r$ (in inches) are expanding.
    1. Suppose $r = 2 - \frac{100}{(t+7)^2}$ where $t$ is time in seconds. Use the chain rule $\frac{dA}{dt} = \frac{dA}{dr}\cdot \frac{dr}{dt}$ to find the rate at which the area is expanding.
    2. Use part a to find the rate at which the area is expanding at $t=4$ s.

  11. The daily temperature in degrees Fahrenheit of Phoenix in the summer can be modeled by the function $T(x)=94−10\cos[\frac{\pi}{ 12}(x−2)]$, where $x$ is hours after midnight. Find the rate at which the temperature is changing at 4 p.m.
  12. The depth (in feet) of water at a dock changes with the rise and fall of tides. The depth is modeled by the function $D(t)=5\sin(\frac{\pi}{6}t−\frac{7\pi}{6})+8$, where $t$ is the number of hours after midnight. Find the rate at which the depth is changing at 6 a.m.