Achievable logoAchievable logo
AP Calculus AB
Sign in
Sign up
Purchase
Textbook
Practice exams
Support
How it works
Exam catalog
Mountain with a flag at the peak
Textbook
Introduction
1. Limits
2. Derivative basics
3. Advanced differentiation
3.1 Chain rule
3.2 Implicit differentiation
3.3 Higher order derivatives
3.4 Logarithmic differentiation
3.5 Derivatives of inverse functions
3.6 Inverse trig derivatives
4. Contextual uses
5. Analytical uses
6. Integration
7. Differential equations
8. Applications of integrals
Wrapping up
Achievable logoAchievable logo
3.1 Chain rule
Achievable AP Calculus AB
3. Advanced differentiation
Our AP Calculus AB course is now in "early access" - get 50% off for a limited time.

Chain rule

9 min read
Font
Discuss
Share
Feedback

What you’ll learn

  • How to differentiate composite functions with the chain rule
  • Applying the chain rule with logarithmic, exponential, trig, and power functions
  • Combining the chain rule with product and quotient rules

To find the derivative of a function like h(x)=(2x+1)3, expanding and then applying the power rule is correct but inefficient.

Instead, a faster method called the chain rule is used to differentiate composite functions - functions built by nesting one function into another.

Chain rule:

dxd​[f(g(x))]=f′(g(x))⋅g′(x)

In other words,

  1. Differentiate the outer function, keeping the inner function intact.
  2. Multiply it by the derivative of the inner function.

Another common way to write the chain rule uses Leibniz notation:

If y=f(g(x)) (composite function) and u=g(x) (inner function), then y=f(u) and

dxdy​=dudy​⋅dxdu​

Examples

  1. Differentiate

y=(2x+1)3

Solution

(spoiler)

y is a composite function, so we identify the inner and outer parts. Below, the inner function is boxed:

outer(2x+1​​inner​)3​​

For clarity,

  • Outer function: f(u)=u3
  • Inner function: g(x)=2x+1

Apply the Chain Rule: differentiate the outer function (using the power rule) while leaving the inner function untouched, then multiply by the derivative of the inner function.

y′​=3(2x+1)2​derivative of outer​⋅dxd​(2x+1)​derivative of inner​=3(2x+1)2⋅(2)=6(2x+1)2​

Let’s try one with the natural logarithm. Recall from section 2.5 that dxd​[ln(x)]=x1​.

  1. Differentiate

h(x)=ln(3x2+x)

Solution

(spoiler)

h(x) is a composite function f(g(x)) with:

outerln(3x2+x​​inner​)​​

For clarity,

  • Outer function: f(u)=ln(u)
  • Inner function: g(x)=3x2+x

Applying the chain rule, differentiate the outer function while keeping the inner function intact, then multiply by the derivative of the inner function:

h′(x)​=f′(g(x))⋅g′(x)=3x2+x1​⋅dxd​(3x2+x)=3x2+x1​⋅(6x+1)=3x2+x6x+1​​

Similarly, recall that for exponential functions,

dxd​(ex)=ex

and

dxd​(bx)=bxln(b)

  1. Differentiate:

a) a(x)=e−2x

b) b(x)=23x+1

Solutions

a) a(x)=e−2x

(spoiler)

a(x) is a composite function, where

  • Outer function: f(u)=eu
  • Inner function: g(x)=−2x

Applying the chain rule,

a′(x)​=f′(g(x))⋅g′(x)=e−2x⋅dxd​(−2x)=e−2x⋅(−2)=−2e−2x​

b) b(x)=23x+1

(spoiler)

b(x) consists of

  • Outer function: f(u)=2u
  • Inner function: g(x)=3x+1

b′(x)​=f′(g(x))⋅g′(x)=23x+1ln(2)⋅dxd​(3x+1)=23x+1ln(2)⋅(3)=3ln(2)⋅23x+1​

Combining rules

The chain rule often appears together with other derivative rules. The main thing to watch is order: decide which overall structure you have first (product, quotient, or composition), then apply the needed rules inside that structure.

For example, the following problem uses the product rule first, and then uses the chain rule while differentiating one of the factors.

  1. Differentiate

h(x)=3x(x2−1)3

Solution

