JoeCMath

Derivative Chain Rule

Simple overview of the derivative chain rule

Main Idea

We use the derivative chain rule when the function we are taking the derivative contains the composition of two functions (one function contain within another).

If

\[f(x)=g(h(x))\]

then

\[f'(x)=g'(h(x))\cdot h'(x)\]

Watch this section: introduction at 0:00.

Example 1: Cosine With A Power Inside

The first example in the video is

\[f(x)=\cos(x^5)\]

The outside function is cosine, and the inside function is $x^5$.

So $g(x) = cos(x)$ and $h(x)=x^5$.

Essentially $f(x) = g(h(x))$.

So to find $f’(x)$ we have to use the chain rule.

To do that we need to identify $g(x)$ and $h(x)$ (which we have already done) as well as their individual derivatives $g’(x)$ and $h’(x)$

So

\[g'(x)=-sin(x) \quad \text{ by trig derivatives}\]

and

\[h'(x)=5x^4 \quad \text{ by power rule}\]

Then we just follow the guide

\[f'(x)=g'(h(x))\cdot h'(x)\]

Which can be thought of as “take the derivative of the outside function first, keep the inside function within the outside derivative, and multiply by the derivative of the inside function.”

So

\[f'(x)=-sin(x^5)\cdot (5x^4)\]

The derivative of the outside function is $-sin(x)$, keep the inside function inside of it ($-sin(x^5)$) and then multiply by the inside function ($5x^4$).

Watch this section: first chain rule example at 0:34.

Example 2: Exponential With Cosine Inside

The second example is

\[f(x)=e^{\cos(x)}.\]

The outside function is $e^x$, and the inside function is $\cos(x)$.

\[\text{The outside function }g(x)=e^x \quad \text{ and } \quad g'(x)=e^x\] \[\text{The inside function }h(x)=cos(x) \quad \text{ and } \quad h'(x)=-sin(x)\]

Plugging this into the chain rule we get:

\[f'(x) = e^{cos(x)}\cdot (-sin(x)) =-sin(x)e^{cos(x)}\]

Watch this section: second chain rule example at 1:28.

Multiple Layers

What happens if we are taking the derivative of a function with more than two layers?

Consider

\[f(x)=\sin\left(\cos\left(e^{x^4+2x+1}\right)\right)\]

Read the layers from the outside inward, this helps you understand how many times we will apply the chain rule. We will work with each layer and multiply sequence of (“chain” if you will) of smaller and smaller functions until we get to the center of the function.

\[\sin(\Box), \qquad \cos(\Box), \qquad e^{\Box}, \qquad x^4+2x+1.\]

Each layer contributes one derivative factor. Written in the same outside-to-inside order,

\[\begin{aligned} f'(x) &=\cos\left(\cos\left(e^{x^4+2x+1}\right)\right)\\ &\quad\cdot\left[-\sin\left(e^{x^4+2x+1}\right)\right]\\ &\quad\cdot e^{x^4+2x+1}(4x^3+2). \end{aligned}\]

The main point is not that the expression looks short. The main point is that each nested function gets handled in order, and each layer’s derivative is multiplied into the final answer.

Watch this section: handling multiple layers at 2:27.

Timestamp Guide

Section What is shown Video
Introduction Introduce the chain rule pattern for composite functions. 0:00
Example 1 Differentiate $f(x)=\cos(x^5)$. 0:34
Example 2 Differentiate $f(x)=e^{\cos(x)}$. 1:28
Multiple layers Apply the chain rule to $\sin\left(\cos\left(e^{x^4+2x+1}\right)\right)$. 2:27

More Practice

For timestamped practice from this video and related JoeCMath derivative walkthroughs, use the chain rule example archive.

The chain rule also appears inside longer derivative problems. For surrounding topics, browse the derivatives topic page, the product rule topic, or the quotient rule topic.


More in Chain rule