Chain Rule for Composite Functions
From the differentiation curriculum
TL;DR
When you need to differentiate a function within another function, the Chain Rule helps you break it down. It involves taking the derivative of the "outer" function first, then multiplying by the derivative of the "inner" function. This rule is super useful for many complex functions you'll encounter.
1. The Mental Model
Imagine you're peeling an onion: you deal with the outer layer first, then the next layer inside, and so on. The Chain Rule works similarly for functions – you differentiate from the outside in.
2. The Core Material
The Chain Rule is your go-to tool when you have a composite function. A composite function is essentially a function inside another function. Think of it like $f(g(x))$. Here, $g(x)$ is the "inner" function, and $f$ is the "outer" function that operates on the output of $g(x)$.
The formal statement of the Chain Rule is:
If $y = f(g(x))$, then its derivative with respect to $x$ is:
$dy/dx = f'(g(x)) * g'(x)$
Let's break that down:
Identifying Inner and Outer Functions

Photo by Shubham Dhage on Pexels
The first step is always to figure out what's inside and what's outside.
- Outer function ($f$): This is the main operation or form of the function.
- Inner function ($g$): This is the "stuff" inside the outer function.
For example, in $y = (x^2 + 3x)^5$:
* The outer function is something raised to the power of 5: $f(u) = u^5$.
* The inner function is the base: $g(x) = x^2 + 3x$.
Applying the Rule Step-by-Step

Photo by Jan van der Wolf on Pexels
- Differentiate the outer function: Treat the entire inner function as a single variable (let's call it $u$). Find the derivative of the outer function with respect to $u$. So, for $f(u) = u^5$, $f'(u) = 5u^4$.
- Substitute the inner function back: Replace $u$ with the original inner function $g(x)$. So, $5(x^2 + 3x)^4$. This is $f'(g(x))$.
- Differentiate the inner function: Find the derivative of $g(x)$ with respect to $x$. For $g(x) = x^2 + 3x$, $g'(x) = 2x + 3$.
- Multiply the results: Multiply the derivative of the outer function (with the inner function substituted back in) by the derivative of the inner function.
So, $dy/dx = 5(x^2 + 3x)^4 * (2x + 3)$.
Here's a visual flow of the process:
graph TD
A["Start with y = f(g(x))"] --> B["Identify Outer Function (f)"]
B --> C["Identify Inner Function (g)"]
C --> D["Calculate f'(u) (derivative of outer function)"]
D --> E["Substitute g(x) back into f'(u) to get f'(g(x))"]
E --> F["Calculate g'(x) (derivative of inner function)"]
F --> G["Multiply f'(g(x)) * g'(x)"]
G --> H["This is dy/dx (your final derivative)"]
Chain Rule with Multiple Layers

Photo by Edward Jenner on Pexels
Sometimes you'll have functions nested even deeper, like $f(g(h(x)))$. Don't worry, the Chain Rule extends! You just keep applying it from the outside in.
For $y = f(g(h(x)))$, the derivative is:
$dy/dx = f'(g(h(x))) * g'(h(x)) * h'(x)$
You're essentially peeling more layers of the onion.
3. Worked Example
Let's find the derivative of $y = \sin(e^{4x})$.
-
Identify functions:
- Outermost function: $\sin(u)$, where $u = e^{4x}$. Let $f(u) = \sin(u)$.
- Middle function: $e^v$, where $v = 4x$. Let $g(v) = e^v$.
- Innermost function: $4x$. Let $h(x) = 4x$.
-
Differentiate the outermost function:
- If $f(u) = \sin(u)$, then $f'(u) = \cos(u)$.
- Substitute $u = e^{4x}$ back: $\cos(e^{4x})$.
-
Differentiate the middle function:
- If $g(v) = e^v$, then $g'(v) = e^v$.
- Substitute $v = 4x$ back: $e^{4x}$.
-
Differentiate the innermost function:
- If $h(x) = 4x$, then $h'(x) = 4$.
-
Multiply all the derivatives together:
$dy/dx = \cos(e^{4x}) * e^{4x} * 4$
Rearranging it for clarity:
$dy/dx = 4e^{4x} \cos(e^{4x})$
4. Key Takeaways
- The Chain Rule is for differentiating composite functions (functions within functions).
- Always work from the outside in, like peeling an onion.
- Differentiate the outer function first, treating the inner function as a single variable.
- Then, multiply by the derivative of the inner function.
- If there are multiple layers, repeat the process for each nested function.
- Don't forget to substitute the original inner function(s) back after differentiating each "layer."
Common Mistakes to Avoid:
- Forgetting to multiply by the inner derivative: This is the most common error.
- Differentiating the inner function twice: You differentiate the outer function with respect to its "input," and then you differentiate the inner function with respect to its own input (usually $x$). Don't mix them up.
- Getting the order wrong: Always outer derivative * inner derivative, not the other way around.
- Confusing constants with functions: Make sure you correctly identify what's a constant multiplier and what's part of a function.
5. Now Try It
Take 15 minutes to find the derivative of $y = \sqrt{\tan(x^3 + 2)}$.
Think about the three layers here: the square root, the tangent function, and the polynomial inside the tangent. Apply the Chain Rule step-by-step for each layer.
Success looks like: You should get $dy/dx = \frac{3x^2 \sec^2(x^3+2)}{2\sqrt{\tan(x^3+2)}}$. If you get stuck, re-examine how you differentiated each individual layer.
Frequently asked about Chain Rule for Composite Functions
More from differentiation
Get the full differentiation curriculum
Clone the complete plan to your dashboard for unlimited AI-generated notes, practice quizzes, and a personalised revision schedule.
Save this course free