(spoiler)

h(x) is a product of two functions:

  • f(x)=3x

  • g(x)=(x2−1)3

Notice that g(x) is composite, so the chain rule is needed to find g′(x).

Function Expression
f(x) 3x
f′(x) 3
g(x) (x2−1)3
g′(x) 3(x2−1)2⋅2x

Putting these into the product rule:

h′(x)​=f(x)g′(x)+f′(x)g(x)=3x⋅[3(x2−1)2⋅2x]+3⋅(x2−1)3=18x2(x2−1)2+3(x2−1)3​

To simplify, factor out the common factors 3 and (x2−1)2:

=3(x2−1)2[6x2+(x2−1)]=3(x2−1)2(7x2−1)

Contrast that with the next problem, which uses the power rule first, and then the product rule when applying the chain rule and differentiating the inner function.

  1. Differentiate

h(x)=(exsinx)2

Solution

(spoiler)

h(x) is a composite function, where:

  • Outer function: f(u)=u2

  • Inner function: g(x)=exsinx

Applying the chain rule,

h′(x)=2(exsinx)⋅dxd​(exsinx)

To differentiate exsinx), apply the product rule

dxd​(exsinx)​=excosx+exsinx=ex(cosx+sinx)​

Then

h′(x)​=2exsinx⋅ex(cosx+sinx)=2e2xsinx(cosx+sinx)​

  1. Differentiate

h(x)=2(x2+1)2x​

Solution

(spoiler)

For easier algebra, pull out the constant multiple 21​:

h(x)=21​⋅(x2+1)2x​

Now h(x) is a quotient of two functions:

  • f(x)=x
  • g(x)=(x2+1)2

Use the quotient rule. Note that g(x) is composite, so the chain rule is needed for g′(x).

Function Expression
f(x) x
f′(x) 1
g(x) (x2+1)2
g′(x) 4x(x2+1)

Putting the pieces into the quotient rule:

h′(x)=21​⋅(g(x))2g(x)f′(x)−f(x)g′(x)​=21​⋅(x2+1)4(x2+1)2(1)−x⋅4x(x2+1)​=2(x2+1)4(x2+1)2−4x2(x2+1)​=2(x2+1)4(x2+1)(x2+1−4x2)​=2(x2+1)31−3x2​

You can also reach the same answer by rewriting

h(x)=21​x(x2+1)−2

and applying the product rule while using the chain rule on (x2+1)−2.

Using tables

Some questions ask you to apply derivative rules using only a table of values:

f(x),g(x), and their derivatives have the following values shown in the table:

x f(x) g(x) f′(x) g′(x)
1 3 2 −1 5
2 0.2 0.5 5 3
3 −1 1 4 −3

Find h′(1) given

h(x)=f(g(x)−x2)

Solution

(spoiler)

Because h(x)=f(g(x)−x2) is a composite function, apply the chain rule:

dxd​[f(g(x)−x2)]

=f′(g(x)−x2)⋅(g′(x)−2x)

Now evaluate at x=1:

h′(1)=f′(g(1)−12)⋅(g′(1)−2(1))=f′(2−1)⋅(5−2)=f′(1)⋅3=−1⋅3=−3

Challenge problems

  1. Differentiate

h(t)=32π−πt​

Solution

(spoiler)

Rewrite the square root as a power:

h(t)=3(2π−πt)1/2

Then h(t) consists of

  • Outer: f(u)=3u1/2
  • Inner: g(t)=2π−πt

Applying the chain rule (remembering that π is a constant),

h′(t)​=f′(g(t))⋅g′(t)=23​(2π−πt)−1/2⋅dtd​(2π−πt)=23​(2π−πt)−1/2⋅(−π)=−22π−πt​3π​​

  1. Differentiate

h(x)=ecosxex2​

Solution

(spoiler)

Instead of using the quotient rule, rewrite the expression using anam​=am−n:

h(x)=ex2−cosx

Then h(x) consists of

  • Outer: f(u)=eu
  • Inner: g(x)=x2−cosx

Applying the chain rule,

h′(x)​=f′(g(x))⋅g′(x)=ex2−cosx⋅dxd​(x2−cosx)=ex2−cosx⋅(2x−(−sinx))=(ex2−cosx)(2x+sinx)​

  1. Differentiate

