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
10. test
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 wanted to find the derivative of a function like h(x)=(2x+1)3 based on the previous rules covered, you could expand it fully and use the power rule on each term, or write it as a product of three functions and use the product rule. But this process quickly becomes tedious when dealing with larger exponents or trinomials and beyond, and even more difficult with fractional exponents. Instead, to differentiate composite functions (functions nested in other functions), use the chain rule.

Chain rule:

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

To use this rule: take the derivative of the outer function, keeping the inner function unchanged, and then multiply by the derivative of the inner function.

Another way to write the chain rule involves Leibniz notation:

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

The “trick” to remembering this notation is to think of canceling out dg such that the derivative ends up expressed as dxdf​, which tells you how f changes as x changes. Since input x changes g and g changes f, a chain reaction occurs such that input x changes function f.

Examples

1. Differentiate

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

Solution

(spoiler)

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

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

For clarity,

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

1. Differentiate the outer function with the power rule:

f′(g)=3g2

The inner function should remain unchanged, so replace the placeholder letter g with the function g(x).

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

2. Differentiate the inner function:

g′(x)=2

3. Multiply together:

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

2. Differentiate

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

Solution

(spoiler)

h(x) can be written as a composite function f(g(x)) with:

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

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

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

2. Differentiate the inner function:

g′(x)=6x+1

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

3. 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) with the inner function g(x)=−2x.

1. Differentiate the outer:

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

2. Differentiate the inner:

g′(x)=−2

3. Multiply:

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

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

1. Differentiate the outer:

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

2. Differentiate the inner:

g′(x)=3

3. Multiply:

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

Combining all rules

The chain rule can also be combined with the other derivative rules, but make sure to apply the rules in the correct order. For example, the next problem uses the product rule first, applying the power and chain rules as intermediary steps.

3. Differentiate

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

Solution

(spoiler)

h(x) is primarily a product of the two functions f(x)=3x and g(x)=(x2−1)3. Note that g(x) is a composite function so the chain rule must be used when taking its derivative.

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

Putting all of the pieces into the product rule:

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

=18x2(x2−1)2+3(x2−1)3

Just to simplify further, notice both terms share common factors 3 and (x2−1)2. Factor those out:

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

=3(x2−1)2(7x2−1)​

Contrast this with the next problem, which uses the power and chain rules first, and then the product rule.

4. Differentiate

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

Solution

(spoiler)

h(x) is a composite function with

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

1. Differentiate outer:

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

2. Differentiate inner:

g(x) is a product of the two functions ex and sin(x). Applying the product rule,

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

3. 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 ease of calculation, let’s bring the 21​ out as a constant multiple.

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

h(x) is primarily a quotient of two functions f(x)=x and g(x)=(x2+1)2, so use the quotient rule first. Here are the pieces. Note that g(x) is a composite function so the chain rule must be used when taking its derivative.

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 turn any quotient into a product if you find using the product rule to be faster. Using the same example 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)

Just like before, take out the constant multiple 21​ and leave it in front for ease of calculation. The remaining portion of h(x) is the product of f(x)=x and g(x)=(x2+1)−2 so use the product rule first. Again, g(x) is a composite function so use the chain rule. Here are the pieces:

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

Into the product rule they go:

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 expect you to understand the derivative rules given just 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)

Answer: -3

Because f is a composite function, the chain rule is applied when taking the derivative:

dxd​f(g(x)−x2)

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

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

h(t) can be rewritten as 3(2π−πt)1/2 with:

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

For clarity,

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

1. Differentiate outer:

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

2. Differentiate inner:

g′(t)=−π

Note: Remember that 2π is a constant so the derivative is 0, but −π is the coefficient in front of the linear term with variable t.

3. Multiply:

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

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

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

Solution

(spoiler)

Rather than using the quotient rule, it would be more efficient to use the exponent rule anam​=am−n to rewrite the function into

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

Then applying the chain rule,

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

Which can also be written as

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

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

Solution

(spoiler)

First, sin3(lnx) is the same thing as (sin(lnx))3.

A(x)=(sin(lnx))3 contains several layers of composition:

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

So the chain rule will be applied multiple times.

Let’s peel away the layers of this composite function with the chain rule:

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

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

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

All rights reserved ©2016 - 2026 Achievable, Inc.