Nested Chain Rule
The Nested Chain Rule
When Functions Have Three or More Layers
What’s the derivative of $\sin(\cos(\tan x))$? This function has three layers:
- Outermost: $\sin(\square)$
- Middle: $\cos(\square)$
- Innermost: $\tan x$
The basic chain rule handles two functions composed together. For three or more, we extend the idea: peel away one layer at a time, multiplying the derivatives as we go.
The name “chain rule” really makes sense here: we are building a chain of derivatives, linking outer to middle to inner.
Prerequisite Map
Quick Reference
| Property | Value |
|---|---|
| Concept | Differentiation Rules |
| Chapter | Ch 3, §4 |
| Difficulty | Advanced |
| Time | ~15 minutes |
Key Concepts
The Extended Chain Rule
For a composition of three functions $y = f(g(h(x)))$:
$$\boxed{\frac{dy}{dx} = f'(g(h(x))) \cdot g'(h(x)) \cdot h'(x)}$$
In Leibniz notation with $y = f(u)$, $u = g(v)$, $v = h(x)$:
$$\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dv} \cdot \frac{dv}{dx}$$
The “Outside-In” Strategy
Work from the outermost function inward:
- Differentiate the outer function, keeping everything inside unchanged
- Multiply by the derivative of the next layer, keeping the rest unchanged
- Continue until you reach $x$
y = sin(cos(tan x))
├── outer: sin(□)
│ └── middle: cos(□)
│ └── inner: tan x
Step 1: cos(cos(tan x)) [derivative of outer at inner]
Step 2: × (-sin(tan x)) [derivative of middle at its inner]
Step 3: × sec²x [derivative of innermost]
Visualizing the Layers
┌─────────────────────────────────┐
│ Outer: f │ ← Differentiate first
│ ┌───────────────────────────┐ │
│ │ Middle: g │ │ ← Differentiate second
│ │ ┌─────────────────────┐ │ │
│ │ │ Inner: h(x) │ │ │ ← Differentiate third
│ │ └─────────────────────┘ │ │
│ └───────────────────────────┘ │
└─────────────────────────────────┘
Result: f'(g(h(x))) · g'(h(x)) · h'(x)
How to Identify the Layers
Ask yourself: “In what order would I compute this for a specific $x$?”
Example: $\sqrt{\sec(x^3)}$
To compute at $x = 2$:
- First compute $x^3 = 8$ (innermost)
- Then compute $\sec(8)$ (middle)
- Then compute $\sqrt{\sec(8)}$ (outermost)
So the layers are: $\sqrt{\square}$, then $\sec(\square)$, then $x^3$.
Common Nested Patterns
| Function | Outer | Middle | Inner | Derivative |
|---|---|---|---|---|
| $\sin^2(3x)$ | $(\square)^2$ | $\sin(\square)$ | $3x$ | $2\sin(3x)\cos(3x) \cdot 3 = 6\sin(3x)\cos(3x)$ |
| $\cos(\tan(x^2))$ | $\cos(\square)$ | $\tan(\square)$ | $x^2$ | $-\sin(\tan(x^2)) \cdot \sec^2(x^2) \cdot 2x$ |
| $\sqrt{1 + \sin x}$ | $\sqrt{\square}$ | none | $1 + \sin x$ | $\frac{1}{2\sqrt{1+\sin x}} \cdot \cos x$ |
Practice Problems
For the function $f(x) = \cos^3(2x)$, identify the outer, middle, and inner functions.
Find the derivative of $y = \sin^2(4x)$.
Differentiate $f(x) = \sqrt{\tan(x^2 + 1)}$.
Find $\frac{dy}{dx}$ for $y = \sin(\cos(\tan(\sec x)))$.
Let $F(x) = f(g(h(x)))$ where $f$, $g$, and $h$ are differentiable functions. Given the following values:
| Value at relevant point | |
|---|---|
| $h(1)$ | $2$ |
| $g(2)$ | $3$ |
| $h'(1)$ | $4$ |
| $g'(2)$ | $5$ |
| $f'(3)$ | $6$ |
Find $F'(1)$.
CCI-Style Conceptual Questions
When differentiating $\sin^2(\ln x)$, which function should you differentiate first?
- $\ln x$ (the innermost function)
- $\sin(\square)$ (the middle function)
- $(\square)^2$ (the outermost function)
- It doesn't matter what order you use
Common Misconceptions
the derivative of f(g(h(x))) is f’(x) times g’(x) times h’(x).
This is the composition-is-not-chaining error extended to three layers. Each outer derivative must be evaluated at the appropriate inner expression, not at x. For $y = \sin(\cos(\tan x))$, the derivative of the outermost sine is $\cos(\cos(\tan x))$, not $\cos(x)$. Treating the outermost derivative as $\cos(x)$ discards all information about the middle and inner layers and produces a result that is wrong at every point.
when differentiating nested compositions, the order in which the factors appear does not matter.
This is the action-view-of-function error applied to nested structure. Each derivative factor in $f'(g(h(x))) \cdot g'(h(x)) \cdot h'(x)$ is evaluated at a different input: the outermost at $g(h(x))$, the middle at $h(x)$, and the innermost at $x$. Shuffling the evaluation points -- for example writing $f'(h(x)) \cdot g'(g(x)) \cdot h'(x)$ -- gives an expression that is numerically different and structurally incorrect.
Mastery Checklist
Mental Model
The Assembly Line:
Picture a factory assembly line with three machines in sequence. Raw material ($x$) goes in one end:
- Machine 1 ($h$) transforms it
- Machine 2 ($g$) transforms that result
- Machine 3 ($f$) produces the final output ($y$)
If you want to know how a small change in raw material affects the final product, you multiply the “sensitivity” of each machine:
$$\text{Total effect} = \text{Machine 3 sensitivity} \times \text{Machine 2 sensitivity} \times \text{Machine 1 sensitivity}$$
Each machine’s sensitivity is its derivative, evaluated at whatever input it actually receives.
Connections
Looking back:
- This extends the two-function chain rule to arbitrarily many compositions
- Each layer contributes a multiplicative factor to the total derivative
Looking ahead:
- Implicit differentiation applies this idea where one “layer” is the unknown function $y(x)$
- Related rates problems chain together multiple quantities that all depend on time
- Taylor series expansion of nested functions requires repeated nested differentiation
| Previous | Up | Next |
|---|---|---|
| Generalized Power Rule | Skills Index | Implicit Differentiation |
Last updated: 2026-01-22