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, treating the inner function as a single “chunk.”
  • Then multiply by the derivative of the inner function.

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

dxd​(f(g(x))=dgdf​⋅dxdg​

A helpful way to remember this form is to notice that the dg factors “cancel” visually, leaving dxdf​. The meaning is the same as before: changes in x change g(x), and changes in g(x) change f - so changes in x affect f through a chain of dependence.

Examples

  1. Differentiate

h(x)=(2x+1)3

Solution

(spoiler)

h(x) is a composite function f(g(x)). The inner function is boxed below:

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

For clarity,

Outer: f(g)=g3
Inner:g(x)=2x+1

  1. Differentiate the outer function (power rule), keeping the inner function unchanged:

f′(g)=3g2

So,

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

  1. Differentiate the inner function:

g′(x)=2

  1. Multiply the results:

h′(x)​=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​lnx=x1​.

  1. Differentiate

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

Solution

(spoiler)

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

outer fln(3x2+x​​inner g​)​​

  1. Differentiate the outer function, keeping the inner function unchanged:

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

  1. Differentiate the inner function:

g′(x)=6x+1

  1. Multiply:

h′(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.

  1. Differentiate:

a) a(x)=e−2x
b)b(x)=23x+1

Answers:

(spoiler)

a) a′(x)=−2e−2x

b) b′(x)=(3ln(2))⋅23x+1

Explanations:

(spoiler)

a) For a(x), the outer function is f(g(x))=eg(x) and the inner function is g(x)=−2x.

  1. Differentiate the outer function:

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

  1. Differentiate the inner function:

g′(x)=−2

  1. Multiply:

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

b) For b(x), the outer function is f(g(x))=2g(x) and the inner function is g(x)=3x+1.

  1. Differentiate the outer function:

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

  1. Differentiate the inner function:

g′(x)=3

  1. Multiply:

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

Combining all 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.

  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)=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.

  1. Differentiate

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

Solution

(spoiler)

h(x) is a composite function with

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

  1. Differentiate the outer function:

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

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

  1. Multiply:

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

=2e2xsin(x)[cos(x)+sin(x)]​

  1. 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:

  1. 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)

Answer: -3

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:

=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

This is a composite function:

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

For clarity,

Outer: f(g)=3g1/2
Inner:g(t)=2π−πt

  1. Differentiate the outer function:

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

  1. Differentiate the inner function:

g′(t)=−π

Note: 2π is a constant, so its derivative is 0. The derivative of −πt is −π.

  1. Multiply:

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

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

  1. 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))

Now apply the chain rule. The outer function is eu and the inner function is u=x2−cos(x):

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

This can also be written as

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

  1. 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:

Outer: f(g)=g3
Middle:g(h)=sin(h)
Inner:h(x)=ln(x)

Apply the chain rule layer by layer:

A′(x)=der. of outer f3(sin(lnx))2​​×cos(lnx)​der. of middle g​×der. of inner hx1​​​

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

Chain rule basics

  • Used for differentiating composite functions: f(g(x))
  • Formula: $ \fracf(g(x)) = f’(g(x)) \cdot 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

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, treating the inner function as a single “chunk.”
  • Then multiply by the derivative of the inner function.

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

dxd​(f(g(x))=dgdf​⋅dxdg​

A helpful way to remember this form is to notice that the dg factors “cancel” visually, leaving dxdf​. The meaning is the same as before: changes in x change g(x), and changes in g(x) change f - so changes in x affect f through a chain of dependence.

Examples

  1. Differentiate

h(x)=(2x+1)3

Solution

(spoiler)

h(x) is a composite function f(g(x)). The inner function is boxed below:

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

For clarity,

Outer: f(g)=g3
Inner:g(x)=2x+1

  1. Differentiate the outer function (power rule), keeping the inner function unchanged:

f′(g)=3g2

So,

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

  1. Differentiate the inner function:

g′(x)=2

  1. Multiply the results:

h′(x)​=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​lnx=x1​.

  1. Differentiate

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

Solution

(spoiler)

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

outer fln(3x2+x​​inner g​)​​

  1. Differentiate the outer function, keeping the inner function unchanged:

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

  1. Differentiate the inner function:

g′(x)=6x+1

  1. Multiply:

h′(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.

  1. Differentiate:

a) a(x)=e−2x
b)b(x)=23x+1

Answers:

(spoiler)

a) a′(x)=−2e−2x

b) b′(x)=(3ln(2))⋅23x+1

Explanations:

(spoiler)

a) For a(x), the outer function is f(g(x))=eg(x) and the inner function is g(x)=−2x.

  1. Differentiate the outer function:

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

  1. Differentiate the inner function:

g′(x)=−2

  1. Multiply:

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

b) For b(x), the outer function is f(g(x))=2g(x) and the inner function is g(x)=3x+1.

  1. Differentiate the outer function:

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

  1. Differentiate the inner function:

g′(x)=3

  1. Multiply:

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

Combining all 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.

  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)=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.

  1. Differentiate

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

Solution

(spoiler)

h(x) is a composite function with

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

  1. Differentiate the outer function:

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

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

  1. Multiply:

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

=2e2xsin(x)[cos(x)+sin(x)]​

  1. 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:

  1. 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)

Answer: -3

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:

=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

This is a composite function:

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

For clarity,

Outer: f(g)=3g1/2
Inner:g(t)=2π−πt

  1. Differentiate the outer function:

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

  1. Differentiate the inner function:

g′(t)=−π

Note: 2π is a constant, so its derivative is 0. The derivative of −πt is −π.

  1. Multiply:

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

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

  1. 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))

Now apply the chain rule. The outer function is eu and the inner function is u=x2−cos(x):

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

This can also be written as

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

  1. 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:

Outer: f(g)=g3
Middle:g(h)=sin(h)
Inner:h(x)=ln(x)

Apply the chain rule layer by layer:

A′(x)=der. of outer f3(sin(lnx))2​​×cos(lnx)​der. of middle g​×der. of inner hx1​​​

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

Key points

Chain rule basics

  • Used for differentiating composite functions: f(g(x))
  • Formula: $ \frac{d}{dx}f(g(x)) = f’(g(x)) \cdot 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)​