1. Home
  2. Explore
  3. Mathematics
  4. Chain Rule for Composite Functions

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

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⁡(etan⁡x),f(x)=\sin\left(e^{\tan x}\right),f(x)=sin(etanx),

the input xxx first goes through the tangent function. That result becomes the exponent of eee, 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:

  1. The outer function is sine.
  2. Inside sine is the exponential function.
  3. 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=sin⁡u,u=ev,v=tan⁡x.y=\sin u,\qquad u=e^v,\qquad v=\tan x.y=sinu,u=ev,v=tanx.

These definitions describe the original function one step at a time. Starting with xxx, the expression produces vvv, then uuu, and finally yyy.

Each individual function is now straightforward to differentiate:

dydu=cos⁡u,dudv=ev,dvdx=sec⁡2x.\frac{dy}{du}=\cos u,\qquad \frac{du}{dv}=e^v,\qquad \frac{dv}{dx}=\sec^2 x.dudy​=cosu,dvdu​=ev,dxdv​=sec2x.

The first derivative comes from differentiating sine while keeping its input uuu in place. The second comes from differentiating eve^vev with respect to vvv. The third is the derivative of tan⁡x\tan xtanx.

The chain rule combines these pieces:

dydx=dydu⋅dudv⋅dvdx.\frac{dy}{dx} = \frac{dy}{du}\cdot\frac{du}{dv}\cdot\frac{dv}{dx}.dxdy​=dudy​⋅dvdu​⋅dxdv​.

The intermediate variables help show why the factors fit together. In the derivative chain, the denominator dududu in the first factor corresponds to the numerator dududu in the next, and the dvdvdv 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

dydx=cos⁡u⋅ev⋅sec⁡2x.\frac{dy}{dx} = \cos u\cdot e^v\cdot\sec^2 x.dxdy​=cosu⋅ev⋅sec2x.

The variables uuu and vvv were temporary labels, so they must be replaced with their definitions in terms of xxx. Since u=etan⁡xu=e^{\tan x}u=etanx and v=tan⁡xv=\tan xv=tanx, the derivative is

f′(x)=cos⁡(etan⁡x)⋅etan⁡x⋅sec⁡2x.f'(x) = \cos\left(e^{\tan x}\right)\cdot e^{\tan x}\cdot\sec^2 x.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:

ddxsin⁡(etan⁡x)=cos⁡(etan⁡x)⋅ddx(etan⁡x).\frac{d}{dx}\sin\left(e^{\tan x}\right) = \cos\left(e^{\tan x}\right)\cdot \frac{d}{dx}\left(e^{\tan x}\right).dxd​sin(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:

ddx(etan⁡x)=etan⁡x⋅ddx(tan⁡x).\frac{d}{dx}\left(e^{\tan x}\right) = e^{\tan x}\cdot\frac{d}{dx}\left(\tan x\right).dxd​(etanx)=etanx⋅dxd​(tanx).

The innermost function is tangent, whose derivative is sec⁡2x\sec^2 xsec2x. Putting the layers together gives

f′(x)=cos⁡(etan⁡x)⋅etan⁡x⋅sec⁡2x.f'(x) = \cos\left(e^{\tan x}\right)\cdot e^{\tan x}\cdot\sec^2 x.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 xxx. Differentiating xxx with respect to xxx gives 111, so multiplying by that final factor would not change the result:

ddxx=1.\frac{d}{dx}x=1.dxd​x=1.

For this example, the innermost function is tan⁡x\tan xtanx, and its derivative is sec⁡2x\sec^2 xsec2x. Since the argument has reached xxx, 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 etan⁡xe^{\tan x}etanx must also be included. Likewise, differentiating the exponential layer requires the additional factor from differentiating tan⁡x\tan xtanx.

Think About It

If the innermost part of a nested expression were a different function of xxx, 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:

  1. Identify the outermost function.
  2. Differentiate it while leaving its input in place.
  3. Multiply by the derivative of that input.
  4. Continue inward, differentiating one layer at a time.
  5. Stop when the innermost expression is just the original variable.

For a function with many nested layers, temporary names such as uuu and vvv 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⁡(etan⁡x),f(x)=\sin\left(e^{\tan x}\right),f(x)=sin(etanx),

the layers are handled from the outside inward:

  • Sine contributes cos⁡(etan⁡x)\cos\left(e^{\tan x}\right)cos(etanx).
  • The exponential function contributes etan⁡xe^{\tan x}etanx.
  • Tangent contributes sec⁡2x\sec^2 xsec2x.

Therefore,

f′(x)=cos⁡(etan⁡x)⋅etan⁡x⋅sec⁡2x.f'(x) = \cos\left(e^{\tan x}\right)\cdot e^{\tan x}\cdot\sec^2 x.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.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent