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 Logarithmic differentiation
3.4 Derivatives of inverse functions
3.5 Inverse trig derivatives
4. Contextual uses
5. Analytical uses
6. Integration
7. Differential equations
8. Applications of integrals
9. Testing details tag
Wrapping up
Achievable logoAchievable logo
3.1 Chain rule
Achievable AP Calculus AB
3. Advanced differentiation
Our AP Calculus AB course is currently in development and is a work-in-progress.

Chain rule

10 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

If you want the derivative of a function like h(x)=(2x+1)3, you could expand it and use the power rule term-by-term, or rewrite it as a product of three identical factors and use the product rule. Both approaches work, but they get tedious quickly (especially with larger exponents, more complicated polynomials, or fractional powers).

A faster method is designed specifically for composite functions - functions built by plugging one function into another. That method is the chain rule.

Chain rule:

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

Here’s the idea in words:

  • Differentiate the outer function, keeping the inner function intact.
  • Then multiply by the derivative of the inner function.

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

Let y=f(g(x)) and u=g(x).

Then y=f(u) and

dxdy​=dudy​⋅dxdu​

One way to remember this form is to notice that the du factors “cancel” visually, leaving dxdy​. The idea is the same: differentiate the outer function and then multiply by the derivative of the inner function.

Examples

1. Differentiate

y=(2x+1)3

Solution

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

Differentiate the outer function (power rule), keeping the inner function intact:

f′(u)=3u2

So

f′(g(x))=3(2x+1)2

Differentiate the inner function:

g′(x)=2

Multiply the results (chain rule):

y′​=f′(g(x))⋅g′(x)=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​.

2. 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

Differentiate the outer function, keeping the inner function intact:

f′(u)=u1​

So

f′(g(x))=3x2+x1​

Differentiate the inner function:

g′(x)=6x+1

Multiply the results (chain rule):

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

Similarly, recall that for exponential functions,

dxd​(ex)=ex

and

dxd​(bx)=bxln(b)

Let’s do 2 examples that use the chain rule.

3. Differentiate:

a) a(x)=e−2x

b) b(x)=23x+1

Solutions

a) a(x)=e−2x

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

Differentiate the outer function:

f′(u)=eu

So

f′(g(x))=e−2x

Differentiate the inner function:

g′(x)=−2

Multiply:

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

b) b(x)=23x+1

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

Differentiate the outer function:

f′(u)=2u⋅ln(2)

So

f′(g(x))=23x+1⋅ln(2)

Differentiate the inner function:

g′(x)=3

Multiply:

b′(x)​=f′(g(x))⋅g′(x)=(23x+1⋅ln(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 next problem uses the product rule first, and then uses the chain rule while differentiating one of the factors.

3. 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)=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. Here, it’s most natural to use the power rule (with the chain rule) first, and then use the product rule when differentiating the inner function.

4. Differentiate

h(x)=(exsin(x))2

Solution

(spoiler)

h(x) is a composite function with

outer(exsin(x)​​inner​)2​​

Differentiate the outer function:

f′(g(x))=2(g(x)exsin(x)​​)1

Differentiate the inner function:

The inner function g(x)=exsin(x) is a product, so apply the product rule:

g′(x)​=excos(x)+exsin(x)=ex[cos(x)+sin(x)]​

Multiply:

h′(x)​=2exsin(x)⋅ex[cos(x)+sin(x)]=2e2xsin(x)[cos(x)+sin(x)]​​

5. Differentiate

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

Solution

(spoiler)

For easier algebra, pull out the constant factor 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) 2(x2+1)⋅2x

Putting the pieces into the quotient rule:

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

=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 rewrite a quotient as a product and then use the product rule, if that feels faster. Using the same function as above,

5b. First turn

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

into a product of two functions:

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

and then find the derivative using the product rule.

Solution

(spoiler)

As before, keep the constant multiple 21​ out in front:

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

The remaining part is a product of:

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

Use the product rule. Since g(x) is composite, use the chain rule to find g′(x).

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

Now apply the product rule:

h′(x)=21​⋅[x(−4x(x2+1)−3)+1(x2+1)−2]

=21​⋅[(x2+1)3−4x2​+(x2+1)21​]

=21​⋅[(x2+1)3−4x2​+(x2+1)3(x2+1)​]

=2(x2+1)31−3x2​​

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

6. 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

Evaluate the first derivative of the function

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

at x=1.

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

The composite function is:

3(inner2π−πt​​​)1/2​outer​

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

Differentiate the outer function:

f′(u)=23​u−1/2

So

f′(g(t))=23​(2π−πt)−1/2

Differentiate the inner function:

(2π is a constant, so its derivative is 0. The derivative of −πt is −π)

g′(t)=−π

Multiply:

h′(t)=23​(2π−πt)−1/2(−π)

=−22π−πt​3π​​

2. Differentiate h(x)=ecos(x)ex2​

Solution

(spoiler)

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

h(x)=e(x2−cos(x))

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

Differentiate the outer:

f′(u)=eu

So

f′(g(x))=ex2−cos(x)

Differentiate the inner:

g′(x)=2x+sin(x)

Multiply:

h′(x)=e(x2−cos(x))⋅(2x+sin(x))

This can also be written as

h′(x)=ecos(x)ex2(2x+sin(x))​​

3. Differentiate A(x)=sin3(lnx).

Solution

(spoiler)

First, rewrite sin3(lnx) as (sin(lnx))3:

A(x)=(sin(lnx))3

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

  • Outer: f(u)=u3
  • Middle: u=sin(v)
  • Inner: v=ln(x)

Differentiate the outer:

f′(u)=3u2

Differentiate the middle:

u′=cos(v)

Differentiate the inner:

v′=x1​