A(x)=sin3(x2)

Solution

(spoiler)

First, rewrite as

A(x)=[sin(x2)]3

This function has multiple layers of composition and requires two applications of the chain rule:

  • Outer: f(u)=u3⟹f′(u)=3u2
  • Middle: g(v)=sin(v)⟹g′(v)=cos(v)
  • Inner: h(x)=x2⟹h′(x)=2x

Apply the chain rule by “unfolding” each layer:

A′(x)​=3[sin(x2)]2⋅dxd​[sin(x2)]=3[sin(x2)]2⋅cos(x2)⋅dxd​[x2]=3[sin(x2)]2⋅cos(x2)⋅(2x)=6xsin2(x2)cos(x2)​

Chain rule basics

  • Used for differentiating composite functions: f(g(x))
  • Formula: dxd​f(g(x))=f′(g(x))⋅g′(x)
  • Differentiate outer function, multiply by derivative of inner function

Chain rule with common functions

  • Power functions: (ax+b)n→n(ax+b)n−1⋅a
  • Logarithms: ln(g(x))→g(x)1​⋅g′(x)
  • Exponentials: eg(x)→eg(x)⋅g′(x); bg(x)→bg(x)ln(b)⋅g′(x)

Combining chain rule with product and quotient rules

  • Identify overall structure (product, quotient, or composition) before applying rules
  • Product rule: (fg)′=f′g+fg′
    • Use chain rule when differentiating composite factors
  • Quotient rule: (gf​)′=g2f′g−fg′​
    • Use chain rule for composite denominators/numerators

Worked examples

  • (2x+1)3→6(2x+1)2
  • ln(3x2+x)→3x2+x6x+1​
  • e−2x→−2e−2x
  • 23x+1→(3ln2)23x+1
  • 3x(x2−1)3→3(x2−1)2(7x2−1)
  • (exsinx)2→2e2xsinx[cosx+sinx]
  • 2(x2+1)2x​→2(x2+1)31−3x2​

Chain rule with tables

  • Use chain rule formula with given function/derivative values
  • Substitute table values for f, g, f′, g′ as needed

Challenge problems

  • 32π−πt​→−22π−πt​3π​
  • ecosxex2​→ecosxex2(2x+sinx)​
  • sin3(lnx)→x3sin2(lnx)cos(lnx)​

Sign up for free to take 10 quiz questions on this topic

All rights reserved ©2016 - 2026 Achievable, Inc.

Chain rule

What you’ll learn

  • How to differentiate composite functions with the chain rule
  • Applying the chain rule with logarithmic, exponential, trig, and power functions
  • Combining the chain rule with product and quotient rules

To find the derivative of a function like h(x)=(2x+1)3, expanding and then applying the power rule is correct but inefficient.

Instead, a faster method called the chain rule is used to differentiate composite functions - functions built by nesting one function into another.

Chain rule:

dxd​[f(g(x))]=f′(g(x))⋅g′(x)

In other words,

  1. Differentiate the outer function, keeping the inner function intact.
  2. Multiply it by the derivative of the inner function.

Another common way to write the chain rule uses Leibniz notation:

If y=f(g(x)) (composite function) and u=g(x) (inner function), then y=f(u) and

dxdy​=dudy​⋅dxdu​

Examples

  1. Differentiate

y=(2x+1)3

Solution

(spoiler)

y is a composite function, so we identify the inner and outer parts. Below, the inner function is boxed:

outer(2x+1​​inner​)3​​

For clarity,

  • Outer function: f(u)=u3
  • Inner function: g(x)=2x+1

Apply the Chain Rule: differentiate the outer function (using the power rule) while leaving the inner function untouched, then multiply by the derivative of the inner function.

y′​=3(2x+1)2​derivative of outer​⋅dxd​(2x+1)​derivative of inner​=3(2x+1)2⋅(2)=6(2x+1)2​

Let’s try one with the natural logarithm. Recall from section 2.5 that dxd​[ln(x)]=x1​.

  1. Differentiate

h(x)=ln(3x2+x)

Solution

(spoiler)

h(x) is a composite function f(g(x)) with:

outerln(3x2+x​​inner​)​​

