AP® CALCULUS AB & BC · UNIT 3

The Chain Rule

Find the derivative of a function inside another function. Work through the layers, then use a table and three graphs to see how the slopes multiply.

Topic 3.1 study notes5 worked examples · 6 practice problemsUpdated 10 November 2026
Calculus notebook with limit and integral symbols, a compass and pencil on an olive and cream study desk

1. The chain rule and when to use it

The chain rule gives the derivative of a composite function. Suppose g is differentiable at x and f is differentiable at g(x). The input passes through g first and then through f.

x⟶g(x)⟶f(g(x))

Chain rule for two layers

ddx[f(g(x))]=f′(g(x))·g′(x)

Evaluate the outer derivative at the inner value. Then multiply by the inner derivative.

Leibniz notation

Let u=g(x) and y=f(u). The two factors describe the rate of change at each stage.

dydx=dydu·dudx

At a specific input a, evaluate the first factor at u=g(a) and the second at x=a.

How to choose the rule

  1. Find the outer operation and name its input.
  2. Differentiate the outer function and keep its input in place.
  3. Multiply by the derivative of the inner function. Repeat for every additional layer.
  4. Check that the original function and the derivative are defined at the requested input.

2. Five worked examples

For each problem, name the outer and inner functions before differentiating. The outer derivative is written in terms of its own input first.

Example 1

Sine of a linear function

1 · Identify the layers

Differentiate H(x)=sin(5x).

Outer f(u)=sinu. Inner g(x)=5x.

2 · Differentiate each layer

f′(u)=cosu,g′(x)=5

3 · Substitute and multiply

H′(x)=cos(5x)·5=5cos(5x)

The formula uses radians and holds for every real input.

Example 2

Exponential of a square

1 · Identify the layers

Differentiate H(x)=ex2.

Outer f(u)=eu. Inner g(x)=x2.

2 · Differentiate each layer

f′(u)=eu,g′(x)=2x

3 · Substitute and multiply

H′(x)=ex2·2x=2xex2

Keep the same exponent in the exponential factor. The derivative is defined for every real input.

Example 3

Square root of a quadratic

1 · Identify the layers

Differentiate H(x)=3x2+1.

Outer f(u)=u=u12. Inner g(x)=3x2+1.

2 · Differentiate each layer

f′(u)=12u,g′(x)=6x

3 · Substitute and multiply

H′(x)=6x23x2+1=3x3x2+1

The radicand is at least 1, so the derivative is defined for every real input.

Example 4

Logarithm of a linear function

1 · Identify the layers

Differentiate H(x)=ln(2x+1).

Outer f(u)=lnu. Inner g(x)=2x+1.

2 · Differentiate each layer

f′(u)=1u,g′(x)=2

3 · Substitute and multiply

H′(x)=12x+1·2=22x+1

The logarithm requires 2x+1>0, so the derivative applies for x>−12.

Example 5

Tangent of a quadratic

1 · Identify the layers

Differentiate H(x)=tan(3x2).

Outer f(u)=tanu. Inner g(x)=3x2.

2 · Differentiate each layer

f′(u)=sec2u,g′(x)=6x

3 · Substitute and multiply

H′(x)=sec2(3x2)·6x=6xsec2(3x2)

Use radians and keep only inputs with cos(3x2)≠0.

3. Differentiate three or more layers

For three differentiable layers, evaluate each derivative at the input to its own function. Start at the outermost operation and work inward.

ddx[f(g(h(x)))]=f′(g(h(x)))·g′(h(x))·h′(x)

Nested example

Differentiate a power of a shifted sine

1 · Follow the order of the layers

Let H(x)=(1+sin(2x))3. The input is doubled, passed through sine and shifted up by one, then cubed.

2 · Write each factor

The cube contributes 3(1+sin(2x))2. The shifted sine contributes cos(2x), and doubling the input contributes 2.

3 · Multiply all three factors

H′(x)=3(1+sin(2x))2·cos(2x)·2
H′(x)=6(1+sin(2x))2cos(2x)

4. Use a table and graphs to find a slope

Let g(x)=x2+2, f(u)=(u−2)2+1, and F(x)=f(g(x)). Find the slope of F at input 1.

Function values and slopes at two inputs
Input tg(t)g′(t)f(t)f′(t)
1322−2
311622

Graph and table example

Trace the slope through the composition

1 · Read the inner function at the starting input

Use the row for input 1.

g(1)=3,g′(1)=2

2 · Move to the outer function’s input

The outer function receives 3. Read its value and slope from the row for input 3.

f(3)=2,f′(3)=2

3 · Find the composite slope

F′(1)=f′(g(1))·g′(1)
F′(1)=2·2=4

The composite graph passes through (1,2). You can check the slope directly using F(x)=x4+1.

Compare the three tangent slopes

Follow the output of the first graph into the second graph. The third graph shows the result of applying both functions to the original input.

  • Function
  • Tangent at the marked point

Inner function

At P=(1,3), the slope is g′(1)=2. The output 3 becomes the next input.

Outer function

At Q=(3,2), the slope is f′(3)=2. Use the horizontal axis for the inner output.

Composition

At R=(1,2), the slope is F′(1)=4. The inner and outer graphs each supply a factor.

5. Combine the chain rule with other rules

The outer operation tells you which rule to start with. Use the chain rule inside a term or factor whenever that part is a composition.

