Chain Rule for Derivatives: Formula, Examples and Common Forms
The chain rule: the derivative of f(g(x)) is f'(g(x))·g'(x). The formula in both notations, a table of common forms, worked examples and mistakes.
Derivative rules Updated 2 min read
At a glance
- Applies to
- Compositions, a function inside another function
- In words
- Derivative of the outside (inside left alone) times the derivative of the inside
- Leibniz form
- \frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}
- Spot it
- Anything other than plain x inside a power, root, trig, exponential or log
- Integral version
- U-substitution
On this page
The chain rule differentiates a composition, one function inside another. You take the derivative of the outer function, leave the inner function alone, and multiply by the derivative of the inner function. Almost every non-trivial derivative uses it.
The chain rule formula
If g is differentiable at x and f is differentiable at g(x), then
In Leibniz notation, with y = f(u) and u = g(x):
Think of rates multiplying: if y changes 3 times as fast as u, and u changes 2 times as fast as x, then y changes 3 \cdot 2 = 6 times as fast as x.
Common chain rule forms
Here u is any differentiable function of x and u' is its derivative.
| Function | Derivative |
|---|---|
| u^n | n\,u^{n-1}\,u' |
| \sqrt{u} | \frac{u'}{2\sqrt{u}} |
| e^u | e^u\,u' |
| \ln u | \frac{u'}{u} |
| \sin u | \cos u \cdot u' |
| \cos u | -\sin u \cdot u' |
| \tan u | \sec^2 u \cdot u' |
Worked examples
Example 1: a power of a polynomial. Outer: u^5. Inner: u = x^2 + 1, u' = 2x:
Example 2: trig. Outer: \sin u. Inner: u = 3x:
Example 3: exponential. Outer: e^u. Inner: u = x^2:
Example 4: a square root. Write \sqrt{4x - 1} = (4x - 1)^{1/2}:
Example 5: logarithm. Outer: \ln u. Inner: u = \cos x:
Example 6: three layers. \sin^2(5x) means [\sin(5x)]^2. Peel from the outside: square, then sine, then 5x:
How to spot a composition
Ask: "To evaluate this at a number, what would I compute last?" That last operation is the outer function. Everything it acts on is the inner function.
- (3x + 1)^4: last step is raising to the 4th power. Inner is 3x + 1.
- e^{\sin x}: last step is e^{(\ )}. Inner is \sin x.
- \sin x^2 usually means \sin(x^2): inner is x^2. But \sin^2 x means (\sin x)^2: inner is \sin x.
If the inner function is just x, the inner derivative is 1 and the chain rule changes nothing.
Common mistakes
- Forgetting the inner derivative. \frac{d}{dx}\,(3x + 1)^4 = 4(3x + 1)^3 \cdot 3, not 4(3x + 1)^3. This is the most common derivative error of all.
- Changing the inside. The outer derivative is evaluated at the original inner function: \frac{d}{dx}\sin(x^2) = \cos(x^2) \cdot 2x, not \cos(2x).
- Confusing it with the product rule. \sin(x^2) is a composition, while x^2\sin x is a product. See the product rule.
- Stopping after one layer. In e^{\sin(2x)} there are three layers, and the answer 2\cos(2x)\,e^{\sin(2x)} needs all three derivatives.
The chain rule is also the engine behind implicit differentiation, related rates and u-substitution. For a longer walkthrough with more practice problems, read the full guide to the chain rule.
Practice it now
Chain rule: any function
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson