Chain Rule

Master the chain rule for composite functions, including nested derivatives and combining with product and quotient rules for AP Calc AB.

The chain rule is arguably the most important differentiation technique in calculus. While the power, product, and quotient rules handle simple functions, most real-world functions are compositions — a function inside another function. Every time you see sin(3x)\sin(3x), (x2+1)5(x^2 + 1)^5, or ex2e^{-x^2}, the chain rule is required.

On the AP Calculus AB exam, the chain rule appears in nearly every differentiation problem, often combined with the product or quotient rule. It is also essential for related rates, implicit differentiation, and integration by substitution (which is the chain rule in reverse).

This guide will teach you to identify composite functions, apply the chain rule confidently, handle nested compositions, and combine the chain rule with other derivative rules.

Core Concepts

What Is a Composite Function?

A composite function is a function applied to another function. If y=f(g(x))y = f(g(x)), we call g(x)g(x) the inner function and ff the outer function.

Examples:

  • y=(3x+1)4y = (3x + 1)^4: outer = ()4(\cdot)^4, inner = 3x+13x + 1
  • y=sin(x2)y = \sin(x^2): outer = sin()\sin(\cdot), inner = x2x^2
  • y=e5xy = e^{5x}: outer = e()e^{(\cdot)}, inner = 5x5x
  • y=ln(cosx)y = \ln(\cos x): outer = ln()\ln(\cdot), inner = cosx\cos x

The Chain Rule Formula

If y=f(g(x))y = f(g(x)), then:

dydx=f(g(x))g(x)\frac{dy}{dx} = f'(g(x)) \cdot g'(x)

In words: derivative of the outer function (evaluated at the inner function) times the derivative of the inner function.

In Leibniz notation, if y=f(u)y = f(u) and u=g(x)u = g(x):

dydx=dydududx\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}

This looks like the dudu's "cancel," which is a useful mnemonic (though not rigorous).

The Generalized Power Rule

The most common application of the chain rule is with powers:

ddx[un]=nun1dudx\frac{d}{dx}[u^n] = n \cdot u^{n-1} \cdot \frac{du}{dx}

where uu is any function of xx. For example:

ddx[(x2+3x)7]=7(x2+3x)6(2x+3)\frac{d}{dx}[(x^2 + 3x)^7] = 7(x^2 + 3x)^6 \cdot (2x + 3)

Chain Rule with Trigonometric Functions

Every trig derivative gains a factor of the inner derivative:

ddx[sin(u)]=cos(u)u\frac{d}{dx}[\sin(u)] = \cos(u) \cdot u'

ddx[cos(u)]=sin(u)u\frac{d}{dx}[\cos(u)] = -\sin(u) \cdot u'

ddx[tan(u)]=sec2(u)u\frac{d}{dx}[\tan(u)] = \sec^2(u) \cdot u'

Examples:

  • ddx[sin(3x)]=cos(3x)3=3cos(3x)\frac{d}{dx}[\sin(3x)] = \cos(3x) \cdot 3 = 3\cos(3x)
  • ddx[cos(x2)]=sin(x2)2x=2xsin(x2)\frac{d}{dx}[\cos(x^2)] = -\sin(x^2) \cdot 2x = -2x\sin(x^2)
  • ddx[tan(5x+1)]=sec2(5x+1)5=5sec2(5x+1)\frac{d}{dx}[\tan(5x+1)] = \sec^2(5x+1) \cdot 5 = 5\sec^2(5x+1)

Chain Rule with Exponentials and Logarithms

ddx[eu]=euu\frac{d}{dx}[e^u] = e^u \cdot u'

ddx[ln(u)]=1uu=uu\frac{d}{dx}[\ln(u)] = \frac{1}{u} \cdot u' = \frac{u'}{u}

Examples:

  • ddx[e3x2]=e3x26x=6xe3x2\frac{d}{dx}[e^{3x^2}] = e^{3x^2} \cdot 6x = 6xe^{3x^2}
  • ddx[ln(x2+1)]=2xx2+1\frac{d}{dx}[\ln(x^2 + 1)] = \frac{2x}{x^2 + 1}

Nested Chain Rule (Multiple Layers)

Sometimes functions have more than two layers. Apply the chain rule from the outside in, multiplying each derivative:

ddx[sin3(2x)]=ddx[(sin(2x))3]\frac{d}{dx}[\sin^3(2x)] = \frac{d}{dx}[(\sin(2x))^3]

Three layers: outer = ()3(\cdot)^3, middle = sin()\sin(\cdot), innermost = 2x2x.

=3[sin(2x)]2cos(2x)2=6sin2(2x)cos(2x)= 3[\sin(2x)]^2 \cdot \cos(2x) \cdot 2 = 6\sin^2(2x)\cos(2x)

Chain Rule Combined with Product Rule

Many AP problems require both rules simultaneously. Differentiate the product using the product rule, and apply the chain rule whenever you differentiate a composite factor.

Example: ddx[x2sin(3x)]\frac{d}{dx}[x^2 \sin(3x)]

Product rule: 2xsin(3x)+x2cos(3x)32x \cdot \sin(3x) + x^2 \cdot \cos(3x) \cdot 3

=2xsin(3x)+3x2cos(3x)= 2x\sin(3x) + 3x^2\cos(3x)

Chain Rule Combined with Quotient Rule

Example: ddx[e2xx+1]\frac{d}{dx}\left[\frac{e^{2x}}{x+1}\right]

Quotient rule, with chain rule on e2xe^{2x}:

=2e2x(x+1)e2x(1)(x+1)2=e2x(2x+21)(x+1)2=e2x(2x+1)(x+1)2= \frac{2e^{2x}(x+1) - e^{2x}(1)}{(x+1)^2} = \frac{e^{2x}(2x + 2 - 1)}{(x+1)^2} = \frac{e^{2x}(2x+1)}{(x+1)^2}

Implicit Differentiation and the Chain Rule

Implicit differentiation is the chain rule applied to yy as a function of xx. Whenever you differentiate a term involving yy, multiply by dydx\frac{dy}{dx}:

ddx[y3]=3y2dydx\frac{d}{dx}[y^3] = 3y^2 \cdot \frac{dy}{dx}

ddx[sin(y)]=cos(y)dydx\frac{d}{dx}[\sin(y)] = \cos(y) \cdot \frac{dy}{dx}

This connection to implicit differentiation makes the chain rule essential for related rates problems.

Strategy Tips

Tip 1: Identify the Layers Before You Start

Before writing anything, pause and identify the outer and inner functions. For a triple composition like esin(x2)e^{\sin(x^2)}, list the layers: outer = e()e^{(\cdot)}, middle = sin()\sin(\cdot), inner = x2x^2.

Tip 2: Work from the Outside In

Always differentiate the outermost function first, keeping the inner function unchanged. Then multiply by the derivative of the inner function. For multiple layers, repeat.

Tip 3: Don't Forget the Inner Derivative

The most common chain rule error is forgetting to multiply by the derivative of the inner function. Every time you differentiate a composite, ask yourself: "Did I multiply by the inside derivative?"

Tip 4: Use Leibniz Notation for Complex Problems

If a problem is complicated, introduce a substitution: let u=inner functionu = \text{inner function}, find dydu\frac{dy}{du} and dudx\frac{du}{dx} separately, then multiply. This breaks the problem into manageable steps.

Tip 5: Recognize Chain Rule in Reverse (for Integration)

Understanding the chain rule well prepares you for uu-substitution in integration. If ddx[F(g(x))]=F(g(x))g(x)\frac{d}{dx}[F(g(x))] = F'(g(x)) \cdot g'(x), then F(g(x))g(x)dx=F(g(x))+C\int F'(g(x)) \cdot g'(x)\,dx = F(g(x)) + C.

Worked Example: Example 1

Problem

Differentiate f(x)=(5x32x+7)4f(x) = (5x^3 - 2x + 7)^4.

Solution

Outer function: ()4(\cdot)^4. Inner function: 5x32x+75x^3 - 2x + 7.

f(x)=4(5x32x+7)3(15x22)f'(x) = 4(5x^3 - 2x + 7)^3 \cdot (15x^2 - 2)

Worked Example: Example 2

Problem

Find dydx\frac{dy}{dx} if y=cos(e2x)y = \cos(e^{2x}).

Solution

Three layers: outer = cos()\cos(\cdot), middle = e()e^{(\cdot)}, inner = 2x2x.

dydx=sin(e2x)e2x2=2e2xsin(e2x)\frac{dy}{dx} = -\sin(e^{2x}) \cdot e^{2x} \cdot 2 = -2e^{2x}\sin(e^{2x})

Worked Example: Example 3

Problem

Differentiate g(x)=tan(4x)g(x) = \sqrt{\tan(4x)}.

Solution

Rewrite: g(x)=[tan(4x)]1/2g(x) = [\tan(4x)]^{1/2}. Three layers: outer = ()1/2(\cdot)^{1/2}, middle = tan()\tan(\cdot), inner = 4x4x.

g(x)=12[tan(4x)]1/2sec2(4x)4=2sec2(4x)tan(4x)g'(x) = \frac{1}{2}[\tan(4x)]^{-1/2} \cdot \sec^2(4x) \cdot 4 = \frac{2\sec^2(4x)}{\sqrt{\tan(4x)}}

Worked Example: Example 4

Problem

Find ddx[ex(x2+1)3]\frac{d}{dx}[e^x \cdot (x^2 + 1)^3].

Solution

This requires both the product rule and chain rule.

Product rule: ddx[ex](x2+1)3+exddx[(x2+1)3]\frac{d}{dx}[e^x] \cdot (x^2+1)^3 + e^x \cdot \frac{d}{dx}[(x^2+1)^3].

The second term needs the chain rule:

=ex(x2+1)3+ex3(x2+1)22x= e^x(x^2+1)^3 + e^x \cdot 3(x^2+1)^2 \cdot 2x

=ex(x2+1)3+6xex(x2+1)2= e^x(x^2+1)^3 + 6xe^x(x^2+1)^2

Factor out ex(x2+1)2e^x(x^2+1)^2:

=ex(x2+1)2[(x2+1)+6x]=ex(x2+1)2(x2+6x+1)= e^x(x^2+1)^2[(x^2+1) + 6x] = e^x(x^2+1)^2(x^2 + 6x + 1)

Worked Example: Example 5

Problem

Given x2+y2=25x^2 + y^2 = 25, find dydx\frac{dy}{dx}.

Solution

Differentiate both sides with respect to xx:

2x+2ydydx=02x + 2y \cdot \frac{dy}{dx} = 0

The 2ydydx2y \cdot \frac{dy}{dx} comes from applying the chain rule to y2y^2 (since yy is a function of xx).

Solve for dydx\frac{dy}{dx}:

dydx=xy\frac{dy}{dx} = -\frac{x}{y}

Practice Problems

  1. Problem 1

    Differentiate f(x)=(4x21)6f(x) = (4x^2 - 1)^6.

    Answer: f(x)=48x(4x21)5f'(x) = 48x(4x^2 - 1)^5

    Problem 2

    Find ddx[sin2(3x)]\frac{d}{dx}[\sin^2(3x)].

    Hint: Write as (sin(3x))2(\sin(3x))^2 and apply the chain rule twice.

    Answer: 6sin(3x)cos(3x)=3sin(6x)6\sin(3x)\cos(3x) = 3\sin(6x)

    Problem 3

    Differentiate y=ex2/2y = e^{-x^2/2}.

    Answer: y=xex2/2y' = -xe^{-x^2/2}

    Problem 4

    Find ddx[ln(sinx)]\frac{d}{dx}[\ln(\sin x)].

    Answer: cosxsinx=cotx\frac{\cos x}{\sin x} = \cot x

    Problem 5

    Differentiate h(x)=(x+1)3(2x1)2h(x) = \frac{(x+1)^3}{(2x-1)^2} using the quotient and chain rules.

    Answer: h(x)=(x+1)2(x5)(2x1)3h'(x) = \frac{(x+1)^2(x - 5)}{(2x-1)^3}

