Chain Rule for Composite Functions
The Chain Rule: Differentiating Nested Functions
Why the chain rule is needed
A function can be built by feeding the output of one function into another. For example, in
f(x)=sin(etanx),the input x first goes through the tangent function. That result becomes the exponent of e, and the result of that exponential function becomes the input to sine.
This is a composition of functions: one function is applied to the output of another. The chain rule, also called the composition rule, explains how to differentiate such a function. Its central idea is to differentiate one layer at a time, moving from the outside of the expression inward, and multiply the derivatives of the layers.
For the example, the layers are:
- The outer function is sine.
- Inside sine is the exponential function.
- Inside the exponent is tangent.
The chain rule matters because knowing how to differentiate sine, the exponential function, and tangent separately is not enough by itself. The rule combines those individual derivatives in a way that accounts for how changes pass through each layer.
Breaking the function into simpler pieces
A helpful way to organize the calculation is to name each layer. Let
y=sinu,u=ev,v=tanx.These definitions describe the original function one step at a time. Starting with x, the expression produces v, then u, and finally y.
Each individual function is now straightforward to differentiate:
dudy=cosu,dvdu=ev,dxdv=sec2x.The first derivative comes from differentiating sine while keeping its input u in place. The second comes from differentiating ev with respect to v. The third is the derivative of tanx.
The chain rule combines these pieces:
dxdy=dudy⋅dvdu⋅dxdv.The intermediate variables help show why the factors fit together. In the derivative chain, the denominator du in the first factor corresponds to the numerator du in the next, and the dv terms correspond in the same way. This cancellation is a useful way to remember the structure of the rule, even though the chain rule is not simply ordinary fraction cancellation.
Substituting the derivatives gives
dxdy=cosu⋅ev⋅sec2x.The variables u and v were temporary labels, so they must be replaced with their definitions in terms of x. Since u=etanx and v=tanx, the derivative is
f′(x)=cos(etanx)⋅etanx⋅sec2x.Think About It
Why does this derivative contain three factors? Each factor represents the rate of change at one layer of the composition: sine, the exponential function, and tangent.
Applying the chain rule from the outside inward
With practice, the same calculation can be written directly without assigning names to the intermediate functions. The reasoning still follows the same sequence.
Begin with the outermost function, sine. Its derivative is cosine, and its input remains unchanged:
dxdsin(etanx)=cos(etanx)⋅dxd(etanx).The inside expression is still a composition, so it must also be differentiated. The derivative of the exponential function keeps the exponential expression in place and introduces the derivative of its exponent:
dxd(etanx)=etanx⋅dxd(tanx).The innermost function is tangent, whose derivative is sec2x. Putting the layers together gives
f′(x)=cos(etanx)⋅etanx⋅sec2x.This direct method is shorter, but it follows exactly the same logic as naming the intermediate functions. At every stage, the derivative of the current outer layer is multiplied by the derivative of what is inside it.
Knowing when to stop
The process stops when the innermost expression is simply x. Differentiating x with respect to x gives 1, so multiplying by that final factor would not change the result:
dxdx=1.For this example, the innermost function is tanx, and its derivative is sec2x. Since the argument has reached x, no further layers remain.
A common mistake is to differentiate the outside function but forget to multiply by the derivative of its inside. For instance, changing sine to cosine is only the first step; the factor arising from differentiating etanx must also be included. Likewise, differentiating the exponential layer requires the additional factor from differentiating tanx.
Think About It
If the innermost part of a nested expression were a different function of x, which part of the chain-rule calculation would need to change? Only the derivative of that innermost layer would change; the outside layers would still be handled in the same order.
A reliable strategy for nested functions
For a composition with several layers, the following approach keeps the work organized:
- Identify the outermost function.
- Differentiate it while leaving its input in place.
- Multiply by the derivative of that input.
- Continue inward, differentiating one layer at a time.
- Stop when the innermost expression is just the original variable.
For a function with many nested layers, temporary names such as u and v can make the structure easier to see. Once the method becomes familiar, the same steps can be carried out directly by moving inward through the expression.
Comprehensive review
The chain rule is used when a function is built by composing simpler functions. Its key principle is to differentiate each layer and multiply the resulting derivatives. In the example
f(x)=sin(etanx),the layers are handled from the outside inward:
- Sine contributes cos(etanx).
- The exponential function contributes etanx.
- Tangent contributes sec2x.
Therefore,
f′(x)=cos(etanx)⋅etanx⋅sec2x.Naming intermediate functions and differentiating them separately provides a clear setup, while the direct method provides a compact version of the same reasoning. In either approach, each inside layer contributes a derivative factor, and the process ends when the expression reaches the original variable.

Ask anything
We've read this whole study set, so questions about it get the best answers.