A composite function is a function inside another function. Before you can use the chain rule, you have to identify the layers.
Example 1:f(x)=cos(x3)
Outer: f(u)=cosu
Inner: g(x)=x3
Example 2:f(x)=lnx
Outer: f(u)=u
Inner: g(x)=lnx
Example 3:f(x)=sin(cos(2x))
Outer: f(u)=sinu
Middle: g(u)=cosu
Inner: h(x)=2x
That one has three layers, like an onion. You peel away one layer at a time when you differentiate.
The Formula
For a composite function f(g(x)):
dxd[f(g(x))]=f′(g(x))⋅g′(x)
In words: take the derivative of the outer function (leaving the inside alone), then multiply by the derivative of the inside.
The “onion rule”: peel one layer at a time, taking derivatives as you go from outside to inside.
Leibniz form. If y=f(u) and u=g(x), the chain rule says:
dxdy=dudy⋅dxdu
Same rule, different notation: the rate of change of the outer function times the rate of change of the inner function. The du’s look like they cancel, which makes it easy to remember (they aren’t really fractions, but they behave like them). In Example 1 below, y=u5 and u=3x2−7, so dudy=5u4 and dxdu=6x.
This form is handy for word problems because the units chain together too. Say the air temperature T (in °C) depends on the height h of a weather balloon (in meters), and the height depends on time t (in minutes). If dhdT=−0.0065 °C per meter and the balloon rises at dtdh=40 meters per minute, then:
dtdT=dhdT⋅dtdh=(−0.0065)(40)=−0.26∘C per minute
Check the units: min∘C=m∘C⋅minm. The meters cancel, just like the dh’s.
Basic Examples
Example 1: Power Function Composition
Find dxd[(3x2−7)5].
Outer: u5, derivative 5u4
Inner: 3x2−7, derivative 6x
dxd[(3x2−7)5]=5(3x2−7)4⋅6x=30x(3x2−7)4
Without the chain rule you’d have to fully expand (3x2−7)5, which would be miserable.
Example 2: Square Root Composition
Find dxd[5x+2].
Recall dxd[x]=2x1.
Outer: u, derivative 2u1
Inner: 5x+2, derivative 5
dxd[5x+2]=25x+21⋅5=25x+25
Example 3: Squared Trig Function (common error)
Find dxd[cos2(3x)].
First, understand that cos2(3x)=[cos(3x)]2. That gives you three layers:
Common mistake: forgetting that the square is its own layer. People often write −sin2(3x)⋅3, which is wrong.
Logarithmic Functions with the Chain Rule
Method 1: Direct Chain Rule
Find dxd[ln(x4)].
dxd[ln(x4)]=x41⋅4x3=x44x3=x4
Method 2: Use Log Properties First
Using the power rule for logs, ln(x4)=4lnx:
dxd[4lnx]=4⋅x1=x4
Same answer. Method 2 is faster whenever you just have a variable raised to a power inside the log.
Exponential and Trig Functions with the Chain Rule
Every basic derivative from Unit 2 works the same way inside the chain rule: take the usual derivative, leave the inside alone, then multiply by the derivative of the inside.
Common mistake: using the power rule and writing (x2−4x)ex2−4x−1. The variable is in the exponent, so the power rule doesn’t apply. The other classic error is stopping at ex2−4x and forgetting to multiply by 2x−4.