The chain rule differentiates a composite function, one function applied to the output of another. If y=f(g(x)), then
dxdy=f′(g(x))⋅g′(x)
In words: differentiate the outer function (leaving the inner function alone), then multiply by the derivative of the inner function.
The same rule in Leibniz notation
Naming the inner function makes the rule easier to apply. If y=f(u) and u=g(x), then:
dxdy=dudy⋅dxdu
It reads as if the du terms cancel. They don't really cancel, but it's a reliable way to remember which derivative goes where, and it extends to longer chains: dxdy=dvdy⋅dudv⋅dxdu.
Common chain-rule patterns
Each standard derivative, with the inner function's derivative multiplied on
Function
Derivative
[g(x)]n
n[g(x)]n−1⋅g′(x)
eg(x)
eg(x)⋅g′(x)
lng(x)
g(x)g′(x)
sing(x)
cosg(x)⋅g′(x)
cosg(x)
−sing(x)⋅g′(x)
tang(x)
sec2g(x)⋅g′(x)
1. Derivative of sin(ln(x))
Find the derivative of f(x)=sin(ln(x)).
Solution: The outer function is sin(u), the inner function is u=ln(x). Since dudsin(u)=cos(u) and dxdln(x)=x1,
f′(x)=cos(ln(x))⋅x1=xcos(ln(x))
2. Derivative of sec(tan(√x))
Find the derivative of sec(tan(x)) with respect to x. This nests three functions, so the chain rule is applied twice.
Solution: Let u=x, v=tan(u), and differentiate sec(v) from the outside in:
dxdu=2x1,dudv=sec2(u),dvdsec(v)=sec(v)tan(v)
Multiplying the three pieces together (the chain rule again):
2x1⋅sec(tan(x))⋅tan(tan(x))⋅sec2(x)
3. A power of a trig function
Differentiate y=sin3x.
Solution:sin3x means (sinx)3, so the outer function is a cube and the inner function is u=sinx:
dxdy=dudy⋅dxdu=3u2⋅cosx=3sin2xcosx
4. A power of a polynomial
Differentiate y=(3x2+1)5.
Solution: Expanding the fifth power would be slow. With u=3x2+1, dxdu=6x:
dxdy=5(3x2+1)4⋅6x=30x(3x2+1)4
Common mistakes
Forgetting the inner derivative.dxdsin(2x)=2cos(2x), not cos(2x). This is the most common chain-rule error by far.
Confusing sin2x with sin(x2).sin2x=(sinx)2 has derivative 2sinxcosx. sin(x2) has derivative 2xcos(x2).
Changing the inside of the outer function. In dxdsin(x2)=cos(x2)⋅2x, the cosine still contains x2. Only the multiplier outside is the inner derivative.
Stopping one layer early. In a three-layer chain like sec(tanx) there are three factors to multiply, one per layer.
Continue learning
Many definite integrals are solved by spotting a chain-rule pattern in reverse, so the two techniques are worth learning back to back.