JUMP TO TOPIC
Chain rule – Step-by-Step Process, Explanation, and Example
The chain rule helps us differentiate composite functions or functions that can be written as a composition of two or more functions. In the past, we’ve learned about fundamental derivative rules that apply to simpler expressions, but differentiate composite functions will require a separate rule.
The chain rule is an essential technique when finding the derivative of a composite function. This technique makes sure that we account for the inner function when differentiating a given composite function.
Since we’re working with composite functions, please brush up on your knowledge about composite functions that you might have learned from your Algebra lessons.
In this article, we’ll learn how to apply the chain rule for different functions and learn how to identify the instances where we’ll need this rule and when we won’t need this rule. We’ll also provide an ample number of examples to make sure that you’ll be applying the chain rule with confidence by the end of this discussion.
What is the chain rule?
The chain rule will allow us to differentiate composite functions easily. This means that when we’re given a function that is of the form, $f(g(x))$, we can its derivative using the chain rule.
\begin{aligned}\dfrac{d}{dx} [f(g(x))] &= \dfrac{d}{dx}[f(g(x))] \cdot \dfrac{d}{dx} [g(x)]\\\\ [f(g(x))]’ &= [f'(g(x))] \cdot g’(x)\end{aligned}
This shows that according to the chain rule when we take the derivative of a composite function, we take the derivative of the outer function, substitute the inner function into the result, and then multiply the new expression with the derivative of the inner function.
This means that it is essential in chain rule to identify the “outer” and “inner” layers of the function when differentiating a composite function. It’s also important to know when it’s best to apply the chain rule or other derivative rules, so make sure we’re working with composite functions.
When to use the chain rule?
Recall that a composite function contains a function within another function. Any function that can be written in the form of $f(g(x))$ is considered a composite functions. This means that the chain rule will help us differentiate functions like:
- $y = 2(3x – 5)^2$: outer function is $f(x) = 3x^2$ while the inner function is $g(x) = 2x – 5$.
\begin{aligned}\color{green} g(x): \text{ inner layer}\\\color{blue}\underbrace{2({\color{green}\overbrace{3x – 5}})^2 + 4}\\\color{blue} f(x): \text{ outer layer}\end{aligned}
- $y = \sin (2x^2)$: outer function is $f(x) = 2x^2$ while the inner function is $g(x) = \sin x$.
\begin{aligned}\phantom{xxxxxx}\color{green} g(x): \text{ inner layer}\\\color{blue}\underbrace{\sin({\color{green}\overbrace{2x^2}})}\\\phantom{xxxxx}\color{blue} f(x): \text{ outer layer}\end{aligned}
When we can write functions as a composition of two or more simpler functions, like our examples shown above, we can apply the chain rule.
Now, here are some pointers to keep in mind when differentiating functions using the chain rule:
1) Double-check if the given function is indeed a composite function or not.
This is why it’s important to brush up on your knowledge of composite functions. When in doubt, make sure to practice identifying composite functions and go back to the chain once you’re more confident.
Let’s take a look at this table below to show you some functions that are commonly mistaken as composite functions and functions that you might not label as a composite function at first glance.
Function | Is it a composite function? |
\begin{aligned}f(x) = \tan ^5 x\end{aligned} | \begin{aligned}f(x) = \tan ^5 x\\ &= (\tan x)^5\end{aligned} Yes – it is a composite function with $\tan x$ as its inner layer and $x^5$ as the outer function. |
\begin{aligned}f(x) = (x^2 – 4x)\ln x \end{aligned} | No – $f(x)$ is not a composite function. It is in fact a product of two simpler functions, so we can use the product rule instead to differentiate $f(x)$. |
\begin{aligned}f(x) = \sin\left(\dfrac{1}{x}\right) \end{aligned} | Yes – this function is a composite function with $\dfrac{1}{x}$ as the inner function and $\sin x $ as the outer function. |
\begin{aligned}f(x) = \dfrac{\sqrt{x}}{\cos x}\end{aligned} | No – this function is not a composite function. This is actually a rational expression with no composite functions in its numerator and denominator. Using the quotient rule would be a great starting point instead. |
These are just some of the many instances where we might have to double-check our assessment and make sure we’re applying the correct rule for their derivatives.
2) Make sure to identify the right inner and outer layers of the composite function.
The confusion usually arises with trigonometric functions like $\sin ^2 x$. Remember that $\sin^2 x = (\sin x )^2$ and this shows that the outer function is actually $f(x) = x^2$ and the inner layer is $g(x) = \sin x$.
\begin{aligned}\phantom{xxxxxxxx}\color{green} g(x): \text{ inner layer}\\ \color{blue}\underbrace{({\color{green}\overbrace{\sin x}})^2}\\ \phantom{xxxxxxx}\color{blue} f(x): \text{ outer layer}\end{aligned}
Now that we understand what the chain rule is and know how to identify functions that will benefit from the chain rule, let’s dive into learning how to execute this rule smoothly.
How to do the chain rule?
Recall that when we’re given a composite function, $h(x) = f[g(x)]$, we can find its derivative by taking the derivative of $h(x)$ then multiplying the result with the derivative of the inner function, $g(x)$.
\begin{aligned}\dfrac{d}{dx} [f(g(x))] &= \dfrac{d}{dx}[f(g(x))] \cdot \dfrac{d}{dx} [g(x)]\\\\ [f(g(x))]’ &= [f'(g(x))] \cdot g’(x)\end{aligned}
Here’s a a four-step strategy to help guide you in differentiating the composite function, $h(x) = f[g(x)]$.
Step 1: Identify the outer and inner functions, $f(x)$ and $g(x)$, respectively.
Step 2: Find the derivative of $f(x)$ and evaluate the expression at $g(x)$.
Step 3: Find the derivative of $g(x)$.
Step 4: Multiply the results of Step 2 and Step 4 to find the derivative of $h(x)$.
\begin{aligned} h’(x) &= f’[(g(x)] \cdot g’(x)\end{aligned}
Why is it important for us to identify the outer and inner functions? Knowing the form of the outer function will help us know the derivative rules we’ll need to apply to find $f’(x)$ at $g(x)$.
For example, when we have $(2x -1)^3$, the outer function will be $f(x) = x^3$, and with this, we now know that we’ll have to use the power rule to differentiate $f(x)$.
\begin{aligned}\phantom{xxxxxxxx}\color{green} g(x): \text{ inner layer}\\\color{blue}\underbrace{({\color{green}\overbrace{2x -1}})^3}\\\phantom{xxxxxxx}\color{blue} f(x): \text{ outer layer}\end{aligned}
Let’s begin by taking the derivative of $x^3$ using the power rule, $\dfrac{d}{dx} x^n = nx^{n -1}$. Once we have this, we can now substitute the expression of $g(x)$ into $f’(x)$.
\begin{aligned}f(x) &= x^3\\f'(x) &= 3(x)^{3 – 1}, \phantom{x}\color{green}\text{Power Rule}\\&= 3x^2\\f'[g(x)] &= 3[g(x)]^2\\&= 3(2x -1)^2\\&= 3(2x -1)^2\end{aligned}
Now, let’s find the derivative of the inner function, $2x -1$, using the constant multiple and constant rules.
\begin{aligned}g(x) &= 2x – 1\\g'(x) &= 2 \dfrac{d}{dx} x – \dfrac{d}{dx}1, \phantom{x}\color{green}\text{Constant Multiple Rule}\\&= 2(1) – 0,\phantom{x}\color{green}\text{Constant Rule}\\&= 2 \end{aligned}
Now that we have the expressions for $f’[g(x)]$ and $g’(x)$, we simply multiply the two to find the derivative of $h(x) = (2x -1)^3$.
\begin{aligned}h(x) &= f[g(x)]\\h'(x) &= f'[g(x)] \cdot g(x)\\&= 3(2x -1)^2 \cdot 2\\&= 6(2x -1)^2 \end{aligned}
This shows that through the chain rule, we can find the derivative of $h(x) = (2x – 1)^3$ and we have $h’(x) = 6(2x -1)^3$.
Once you’re used to the chain rule, you can even merge Step 1 and 2 and return the expression for $f’[g(x)]$ by applying the derivative rules directly to the function. We’ll show you more examples and work on different composite functions so that you become more confident with this technique.
Example 1
Let’s say we have a composite function, $h(x) = f[g(x)]$, where both $f(x)$ and $g(x)$ are differentiable. If we have $g(-2) = 4$, $g’(-2) = 6$, and $f’(4) = -12$, what is the value of $h’(-2)$.
Solution
Recall that we can find the derivative of composite functions using the chain rule, $h’(x) = f’[g(x)] \cdot g’(x)$. This means that we can calculate $h’(-2)$ as shown below.
\begin{aligned}h'(-2) &= f'[g(-2)] \cdot g'(-2)\\&=f'(4) \cdot g'(-2)\\&= -12 \cdot 6\\&= -72 \end{aligned}
From this, we’ve shown how we can use the definition of composite functions and how the chain rules apply for any differentiable functions, $f(x)$ and $g(x)$. Hence, $h(-2) = -72$.
Example 2
Identify the inner and outer functions of the following composite function then find the derivative of $h(x) = 5(8x -10)^3$.
Solution
Let’s begin by identifying the inner and outer layers of the composite function, $5(8x -10)^4$.
\begin{aligned}\phantom{xxxxxxxx}\color{green} g(x): \text{ inner layer}\\\color{blue}\underbrace{5({\color{green}\overbrace{8x -10}})^4}\\\phantom{xxxxxxx}\color{blue} f(x): \text{ outer layer}\end{aligned}
This means that we have an outer function, $f(x) = 5x^4$, so to find $f’(x)$, we can use the constant multiple and power rules, to find the expression for $f’(x)$.
\begin{aligned}f(x)&= 5x^4 \\f'(x) &= 5\dfrac{d}{dx} x^4, \phantom{x} \color{green}\text{Constant Multiple Rule}\\&= 5(4)x^{ 4-1} \phantom{x} \color{green}\text{Power Rule}\\&= 20x^3\end{aligned}
Evaluate $g(x)$ at $f’(x)$, hence we have the following expression:
\begin{aligned}f'[g(x)] &= f'(8x – 10)\\&= 20(8x -10)^3\end{aligned}
Next, we can find the derivative of $g(x) = 8x -10$ using the constant and constant multiple rules.
\begin{aligned}g(x) &= 8x – 10\\g'(x) &= 8 \dfrac{d}{dx} x – \dfrac{d}{dx}10, \phantom{x}\color{green}\text{Constant Multiple Rule}\\&= 8(1) – 0,\phantom{x}\color{green}\text{Constant Rule}\\&= 8 \end{aligned}
We now have $f’[g(x)] = 20(8x -10)^3$ and $g’(x) = 8$, so we can multiply these two expressions to find the derivative of $h(x)$.
\begin{aligned}h(x) &= f[g(x)]\\h'(x) &= f'[g(x)] \cdot g(x)\\&= [20(8x -10)^3] \cdot 8\\&= 160(8x -10)^3 \end{aligned}
Hence, through the chain rule, we have $h’(x) = 160(8x -10)^3$.
Example 3
Identify the inner and outer functions of the following composite function then find the derivative of $h(x) = 2\cos^3 x$.
Solution
We can rewrite $h(x) = 2 \cos^3 x$ as $h(x) =2(\cos x)^3$. Now that we have this form, we can easily identify the inner and outer functions.
\begin{aligned}\phantom{xxxxxxxxxx}\color{green} g(x): \text{ inner layer}\\\color{blue}\underbrace{2({\color{green}\overbrace{\cos x}})^3}\\\phantom{xxxxxxxxx}\color{blue} f(x): \text{ outer layer}\end{aligned}
This shows that the inner function is equal to $g(x) = \cos x$ and an outer function of $f(x) = 2x^3$. We can now find the derivative of $f(x)$ by using the constant multiple and power rules as shown below.
\begin{aligned}f(x) &= 2x^3\\f'(x) &= 2\dfrac{d}{dx} x^3, \phantom{x}\color{green}\text{Constant Multiple Rule}\\&= 2[3(x)^{3 – 1}],\phantom{x}\color{green}\text{Power Rule}\\&= 6x^2 \end{aligned}
We have $g(x) = \cos x$, so using the derivative for cosine, we have $g’(x) = -\sin x$. Now that we have the expressions for $f’[g(x)] = 6x^2$ and $g’(x) = -\sin x$, we can find the derivative for $h(x)$ as shown below.
\begin{aligned}h(x) &= f[g(x)]\\h'(x) &= f'[g(x)] \cdot g(x)\\&= [6(\cos x)^2] \cdot (-\sin x)\\&= -6 \sin x (\cos x)^2\\&= -6 \sin x \cos^2 x \end{aligned}
After multiplying the two expressions, we now have $h’(x) = -6\sin x \cos^2 x$.
Example 4
Identify the inner and outer functions of the following composite function then find the derivative of $h(x) = e^{\displaystyle{-6x^2 + 10x – 8}}$.
Solution
We can begin by identifying the inner and outer layers of the composite function.
\begin{aligned}\phantom{xxxxxxxxxx}\color{green} g(x): \text{ inner layer}\\\color{blue}\underbrace{e^{({\color{green}\overbrace{-6x^2 + 10x -8}})}}\\\phantom{xxxxxxxxx}\color{blue} f(x): \text{ outer layer}\end{aligned}
This shows that the outer function is equal to $f(x) = e^x$ and the inner function is equal to $-6x^2 + 10x – 8$. Recall that the derivative of $e^x$ is also equal to $e^x$, so $f’(x) = e^x$. Let’s evaluate $g(x) = -6x^2 + 10x – 8$ when we have $f’(x) = e^x$.
\begin{aligned}f'[g(x)]&= e^{\displaystyle{g(x)}}\\&= e^{\displaystyle{ -6x^2 + 10x – 8}}\end{aligned}
We can now find the derivative of $g(x)$ using the sum, constant multiple, and constant rules as shown below.
\begin{aligned}g(x) &= -6x^2 + 10x -8\\g'(x) &= -6\dfrac{d}{dx} x^2 + 10\dfrac{d}{dx}x – \dfrac{d}{dx}8, \phantom{x}\color{green}\text{Constant Multiple Rule}\\&= -6(2x^{2 -1}) + 10(x^{1 -1}) – \dfrac{d}{dx}8,\phantom{x}\color{green}\text{Power Rule}\\&= -6(2x^{2 -1}) + 10(x^{1 -1}) – ,\phantom{x}\color{green}\text{Constant Rule} \\&= -12x + 10 \end{aligned}
Now that we have $f’[g(x)]$ and $g’(x)$, we can multiply the two expressions to find the derivative of $h’(x)$.
\begin{aligned}h(x) &= f[g(x)]\\h'(x) &= f'[g(x)] \cdot g(x)\\&= \left( e^{\displaystyle{ -6x^2 + 10x – 8}}\right ) \cdot (-12x + 10)\\&= (-12x + 10)e^{\displaystyle{ -6x^2 + 10x – 8}}\end{aligned}
This shows that through the chain rule, we have $h’(x) = (-12x + 10)e^{\displaystyle{ -6x^2 + 10x – 8}}$.
Example 5
Determine the derivative of the function, $h(x) = 4\tan \sqrt{4x – 1}$.
Solution
This fourth function is interesting because here’s a heads up: two composite functions are within $h(x)$. We’ll start by identifying the main outer and inner functions.
\begin{aligned}\phantom{xxxxxxxxxxxxx}\color{green} g(x): \text{ inner layer}\\\color{blue}\underbrace{4\tan {({\color{green}\overbrace{\sqrt{4x – 1}}})}}\\\phantom{xxxxxxxxx}\color{blue} f(x): \text{ outer layer}\end{aligned}
We can see that $h(x)$ is made up of two functions: an outer layer, $f(x) = 4\tan x$, and an inner layer, $g(x) =\sqrt{4x – 1}.
Recall that the derivative of $\tan x$ is equal to $\sec^2 x$, so we can find the derivative of $f(x)$ as shown below.
\begin{aligned}f(x) &= 4\tan x\\f'(x) &= 4\dfrac{d}{dx} \tan x , \phantom{x}\color{green}\text{Constant Multiple Rule}\\&= 4(\sec ^2 x),\phantom{x}\color{green}\text{Derivative of Tangent} \\&= 4\sec^2 x\end{aligned}
We can then substitute $g(x)$ into the expression of $f’(x)$ to find $f’[g(x)]$.
\begin{aligned}f'[g(x)] &= 4\sec^2 [g(x)]\\&= 4\sec^2(\sqrt{4x – 1}) \end{aligned}
Now, let’s take a look at $g(x) = \sqrt{4x – 1}$. This is also a composite function with the inner and outer layers shown below.
\begin{aligned}\phantom{xxxxxxxxxxxxx}\color{blue} \text{ outer layer}\\\color{blue}\overbrace{\sqrt{{\color{green}\underbrace{4x – 1}}}}\\\phantom{xxxxxxxxxxxx}\color{green} \text{ inner layer}\end{aligned}
This means that we’ll have to use the chain rule to determine the derivative of $g(x)= \sqrt{4x – 1}$ as shown below. We’ll be showing the working out quickly here, so give take this as an additional exercise and see how we used the chain rule to differentiate $\sqrt{4x -1}$.
\begin{aligned}\dfrac{d}{dx} \sqrt{4x – 1} &= \dfrac{d}{dx}(4x – 1)^{\frac{1}{2}}\end{aligned}
Outer Function | Inner Function |
\begin{aligned} f_1(x) &= x^{\frac{1}{2}}\\f_1′(x) &= \dfrac{1}{2}x^{\frac{1}{2} – 1}, \phantom{x}\color{green} \text{Power Rule}\\&= \dfrac{1}{2}x^{-\frac{1}{2}}\\&= \dfrac{1}{2\sqrt{x}}\\f_1′[g_1] &= \dfrac{1}{2\sqrt{4x -1}}\end{aligned} | \begin{aligned}g_1(x) &= 4x -1\\g_1′(x) &= 4\dfrac{d}{dx} x – \dfrac{d}{dx} 1, \phantom{x}\color{green} \text{Sum & Constant Multiple Rules}\\&= 4(1) – 0, \phantom{x}\color{green} \text{Power & Constant Rules}\\&= 4\end{aligned} |
\begin{aligned}\dfrac{d}{dx} \sqrt{4x – 1} &= \dfrac{d}{dx}(4x – 1)^{\frac{1}{2}}\\&= f_1′[g_1(x)] \cdot g_1′(x)\\&= \dfrac{1}{2\sqrt{4x -1}} \cdot 4\\&= \dfrac{2}{\sqrt{4x – 1}}\end{aligned} |
This means that through chain rule, we can also find the expression for $g’(x) = \dfrac{2}{\sqrt{4x – 1}}$. Since we have the expressions for $f’[g(x)]$ and $g’(x)$, we can multiply the two to find the derivative of $h(x)$ as shown below.
\begin{aligned}f'[g(x)] &= 4\sec^2(\sqrt{4x – 1}) \\g'(x) &= \dfrac{2}{\sqrt{4x -1}}\\\\h'(x) &= f'[g(x)] \cdot g'(x)\\&= 4\sec^2(\sqrt{4x -1}) \cdot \dfrac{2}{\sqrt{4x – 1}}\\&= \dfrac{8\sec^2(\sqrt{4x -1})}{\sqrt{4x -1}}\end{aligned}
This example highlights the fact that we may have to use the chaine two or more times for some composite functions. For our case, we had to use the chain rule twice and in fact, we have $h’(x) = \dfrac{8\sec^2(\sqrt{4x -1})}{\sqrt{4x -1}}$.
Practice Questions
1. Let’s say we have a composite function, $h(x) = f[g(x)]$, where both $f(x)$ and $g(x)$ are differentiable. If we have $g(-3) = 8$, $g’(-3) = 5$, and $f’(8) = 10$, what is the value of $h’(-3)$.
2. Identify the following composite function’s inner and outer functions, then find the derivative of $h(x)$.
a. $h(x) =6(12x – 6)^5$
b. $h(x) =2(-5x + 8)^2$
c. $h(x) = 7(-3x + 2)^{12}$
3. Identify the following composite function’s inner and outer functions, then find the derivative of $h(x)$.
a. $h(x) = \tan^4 x$
b. $h(x) = 4\sin^5 x$
c. $h(x) = 5\cos^8 x$
4. Identify the following composite function’s inner and outer functions then find the derivative of $h(x)$.
a. $h(x) = -3e^{4x-5}$
b. $h(x) = 2 e^{3 \sin x}$
c. $h(x) = -e^{6x^2 – 4x + 3}$
5. Determine the derivative of the following functions.
a. $h(x) = \cos^3 (10x)$
b. $h(x) = ln [\cos ^6 (2x^8)]$ (Hint: $\dfrac{d}{dx} \ln x =\dfrac{1}{x}$)
c. $h(x) = e^{\sqrt{\sin (4x)}}$
Answer Key
1. $h’(-3) = 50$
2.
Inner Function | Outer Function | Derivative | |
a. | \begin{aligned}f(x)&=6x^5\end{aligned} | \begin{aligned}g(x)&=12x -6\end{aligned} | \begin{aligned}h’(x)&=360(12x -6)^4\end{aligned} |
b. | \begin{aligned}f(x)&=2x^2\end{aligned} | \begin{aligned}g(x)&=-5x+8\end{aligned} | \begin{aligned}h’(x)&=-20(-5x + 8)\end{aligned} |
c. | \begin{aligned}f(x)&=7x^{12}\end{aligned} | \begin{aligned}g(x)&=-3x + 2\end{aligned} | \begin{aligned}h’(x)&= -252(-3x +2)^{11}\end{aligned} |
3.
Inner Function | Outer Function | Derivative | |
a. | \begin{aligned}f(x)&=x^4\end{aligned} | \begin{aligned}g(x)&=\tan x \end{aligned} | \begin{aligned}h’(x)&= 4\tan^3 x \sec^2 x\end{aligned} |
b. | \begin{aligned}f(x)&=4x^5\end{aligned} | \begin{aligned}g(x) &= \sin x\end{aligned} | \begin{aligned}h’(x)&=20(\sin^4 x)(\cos x) \end{aligned} |
c. | \begin{aligned}f(x)&= 5x^8\end{aligned} | \begin{aligned}g(x)&= \cos x\end{aligned} | \begin{aligned}h’(x)&= -40 \sin x \cos^7 x\end{aligned} |
4.
Inner Function | Outer Function | Derivative |
\begin{aligned}f(x)&=-3e^x\end{aligned} | \begin{aligned}g(x)&= 4x- 5 \end{aligned} | \begin{aligned}h’(x)&= -12 e^{4x -5}\end{aligned} |
\begin{aligned}f(x)&=2e^x\end{aligned} | \begin{aligned}g(x) &= 3\sin x\end{aligned} | \begin{aligned}h’(x)&=6eˆ{3\sin x} \cos x \end{aligned} |
\begin{aligned}f(x)&= -e^x\end{aligned} | \begin{aligned}g(x)&= 6x^2 – 4x + 3\end{aligned} | \begin{aligned}h’(x)&= -4(3x -1)e^{6x^2 – 4x+ 3}\end{aligned} |
5.
a. $h’(x)= -30\sin (10x)\cos^2 (10x)$
b. $h’(x) = -96x^7 \tan(2x^8)$
c. $h’(x) = \dfrac{2e^{\sqrt{\sin (4x)}} \cos (4x)}{\sqrt{\sin (4x)}}$