Chain Rule for Composite Functions
The Chain Rule for Nested Functions
The chain rule—also called the composition rule—finds the derivative of a function built by applying one function to the output of another. For a nested function, the derivative is the product of the derivatives at each layer.
Consider the example
This function has three layers:
The innermost function is tanx.
The next function applies the exponential, producing etanx.
The outermost function takes the sine, producing sin(etanx).
The derivative is found by working through these layers and multiplying the derivatives together.
A systematic method using intermediate functions
When a function has several nested layers, it can help to name each intermediate quantity. For this example, define
Equivalently, the outer function is u=sinv, the next function is v=ew, and the innermost function is w=tanx. Each layer is now simple to differentiate with respect to its input:
The chain rule combines these derivatives in order:
The intermediate variables cancel in the same way they would in a fraction, leaving the derivative with respect to x. Substituting the derivatives gives
Since v=ew and w=tanx, replacing the intermediate variables with their expressions in x gives
Thus,
The names of the intermediate variables are only temporary aids. The final derivative must be written in terms of the original variable, x.
Working from the outside inward
With practice, the same derivative can be found directly without naming intermediate functions. The method is to differentiate the outermost function first, preserve its input, and then multiply by the derivative of that input.
For f(x)=sin(etanx):
The outermost function is sine. Its derivative is cosine, and its input remains unchanged:
cos(etanx).The input to the sine is etanx. Differentiating the exponential gives the exponential multiplied by the derivative of its input:
etanx⋅dxd(tanx).The remaining input is tanx. Its derivative is sec2x.
Multiplying the derivatives from each layer gives
This outside-in process follows the same chain of layers as the method with intermediate variables. At each stage, the current input is retained while its derivative is included as another factor.
Key principles and common errors
Differentiate every layer. A nested function requires one derivative factor for each layer, moving from the outside inward.
Preserve each input while differentiating its function. For example, differentiating sin(g(x)) gives cos(g(x)) multiplied by g′(x); the argument g(x) does not disappear.
Multiply the derivative factors. The chain rule combines the derivatives of the nested functions by multiplication, not addition.
Stop at the original variable. Once the innermost input is x, its derivative with respect to itself is 1, so no additional factor changes the result.
Substitute back into the original variable. Intermediate variables make the work clearer, but the final derivative should ordinarily be expressed using x.
For a composition, differentiate the outer function, keep its input, and multiply by the derivative of that input; repeat until reaching the original variable.

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