Chain Rule
From the calculus curriculum
TL;DR
The Chain Rule helps you find the derivative of a composite function – a function inside another function. It says you take the derivative of the "outer" function, keep the "inner" function untouched, and then multiply by the derivative of that "inner" function. It's like peeling an onion, layer by layer, and multiplying the derivatives at each step.
1. The Mental Model
Imagine you have a machine that makes cakes, and inside that machine, there's another machine that mixes the batter. To understand how changes in the ingredients affect the final cake, you need to consider both the batter mixer's effect and the cake maker's effect. The Chain Rule is like calculating that combined effect.
2. The Core Material
The Chain Rule is essential for differentiating functions that aren't just simple $x^n$ or $\sin(x)$. It applies when one function's output becomes the input for another function. We call these composite functions, written as $f(g(x))$.
The formal statement of the Chain Rule is:
If $h(x) = f(g(x))$, then $h'(x) = f'(g(x)) \cdot g'(x)$.
Let's break that down:
2.1 Identify the "Outer" and "Inner" Functions

Photo by Star Zhang on Pexels
The first step is to recognize which part is $f$ (the outer function) and which part is $g$ (the inner function).
* Outer function ($f$): This is the "wrapper" or the main operation being performed. It often involves powers, trig functions, exponentials, or logarithms applied to an entire expression.
* Inner function ($g$): This is the "stuff inside" the outer function. It's the expression that the outer function is acting upon.
For example, in $h(x) = (3x^2 + 5)^4$:
* The outer function $f$ is $(\text{something})^4$. If we let $u = 3x^2 + 5$, then $f(u) = u^4$.
* The inner function $g$ is $3x^2 + 5$. So, $g(x) = 3x^2 + 5$.
2.2 Differentiate the Outer Function (leaving the inner function alone)

Photo by https://kaboompics.com/ on Pexels
Once you've identified $f(u)$, find its derivative $f'(u)$. Crucially, when you do this, you treat the entire inner function $g(x)$ as a single variable $u$. Don't differentiate $g(x)$ yet.
Using our example $f(u) = u^4$:
* $f'(u) = 4u^3$.
* Substituting $u$ back with $g(x)$, we get $4(3x^2 + 5)^3$.
2.3 Differentiate the Inner Function

Photo by https://kaboompics.com/ on Pexels
Now, find the derivative of the inner function, $g'(x)$.
Using our example $g(x) = 3x^2 + 5$:
* $g'(x) = 6x$.
2.4 Multiply the Results

Photo by https://kaboompics.com/ on Pexels
The final step is to multiply the derivative of the outer function (with the inner function still inside it) by the derivative of the inner function.
So, $h'(x) = f'(g(x)) \cdot g'(x)$.
For our example: $h'(x) = 4(3x^2 + 5)^3 \cdot (6x)$.
Which simplifies to $h'(x) = 24x(3x^2 + 5)^3$.
Here's a visual flow of the process:
graph TD
A["Start with h(x) = f(g(x))"] --> B["Identify Outer Function f and Inner Function g"]
B --> C["Differentiate Outer Function f'(u), keeping g(x) as u"]
C --> D["Differentiate Inner Function g'(x)"]
D --> E["Multiply the results: f'(g(x)) * g'(x)"]
E --> F["Simplify (if possible)"]
2.5 The Power Rule with Chain Rule (Generalized Power Rule)
A very common application of the Chain Rule is with powers of functions. If $h(x) = [g(x)]^n$:
$h'(x) = n[g(x)]^{n-1} \cdot g'(x)$.
This is exactly what we did in our example $ (3x^2 + 5)^4 $. Here, $n=4$ and $g(x)=3x^2+5$.
3. Worked Example
Let's find the derivative of $y = \sin(e^{2x})$.
-
Identify outer and inner functions:
- Outer function $f(\text{stuff}) = \sin(\text{stuff})$.
- Inner function $g(x) = e^{2x}$.
-
Differentiate the outer function $f'(u)$ (where $u = g(x)$):
- If $f(u) = \sin(u)$, then $f'(u) = \cos(u)$.
- Substituting $u$ back with $e^{2x}$, we get $\cos(e^{2x})$.
-
Differentiate the inner function $g'(x)$:
- Here, $g(x) = e^{2x}$. This itself requires a chain rule!
- Outer for $e^{2x}$: $e^{\text{stuff}}$. Derivative is $e^{\text{stuff}}$.
- Inner for $e^{2x}$: $2x$. Derivative is $2$.
- So, the derivative of $e^{2x}$ is $e^{2x} \cdot 2$. (This is $g'(x)$).
- Here, $g(x) = e^{2x}$. This itself requires a chain rule!
-
Multiply the results:
- $y' = \text{derivative of outer} \cdot \text{derivative of inner}$
- $y' = \cos(e^{2x}) \cdot (2e^{2x})$
- $y' = 2e^{2x}\cos(e^{2x})$
This example shows that you can have nested chain rules, where the "inner" function itself requires the chain rule!
4. Key Takeaways
- The Chain Rule is for differentiating composite functions, $f(g(x))$.
- It involves taking the derivative of the outer function, leaving the inner function unchanged inside it.
- Then, you multiply that result by the derivative of the inner function.
- Think of it as peeling an onion: differentiate the outside layer, then multiply by the derivative of the next layer in.
- The Chain Rule often works with other derivative rules, especially the power rule (e.g., $(g(x))^n$).
- Don't forget to simplify your final answer if possible.
Common mistakes to avoid:
- Differentiating the inner function twice: Remember to only differentiate the inner function once for the $g'(x)$ part.
- Forgetting to multiply by $g'(x)$: This is the most common error; the multiplication step is crucial.
- Differentiating everything at once: You must keep the original inner function inside the derivative of the outer function. Don't differentiate $g(x)$ in $f'(g(x))$.
- Confusing inner and outer: Take time to correctly identify which function is which.
5. Now Try It
Find the derivative of $h(x) = \sqrt{\tan(x)}$. Work through the steps: identify outer/inner, differentiate outer, differentiate inner, then multiply. Success looks like arriving at $h'(x) = \frac{\sec^2(x)}{2\sqrt{\tan(x)}}$.
Frequently asked about Chain Rule
More from calculus
Get the full calculus curriculum
Clone the complete plan to your dashboard for unlimited AI-generated notes, practice quizzes, and a personalised revision schedule.
Save this course free