Apply the chain rule layer by layer:

A′(x)=der. of outer3(sin(lnx))2​​×cos(lnx)​der. of middle​×der. of innerx1​​​

=x3sin2(lnx)⋅cos(lnx)​​

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 13 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

If you want the derivative of a function like h(x)=(2x+1)3, you could expand it and use the power rule term-by-term, or rewrite it as a product of three identical factors and use the product rule. Both approaches work, but they get tedious quickly (especially with larger exponents, more complicated polynomials, or fractional powers).

A faster method is designed specifically for composite functions - functions built by plugging one function into another. That method is the chain rule.

Chain rule:

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

Here’s the idea in words:

  • Differentiate the outer function, keeping the inner function intact.
  • Then multiply by the derivative of the inner function.

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

Let y=f(g(x)) and u=g(x).

Then y=f(u) and

dxdy​=dudy​⋅dxdu​

One way to remember this form is to notice that the du factors “cancel” visually, leaving dxdy​. The idea is the same: differentiate the outer function and then multiply by the derivative of the inner function.

Examples

1. Differentiate

y=(2x+1)3

Solution

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

Differentiate the outer function (power rule), keeping the inner function intact:

f′(u)=3u2

So

f′(g(x))=3(2x+1)2

Differentiate the inner function:

g′(x)=2

Multiply the results (chain rule):

y′​=f′(g(x))⋅g′(x)=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​.

2. 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

Differentiate the outer function, keeping the inner function intact:

f′(u)=u1​

So

f′(g(x))=3x2+x1​

Differentiate the inner function:

g′(x)=6x+1

Multiply the results (chain rule):

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

Similarly, recall that for exponential functions,

dxd​(ex)=ex

and

dxd​(bx)=bxln(b)

Let’s do 2 examples that use the chain rule.

3. Differentiate:

a) a(x)=e−2x

b) b(x)=23x+1

Solutions

a) a(x)=e−2x

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

Differentiate the outer function:

f′(u)=eu

So

f′(g(x))=e−2x

Differentiate the inner function:

g′(x)=−2

Multiply:

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

b) b(x)=23x+1

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

Differentiate the outer function:

f′(u)=2u⋅ln(2)

So

f′(g(x))=23x+1⋅ln(2)

Differentiate the inner function:

g′(x)=3

Multiply:

b′(x)​=f′(g(x))⋅g′(x)=(23x+1⋅ln(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 next problem uses the product rule first, and then uses the chain rule while differentiating one of the factors.

3. 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)=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. Here, it’s most natural to use the power rule (with the chain rule) first, and then use the product rule when differentiating the inner function.

4. Differentiate

h(x)=(exsin(x))2

Solution

(spoiler)

h(x) is a composite function with

outer(exsin(x)​​inner​)2​​

Differentiate the outer function:

f′(g(x))=2(g(x)exsin(x)​​)1

Differentiate the inner function:

The inner function g(x)=exsin(x) is a product, so apply the product rule:

g′(x)​=excos(x)+exsin(x)=ex[cos(x)+sin(x)]​

Multiply:

h′(x)​=2exsin(x)⋅ex[cos(x)+sin(x)]=2e2xsin(x)[cos(x)+sin(x)]​​

5. Differentiate

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

Solution

(spoiler)

For easier algebra, pull out the constant factor 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) 2(x2+1)⋅2x

Putting the pieces into the quotient rule:

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

=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 rewrite a quotient as a product and then use the product rule, if that feels faster. Using the same function as above,

5b. First turn

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

into a product of two functions:

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

and then find the derivative using the product rule.

Solution

(spoiler)

As before, keep the constant multiple 21​ out in front:

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

The remaining part is a product of:

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

Use the product rule. Since g(x) is composite, use the chain rule to find g′(x).

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

Now apply the product rule:

h′(x)=21​⋅[x(−4x(x2+1)−3)+1(x2+1)−2]

=21​⋅[(x2+1)3−4x2​+(x2+1)21​]

=21​⋅[(x2+1)3−4x2​+(x2+1)3(x2+1)​]

=2(x2+1)31−3x2​​

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

6. 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

Evaluate the first derivative of the function

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

at x=1.

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

The composite function is:

3(inner2π−πt​​​)1/2​outer​

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

Differentiate the outer function:

f′(u)=23​u−1/2

So

f′(g(t))=23​(2π−πt)−1/2

Differentiate the inner function:

(2π is a constant, so its derivative is 0. The derivative of −πt is −π)

g′(t)=−π

Multiply:

h′(t)=23​(2π−πt)−1/2(−π)

=−22π−πt​3π​​

2. Differentiate h(x)=ecos(x)ex2​

Solution

(spoiler)

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

h(x)=e(x2−cos(x))

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

Differentiate the outer:

f′(u)=eu

So

f′(g(x))=ex2−cos(x)

Differentiate the inner:

g′(x)=2x+sin(x)

Multiply:

h′(x)=e(x2−cos(x))⋅(2x+sin(x))

This can also be written as

h′(x)=ecos(x)ex2(2x+sin(x))​​

3. Differentiate A(x)=sin3(lnx).

Solution

(spoiler)

First, rewrite sin3(lnx) as (sin(lnx))3:

A(x)=(sin(lnx))3

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

  • Outer: f(u)=u3
  • Middle: u=sin(v)
  • Inner: v=ln(x)

Differentiate the outer:

f′(u)=3u2

Differentiate the middle:

u′=cos(v)

Differentiate the inner:

v′=x1​

Apply the chain rule layer by layer:

A′(x)=der. of outer3(sin(lnx))2​​×cos(lnx)​der. of middle​×der. of innerx1​​​

=x3sin2(lnx)⋅cos(lnx)​​

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)​