Want to check your answers and get step-by-step solutions?

Get it on Google PlayDownload on the App Store

Common Mistakes

  • Forgetting the inner derivative entirely. This is the #1 chain rule error. For example, writing ddx[sin(3x)]=cos(3x)\frac{d}{dx}[\sin(3x)] = \cos(3x) instead of 3cos(3x)3\cos(3x). Always multiply by the derivative of the inner function.
  • Stopping too early on multi-layer compositions. For sin3(2x)\sin^3(2x), you need to apply the chain rule three times: power rule, then sine derivative, then the derivative of 2x2x.
  • Confusing sin2(x)\sin^2(x) with sin(x2)\sin(x^2). The notation sin2(x)\sin^2(x) means (sinx)2(\sin x)^2, while sin(x2)\sin(x^2) means sin\sin applied to x2x^2. These have completely different derivatives.
  • Incorrectly applying the chain rule inside a product. When you have a product like xe3xx \cdot e^{3x}, use the product rule first. The chain rule only applies when differentiating the e3xe^{3x} part.
  • Sign errors with negative exponents inside the chain. When differentiating (2x+5)3(2x + 5)^{-3}, the result is 3(2x+5)42=6(2x+5)4-3(2x+5)^{-4} \cdot 2 = -6(2x+5)^{-4}. Don't drop the negative or the inner derivative.

Frequently Asked Questions

How do I know when to use the chain rule?

Use the chain rule whenever you are differentiating a composite function — that is, whenever the "input" to a function is not just plain xx. If you see sin(anything other than x)\sin(\text{anything other than } x), (expression)n(\text{expression})^n where the expression isn't just xx, or esomethinge^{\text{something}}, you need the chain rule.

Can I use the chain rule and product rule at the same time?

Absolutely, and you will do this frequently on the AP exam. Use the product rule for the overall structure, and apply the chain rule whenever you differentiate a composite factor.

What if there are three or more nested functions?

Apply the chain rule repeatedly, from the outside in. For f(g(h(x)))f(g(h(x))), the derivative is f(g(h(x)))g(h(x))h(x)f'(g(h(x))) \cdot g'(h(x)) \cdot h'(x). Each layer multiplies by the next derivative.

Is implicit differentiation just the chain rule?

Yes! When you differentiate y2y^2 with respect to xx and write 2ydydx2y \cdot \frac{dy}{dx}, you are applying the chain rule with yy as the inner function. Understanding this connection makes implicit differentiation much more intuitive.

How does the chain rule connect to $u$-substitution in integration?

uu-substitution is the chain rule in reverse. Since ddx[F(g(x))]=F(g(x))g(x)\frac{d}{dx}[F(g(x))] = F'(g(x)) \cdot g'(x), we can write F(g(x))g(x)dx=F(g(x))+C\int F'(g(x)) \cdot g'(x)\,dx = F(g(x)) + C. Recognizing this pattern is key to choosing good substitutions.

Key Takeaways

  • The chain rule is essential for composite functions. Any time a function is applied to something other than plain xx, you need the chain rule.

  • Derivative of outer times derivative of inner. This is the core pattern — practice it until it becomes automatic.

  • Work from outside in for nested functions. Differentiate the outermost layer first, leaving the inner function unchanged, then multiply by the inner derivative.

  • The chain rule combines with every other rule. Expect product + chain, quotient + chain, and multi-layer chains on the AP exam.

  • Forgetting the inner derivative is the most common error. Always ask: "Did I multiply by the derivative of what's inside?"

  • Implicit differentiation is the chain rule applied to yy. Every yy term gets a dydx\frac{dy}{dx} factor because yy is a function of xx.

Ready to Ace Your AP Calculus AB math?

Get instant step-by-step solutions to any problem. Snap a photo and learn with Tutor AI — your personal exam prep companion.

Get it on Google PlayDownload on the App Store