Mixed rules

Differentiate a product with a composite factor

1 · Identify the product

Let H(x)=x2ex2. The two factors are x2 and ex2.

2 · Differentiate each factor

ddx[x2]=2x
ddx[ex2]=2xex2

3 · Apply the product rule

H′(x)=(2x)ex2+x2(2xex2)

The exponential factor uses the chain rule before the product rule combines the two contributions.

Mixed rules

Differentiate a quotient with a composite numerator

1 · Identify the quotient

Let H(x)=sin(5x)x+1. Its domain excludes x=−1.

2 · Differentiate the numerator and denominator

ddx[sin(5x)]=5cos(5x)
ddx[x+1]=1

3 · Apply the quotient rule

H′(x)=5(x+1)cos(5x)−sin(5x)(x+1)2

Keep the same exclusion x≠−1.

Review the product rule and quotient rule for the order of the terms.

6. Common mistakes and how to check your work

  • Keep the inner derivative. For sin(ax+b), the cosine factor keeps the full angle and the inner derivative contributes a.
  • Choose the correct input from a table. Read g(a) first. Use that value as the argument of f′, even if the table also lists f′(a).
  • Check a radical’s derivative domain. A square root can be defined at a zero of its radicand. Check differentiability at such an input separately. For example, x2=|x| has a corner at zero.
  • Keep the order of nested operations. In (sinx)2, squaring is the outside operation. In sin(x2), sine is the outside operation.

Memory cue. Say “outer prime at the inner value, times inner prime.” If several functions are nested, draw one arrow for each step from the original input to the final output.

7. Six practice problems

Differentiate each function. Write both factors and identify any domain restriction before opening the solution.

1. Cosine of a quadratic

Differentiate H(x)=cos(2x2+3).

Show solution

Practice 1

Worked solution

1 · Differentiate the layers

Set u=2x2+3. The inner derivative is 4x. The outer derivative is −sinu.

2 · Evaluate and multiply

H′(x)=−sin(2x2+3)·4x

Cosine supplies the minus sign. The derivative is defined for all real inputs.

2. Exponential of a cubic

Differentiate H(x)=e5x3.

Show solution

Practice 2

Worked solution

1 · Differentiate the layers

Set u=5x3. The inner derivative is 15x2. The outer derivative is eu.

2 · Evaluate and multiply

H′(x)=e5x3·15x2

The exponential factor keeps its original exponent. The derivative is defined for all real inputs.

3. Fourth power of a quadratic

Differentiate H(x)=(x2+1)4.

Show solution

Practice 3

Worked solution

1 · Differentiate the layers

Set u=x2+1. The inner derivative is 2x. The outer derivative is 4u3.

2 · Evaluate and multiply

H′(x)=4(x2+1)3·2x=8x(x2+1)3

The power rule supplies the new exponent. The derivative is defined for all real inputs.

4. Logarithm of a square

Differentiate H(x)=ln(4x2).

Show solution

Practice 4

Worked solution

1 · Differentiate the layers

Set u=4x2. The inner derivative is 8x. The outer derivative is 1u.

2 · Evaluate and multiply

H′(x)=8x4x2=2x

The original logarithm requires 4x2>0, so keep x≠0 after simplifying.

5. Sine of a fourth power

Differentiate H(x)=sin(x4).

Show solution

Practice 5

Worked solution

1 · Differentiate the layers

Set u=x4. The inner derivative is 4x3. The outer derivative is cosu.

2 · Evaluate and multiply

H′(x)=cos(x4)·4x3

Use radians. The derivative is defined for all real inputs.

6. Square root of a linear function

Differentiate H(x)=7x+2.

Show solution

Practice 6

Worked solution

1 · Differentiate the layers

Set u=7x+2. The inner derivative is 7. The outer derivative is 12u.

2 · Evaluate and multiply

H′(x)=727x+2

The function is defined for x≥−27. The derivative formula applies for x>−27. The right-hand difference quotient grows without bound at the endpoint.

8. Quick formula reference

Each formula assumes that g is differentiable at the input in question. The last column gives the extra condition on the outer operation.

Chain rule formulas for common outer functions
CompositionDerivativeCondition
[g(x)]nn[g(x)]n−1g′(x)Integer n≥2
g(x)g′(x)2g(x)g(x)>0
1g(x)−g′(x)[g(x)]2g(x)≠0
eg(x)eg(x)g′(x)All real inner values
ln(g(x))g′(x)g(x)g(x)>0
sin(g(x))cos(g(x))g′(x)Radians
cos(g(x))−sin(g(x))g′(x)Radians
tan(g(x))sec2(g(x))g′(x)Radians and cos(g(x))≠0

It can help to rewrite u=u12 on its real domain, or 1u=u−1 when u≠0. Keep the domain of the original composition as you simplify.

9. AP-style reasoning and next steps

Write the reasoning an AP-style prompt asks for

For a derivative formula, show the outer derivative at its inner input and the multiplier from the inner derivative. For a numeric slope, write both evaluated factors. If the problem combines rules, show the larger structure first and keep the original domain in view.

Topic 3.2 applies the same rule to a dependent variable. If y is differentiable with respect to x and n is an integer greater than one, a power of y contributes the derivative of y as an extra factor.

ddx[yn]=nyn−1dydx