For clarity,

  • Outer function: f(u)=ln(u)
  • Inner function: g(x)=3x2+x

Applying the chain rule, differentiate the outer function while keeping the inner function intact, then multiply by the derivative of the inner function:

h′(x)​=f′(g(x))⋅g′(x)=3x2+x1​⋅dxd​(3x2+x)=3x2+x1​⋅(6x+1)=3x2+x6x+1​​

Similarly, recall that for exponential functions,

dxd​(ex)=ex

and

dxd​(bx)=bxln(b)

  1. Differentiate:

a) a(x)=e−2x

b) b(x)=23x+1

Solutions

a) a(x)=e−2x

(spoiler)

a(x) is a composite function, where

  • Outer function: f(u)=eu
  • Inner function: g(x)=−2x

Applying the chain rule,

a′(x)​=f′(g(x))⋅g′(x)=e−2x⋅dxd​(−2x)=e−2x⋅(−2)=−2e−2x​

b) b(x)=23x+1

(spoiler)

b(x) consists of

  • Outer function: f(u)=2u
  • Inner function: g(x)=3x+1

b′(x)​=f′(g(x))⋅g′(x)=23x+1ln(2)⋅dxd​(3x+1)=23x+1ln(2)⋅(3)=3ln(2)⋅23x+1​

Combining rules

The chain rule often appears together with other derivative rules. The main thing to watch is order: decide which overall structure you have first (product, quotient, or composition), then apply the needed rules inside that structure.

For example, the following problem uses the product rule first, and then uses the chain rule while differentiating one of the factors.

  1. Differentiate

h(x)=3x(x2−1)3

Solution

(spoiler)

h(x) is a product of two functions:

  • f(x)=3x

  • g(x)=(x2−1)3

Notice that g(x) is composite, so the chain rule is needed to find g′(x).

Function Expression
f(x) 3x
f′(x) 3
g(x) (x2−1)3
g′(x) 3(x2−1)2⋅2x

Putting these into the product rule:

h′(x)​=f(x)g′(x)+f′(x)g(x)=3x⋅[3(x2−1)2⋅2x]+3⋅(x2−1)3=18x2(x2−1)2+3(x2−1)3​

To simplify, factor out the common factors 3 and (x2−1)2:

=3(x2−1)2[6x2+(x2−1)]=3(x2−1)2(7x2−1)

Contrast that with the next problem, which uses the power rule first, and then the product rule when applying the chain rule and differentiating the inner function.

  1. Differentiate

h(x)=(exsinx)2

Solution

(spoiler)

h(x) is a composite function, where:

  • Outer function: f(u)=u2

  • Inner function: g(x)=exsinx

Applying the chain rule,

h′(x)=2(exsinx)⋅dxd​(exsinx)

To differentiate exsinx), apply the product rule

dxd​(exsinx)​=excosx+exsinx=ex(cosx+sinx)​

Then

h′(x)​=2exsinx⋅ex(cosx+sinx)=2e2xsinx(cosx+sinx)​

  1. Differentiate

h(x)=2(x2+1)2x​

Solution

(spoiler)

For easier algebra, pull out the constant multiple 21​:

h(x)=21​⋅(x2+1)2x​

Now h(x) is a quotient of two functions:

  • f(x)=x
  • g(x)=(x2+1)2

Use the quotient rule. Note that g(x) is composite, so the chain rule is needed for g′(x).

Function Expression
f(x) x
f′(x) 1
g(x) (x2+1)2
g′(x) 4x(x2+1)

Putting the pieces into the quotient rule:

h′(x)=21​⋅(g(x))2g(x)f′(x)−f(x)g′(x)​=21​⋅(x2+1)4(x2+1)2(1)−x⋅4x(x2+1)​=2(x2+1)4(x2+1)2−4x2(x2+1)​=2(x2+1)4(x2+1)(x2+1−4x2)​=2(x2+1)31−3x2​

You can also reach the same answer by rewriting

h(x)=21​x(x2+1)−2

and applying the product rule while using the chain rule on (x2+1)−2.

Using tables

Some questions ask you to apply derivative rules using only a table of values:

f(x),g(x), and their derivatives have the following values shown in the table:

