Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

How to Differentiate Composite Functions

A composite function is one function fed into another. You differentiate it from the outside in: the outer function’s derivative, evaluated at the inside, times the inside’s derivative.

Recognize the task

There is an expression inside another function: a power of a bracket (3x+1)5(3x+1)^5, a function of a non-trivial argument sin⁡(x2)\sin(x^2), e−x2e^{-x^2}, ln⁡(cos⁡x)\ln(\cos x). If you would have to evaluate the inside first to get a number, it is composite.
Compositions are defined in the function composition lesson.

Two ways to do it

Outside-in (Lagrange)usual choice
(f∘g)′(x)=f′(g(x))⋅g′(x)(f\circ g)'(x) = f'(g(x))\cdot g'(x)
Fastest once you can see the layers. It is the chain rule applied directly.
Substitution (Leibniz)for deep nesting
dydx=dydu⋅dudx\frac{dy}{dx} = \frac{dy}{du}\cdot\frac{du}{dx}
Name the inside uu and differentiate each layer separately. Same chain rule, one layer at a time.

Steps

StepOn y=sin⁡(x2)y = \sin(x^2)
1Split into layers. Name the outer function and the inner expression.outer sin⁡u\sin u, inner u=x2u = x^2
2Differentiate the outer layer, keeping the inside untouched. Here that is the derivative of sine.Trig derivative rules ↗cos⁡(x2)\cos(x^2)
3Differentiate the inner layer with the power rule.Power rule ↗2x2x
4Multiply the two results, as the chain rule requires. If the inner layer is itself composite, repeat from step 1 on it.Chain rule ↗2xcos⁡(x2)2x\cos(x^2)

Worked examples

Example 1 · power of a bracket

2 layers
y=(3x+1)5y = (3x+1)^5
outer u5u^5, inner 3x+13x+1
y′=5(3x+1)4⋅3y' = 5(3x+1)^4 \cdot 3
outer derivative × inner derivative
y′=15(3x+1)4y' = 15(3x+1)^4
simplify

Example 2 · three layers

3 layers
y=esin⁡2xy = e^{\sin 2x}
exp⁡→sin⁡→2x\exp \to \sin \to 2x
y′=esin⁡2x⋅cos⁡2x⋅2y' = e^{\sin 2x}\cdot \cos 2x \cdot 2
one factor per layer, outside in
y′=2cos⁡(2x) esin⁡2xy' = 2\cos(2x)\,e^{\sin 2x}
reorder

Example 3 · logarithm of a trig function

2 layers
y=ln⁡(cos⁡x)y = \ln(\cos x)
outer ln⁡u\ln u, inner cos⁡x\cos x
y′=1cos⁡x⋅(−sin⁡x)y' = \frac{1}{\cos x}\cdot(-\sin x)
(ln⁡u)′=1/u(\ln u)' = 1/u, times (cos⁡x)′(\cos x)'
y′=−tan⁡xy' = -\tan x
simplify

See it happen

A small change in xx is stretched by 2x2x on the way into the inner function, then by cos⁡u\cos u on the way out. The total stretch is the product: that is why the chain rule multiplies.

Common mistakes

Forgetting the inner derivative

✗ (sin⁡x2)′=cos⁡x2(\sin x^2)' = \cos x^2
✓ (sin⁡x2)′=2xcos⁡x2(\sin x^2)' = 2x\cos x^2

Changing the inside of the outer derivative

✗ (e3x)′=e3⋅3(e^{3x})' = e^{3}\cdot 3
✓ (e3x)′=3e3x(e^{3x})' = 3e^{3x}

Using the product rule instead

✗ sin⁡(x2)\sin(x^2) treated as sin⁡⋅x2\sin \cdot x^2
✓ composition is not multiplication

Stopping one layer early

✗ (esin⁡2x)′=esin⁡2xcos⁡2x(e^{\sin 2x})' = e^{\sin 2x}\cos 2x
✓ one factor per layer: the ⋅2\cdot 2 is missing