01 / 20

The Chain Rule

Master the technique for differentiating composite functions: the single most powerful and frequently used derivative rule in calculus.

AP Calculus BC

What Is a Composite Function?

Before learning the Chain Rule, you need to understand the functions it applies to. A composite function is a function built by plugging one function inside another:

$$ h(x) = f\!\bigl(g(x)\bigr) $$
Outer function \( f \)
The function applied last: it wraps around everything.
Inner function \( g \)
The function applied first: it lives inside the outer function.

Visualizing Composition as a Pipeline

x g(x) inner u f(u) outer h(x)

Think of composition as an assembly line: \(x\) enters, \(g\) transforms it into \(u = g(x)\), then \(f\) transforms \(u\) into the final output \(f(g(x))\). The Chain Rule tells us how the rate of change flows through this pipeline.

Why the Chain Rule Matters

Most real-world functions are compositions. Without the Chain Rule, you cannot differentiate the vast majority of functions you will encounter in calculus and beyond.

Trig Compositions
\( \sin(3x) \), \( \cos(x^2) \), \( \tan(e^x) \)
Exponential/Log
\( e^{5x} \), \( \ln(\sin x) \), \( 2^{x^3} \)
Powers
\( (3x+1)^7 \), \( \sqrt{x^2+1} \)

The Chain Rule: Formal Statement

$$ h'(x) = f'\!\bigl(g(x)\bigr) \cdot g'(x) $$

In words: differentiate the outer function (keeping the inner function unchanged), then multiply by the derivative of the inner function.

Chain Rule Diagram

Inner: g(x)
e.g. \(x^2\)
Outer: f(u)
e.g. \(\sin(u)\)
Composite: h(x)
\(\sin(x^2)\)
Derivatives:
\(g'(x) = 2x\)
\(f'(u) = \cos(u)\)
×
\(h'(x) = \cos(x^2)\cdot 2x\)
outer derivative × inner derivative

Chain Rule vs Product Rule

Students often confuse when to use each rule. The distinction is simple:

Chain Rule Product Rule
Structure Function inside function: \( f(g(x)) \) Function times function: \( f(x) \cdot g(x) \)
Keyword "of" : \( \sin \) of \( x^2 \) "times" : \( x^2 \) times \( \sin x \)
Formula \( f'(g(x))\cdot g'(x) \) \( f'g + fg' \)
Example \( \sin(x^2) \) \( x^2 \sin x \)

How to Apply the Chain Rule

1
Identify the composite. Ask: "Is there a function inside another function?" If yes, the Chain Rule applies.
2
Label outer and inner. Write \( f(u) \) for the outer function and \( u = g(x) \) for the inner function.
3
Differentiate the outer. Find \( f'(u) \), leaving \( u \) in place (do not substitute back yet).
4
Differentiate the inner. Find \( g'(x) \).
5
Multiply and substitute. Write \( f'(g(x)) \cdot g'(x) \), then simplify.

Example 1: Basic Chain Rule

Differentiate \( h(x) = (3x + 1)^5 \).

1
Outer: \( f(u) = u^5 \). Inner: \( u = g(x) = 3x + 1 \).
2
Outer derivative: \( f'(u) = 5u^4 \).
3
Inner derivative: \( g'(x) = 3 \).
4
Combine: \( h'(x) = 5(3x+1)^4 \cdot 3 = 15(3x+1)^4 \).

Example 2: Trigonometric Composition

Differentiate \( y = \cos(x^3) \).

1
Outer: \( f(u) = \cos u \). Inner: \( u = x^3 \).
2
Outer derivative: \( f'(u) = -\sin u \).
3
Inner derivative: \( g'(x) = 3x^2 \).
4
Combine: \( \dfrac{dy}{dx} = -\sin(x^3) \cdot 3x^2 = -3x^2\sin(x^3) \).

Example 3: Exponential Composition

Differentiate \( y = e^{\sin x} \).

1
Outer: \( f(u) = e^u \). Inner: \( u = \sin x \).
2
Outer derivative: \( f'(u) = e^u \) (exponential is its own derivative).
3
Inner derivative: \( g'(x) = \cos x \).
4
Combine: \( \dfrac{dy}{dx} = e^{\sin x} \cdot \cos x \).

Example 4: Double Chain Rule

Differentiate \( y = \sin^2(4x) = \bigl[\sin(4x)\bigr]^2 \).

1
Outermost: \( (\;\cdot\;)^2 \). Middle: \( \sin(\cdot) \). Innermost: \( 4x \).
2
Differentiate layer by layer (outside in):
3
\( \dfrac{dy}{dx} = 2\bigl[\sin(4x)\bigr]^1 \cdot \cos(4x) \cdot 4 \)
4
Simplify: \( y' = 8\sin(4x)\cos(4x) = 4\sin(8x) \).

Graphical Interpretation

Compare \( y = \sin x \) and \( y = \sin(2x) \). The Chain Rule predicts that the derivative of \( \sin(2x) \) is twice as steep.

1 -1 π 2π
\(\sin(x)\)
\(\sin(2x)\)
y

Common Mistakes

✕ Forgetting the inner derivative
Writing \( \frac{d}{dx}[\sin(x^2)] = \cos(x^2) \) without multiplying by \( 2x \). This is the most common error.
✕ Replacing the inner function
Writing \( \cos(2x) \) instead of \( \cos(x^2) \). You must keep \(g(x)\) inside \(f'\), not substitute \(g'(x)\).
✕ Using the Product Rule instead
Treating \( \sin(x^2) \) as \( \sin(x) \cdot x^2 \). Composition (\( f \circ g \)) is not multiplication (\( f \cdot g \)).

Chain Rule Quick Reference

Function Derivative
\( \bigl[g(x)\bigr]^n \) \( n\bigl[g(x)\bigr]^{n-1} \cdot g'(x) \)
\( \sin\!\bigl(g(x)\bigr) \) \( \cos\!\bigl(g(x)\bigr) \cdot g'(x) \)
\( \cos\!\bigl(g(x)\bigr) \) \( -\sin\!\bigl(g(x)\bigr) \cdot g'(x) \)
\( e^{g(x)} \) \( e^{g(x)} \cdot g'(x) \)
\( \ln\!\bigl(g(x)\bigr) \) \( \dfrac{g'(x)}{g(x)} \)
\( \tan\!\bigl(g(x)\bigr) \) \( \sec^2\!\bigl(g(x)\bigr) \cdot g'(x) \)

Question 1 of 5

What is the derivative of \( f(x) = (2x+5)^3 \)?

Question 2 of 5

Find \( \dfrac{d}{dx}\bigl[e^{3x^2}\bigr] \).

Question 3 of 5

What is \( \dfrac{d}{dx}\bigl[\ln(\cos x)\bigr] \)?

Question 4 of 5

If \( h(x) = \sqrt{x^3 + 7} \), what is \( h'(x) \)?

Question 5 of 5

Find the derivative of \( y = \sin^3(2x) \).