x f(x) g(x) f′(x) g′(x)
1 3 2 −1 5
2 0.2 0.5 5 3
3 −1 1 4 −3

Find h′(1) given

h(x)=f(g(x)−x2)

Solution

(spoiler)

Because h(x)=f(g(x)−x2) is a composite function, apply the chain rule:

dxd​[f(g(x)−x2)]

=f′(g(x)−x2)⋅(g′(x)−2x)

Now evaluate at x=1:

h′(1)=f′(g(1)−12)⋅(g′(1)−2(1))=f′(2−1)⋅(5−2)=f′(1)⋅3=−1⋅3=−3

Challenge problems

  1. Differentiate

h(t)=32π−πt​

Solution

(spoiler)

Rewrite the square root as a power:

h(t)=3(2π−πt)1/2

Then h(t) consists of

  • Outer: f(u)=3u1/2
  • Inner: g(t)=2π−πt

Applying the chain rule (remembering that π is a constant),

h′(t)​=f′(g(t))⋅g′(t)=23​(2π−πt)−1/2⋅dtd​(2π−πt)=23​(2π−πt)−1/2⋅(−π)=−22π−πt​3π​​

  1. Differentiate

h(x)=ecosxex2​

Solution

(spoiler)

Instead of using the quotient rule, rewrite the expression using anam​=am−n:

h(x)=ex2−cosx

Then h(x) consists of

  • Outer: f(u)=eu
  • Inner: g(x)=x2−cosx

Applying the chain rule,

h′(x)​=f′(g(x))⋅g′(x)=ex2−cosx⋅dxd​(x2−cosx)=ex2−cosx⋅(2x−(−sinx))=(ex2−cosx)(2x+sinx)​

  1. Differentiate

A(x)=sin3(x2)

Solution

(spoiler)

First, rewrite as

A(x)=[sin(x2)]3

This function has multiple layers of composition and requires two applications of the chain rule:

  • Outer: f(u)=u3⟹f′(u)=3u2
  • Middle: g(v)=sin(v)⟹g′(v)=cos(v)
  • Inner: h(x)=x2⟹h′(x)=2x

Apply the chain rule by “unfolding” each layer:

A′(x)​=3[sin(x2)]2⋅dxd​[sin(x2)]=3[sin(x2)]2⋅cos(x2)⋅dxd​[x2]=3[sin(x2)]2⋅cos(x2)⋅(2x)=6xsin2(x2)cos(x2)​

Key points

Chain rule basics

  • Used for differentiating composite functions: f(g(x))
  • Formula: dxd​f(g(x))=f′(g(x))⋅g′(x)
  • Differentiate outer function, multiply by derivative of inner function

Chain rule with common functions

  • Power functions: (ax+b)n→n(ax+b)n−1⋅a
  • Logarithms: ln(g(x))→g(x)1​⋅g′(x)
  • Exponentials: eg(x)→eg(x)⋅g′(x); bg(x)→bg(x)ln(b)⋅g′(x)

Combining chain rule with product and quotient rules

  • Identify overall structure (product, quotient, or composition) before applying rules
  • Product rule: (fg)′=f′g+fg′
    • Use chain rule when differentiating composite factors
  • Quotient rule: (gf​)′=g2f′g−fg′​
    • Use chain rule for composite denominators/numerators

Worked examples

  • (2x+1)3→6(2x+1)2
  • ln(3x2+x)→3x2+x6x+1​
  • e−2x→−2e−2x
  • 23x+1→(3ln2)23x+1
  • 3x(x2−1)3→3(x2−1)2(7x2−1)
  • (exsinx)2→2e2xsinx[cosx+sinx]
  • 2(x2+1)2x​→2(x2+1)31−3x2​

Chain rule with tables

  • Use chain rule formula with given function/derivative values
  • Substitute table values for f, g, f′, g′ as needed

Challenge problems

  • 32π−πt​→−22π−πt​3π​
  • ecosxex2​→ecosxex2(2x+sinx)​
  • sin3(lnx)→x3sin2(lnx)cos(lnx)​

More from Advanced differentiation

  • Implicit differentiation
  • Higher order derivatives
  • Logarithmic differentiation
  • Derivatives of inverse functions
  • Inverse trig derivatives