AP Calculus AB and BC

Chain Rule: Spot the Composition, Then Differentiate

The chain rule differentiates a composition like f(x) = g(h(x)) by differentiating the outer function, leaving the inside untouched, then multiplying by the derivative of the inside: g'(h(x)) times h'(x). The hard part is recognition: spotting one function nested inside another before you differentiate.

Recognition comes before the rule

The chain rule handles exactly one situation: a composition, where one function is fed into another. Written with symbols, a composition is f(x)=g(h(x))f(x) = g(h(x)), meaning you evaluate the inner function hh first and then run its output through the outer function gg. The rule itself is short: differentiate the outer function, leave the inside exactly as it is, then multiply by the derivative of the inside. CED Topic 3.1 introduces this as skill 1.C, choosing a procedure from how an expression is built, which is the tell that recognition matters more than memorizing the formula.

f(x)=g(h(x))h(x)f'(x) = g'(h(x)) \cdot h'(x)

So the first question on any derivative is not how but what: is this a composition at all? Here is the test. Can you finish the derivative in one known step, a single power rule, or a single trig or exponential rule? If a function is xx raised to a power, the power rule ends it. If it is sinx\sin x, one rule ends it. But sin(x2)\sin(x^2) is the sine of something more complicated than xx, and (3x2+5x)4(3x^2 + 5x)^4 is a power of something more complicated than xx. That 'something more complicated' is an inner function, and its presence is the signal to reach for the chain rule.

This one rule quietly powers much of the rest of the course. Implicit differentiation (Topic 3.2) is the chain rule applied to yy as a function of xx, related rates (Topic 4.4) differentiate a composition with respect to time, and uu-substitution in integration runs the chain rule backward. Getting recognition solid here pays off repeatedly.

Name the outer and inner function

Every chain-rule problem starts by splitting the composition into an outer function and an inner function. The cleanest way to find them is to picture evaluating the expression at a number, say x=2x = 2, and to watch the order of operations. Whatever you would do last is the outer function; everything you did before it is the inner function.

The last-operation test

For (3x2+5x)4(3x^2 + 5x)^4, you would compute 3x2+5x3x^2 + 5x first and raise to the fourth power last, so the outer function is 'raise to the fourth power' and the inner function is 3x2+5x3x^2 + 5x. For cos(3x21)\cos(3x^2 - 1), you would compute 3x213x^2 - 1 first and take cosine last, so cosine is the outer function and 3x213x^2 - 1 is the inner.

Naming the two pieces out loud, outer is cosine, inner is 3x213x^2 - 1, is worth the few seconds it takes. Most wrong answers on this topic come from students who start differentiating before they have decided which function is on the outside.

The three-step method

Once you can name the outer and inner functions, the procedure is always the same three steps.

  1. Differentiate the outer function, keeping the inner function untouched inside it.
  2. Differentiate the inner function on its own.
  3. Multiply the two results together.

The same idea in Leibniz notation, which the College Board states directly in Topic 3.1, uses uu for the inner function:

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

Read left to right, dy/du is the outer derivative and du/dx is the inner derivative. Whichever notation you use, the structure is identical: outer derivative times inner derivative. For a composition nested three or more layers deep, the pattern simply continues, one derivative factor per layer, which is why a deeply nested function like sin2(3x)\sin^2(3x) produces a product of several factors.

Trig compositions and the sin^2 trap

Trig functions are the most common outer functions you will meet in composition problems, and they carry a notation trap worth defusing now. The expressions sin(x2)\sin(x^2) and sin2(x)\sin^2(x) look almost the same and differentiate in completely different ways, because they are built differently.

ExpressionHow it is builtDerivative
sin(x2)\sin(x^2)sine of x2x^2 (outer sine, inner x2x^2)cos(x2)2x=2xcos(x2)\cos(x^2) \cdot 2x = 2x\cos(x^2)
sin2(x)\sin^2(x)(sinx)2(\sin x)^2 (outer square, inner sinx\sin x)2sinxcosx2\sin x \cos x

In sin(x2)\sin(x^2) the outer function is sine, so its derivative is cos(x2)\cos(x^2) with the inside x2x^2 untouched, then times the inner derivative 2x2x. In sin2(x)\sin^2(x), which means (sinx)2(\sin x)^2, the outer function is squaring, so its derivative is 2sinx2\sin x with the inside sinx\sin x untouched, then times the inner derivative cosx\cos x. Same-looking notation, opposite outer functions.

The habit that keeps trig compositions clean: when you differentiate the outer trig function, its inside stays exactly as it was, and only then do you multiply by the derivative of that inside. These are the three you will use most, with uu standing for the inner function and uu' its derivative:

Outer functionChain-rule derivative
sin(u)\sin(u)cos(u)u\cos(u) \cdot u'
cos(u)\cos(u)sin(u)u-\sin(u) \cdot u'
tan(u)\tan(u)sec2(u)u\sec^2(u) \cdot u'

Where students lose points

Most points lost on this topic trace back to a small number of repeatable mistakes.

  • Forgetting the inner derivative. Writing the derivative of cos(3x21)\cos(3x^2 - 1) as sin(3x21)-\sin(3x^2 - 1) and stopping drops the 6x6x factor. This is the single most common chain-rule error.
  • Changing the inside while differentiating the outside. When you differentiate the outer function, the inner function stays exactly as it is: the derivative of (3x2+5x)4(3x^2 + 5x)^4 keeps 3x2+5x3x^2 + 5x intact as 4(3x2+5x)34(3x^2 + 5x)^3, not 4(6x+5)34(6x + 5)^3.
  • Missing a layer. A function like sin2(3x)\sin^2(3x) has three nested layers, so the chain rule fires twice. Peel one layer at a time.
  • Confusing sin2(x)\sin^2(x) with sin(x2)\sin(x^2). Read the notation before you differentiate.
  • Dropping the chain rule inside a product or quotient. In x2sin(3x)x^2 \sin(3x) the sin(3x)\sin(3x) factor still needs its own chain-rule derivative 3cos(3x)3\cos(3x).

Quick check

After every chain-rule derivative, ask: did I multiply by the derivative of the inside? If the inside was anything more complicated than xx, that factor must be there.

Worked examples

Worked example

A polynomial raised to a power

Differentiate f(x)=(3x2+5x)4f(x) = (3x^2 + 5x)^4.

  1. Spot the composition. The last thing you would do when evaluating is raise to the fourth power, so the outer function is g(u)=u4g(u) = u^4 and the inner function is h(x)=3x2+5xh(x) = 3x^2 + 5x, giving f(x)=g(h(x))f(x) = g(h(x)).
  2. Differentiate the outer function, leaving the inside alone. Since g(u)=u4g(u) = u^4, we have g(u)=4u3g'(u) = 4u^3, so g(h(x))=4(3x2+5x)3g'(h(x)) = 4(3x^2 + 5x)^3.
  3. Differentiate the inner function: h(x)=6x+5h'(x) = 6x + 5.
  4. Multiply the two pieces: f(x)=g(h(x))h(x)=4(3x2+5x)3(6x+5)f'(x) = g'(h(x)) \cdot h'(x) = 4(3x^2 + 5x)^3 (6x + 5).

f(x)=4(6x+5)(3x2+5x)3f'(x) = 4(6x + 5)(3x^2 + 5x)^3

Worked example

A trig composition

Differentiate f(x)=cos(3x21)f(x) = \cos(3x^2 - 1).

  1. Spot the composition. You compute 3x213x^2 - 1 first and take cosine last, so the outer function is g(u)=cosug(u) = \cos u and the inner function is h(x)=3x21h(x) = 3x^2 - 1.
  2. Differentiate the outer function, keeping the inside intact. The derivative of cosu\cos u is sinu-\sin u, so g(h(x))=sin(3x21)g'(h(x)) = -\sin(3x^2 - 1). Notice the inside stays exactly as 3x213x^2 - 1; only the cosine changes.
  3. Differentiate the inner function: h(x)=6xh'(x) = 6x.
  4. Multiply: f(x)=sin(3x21)6x=6xsin(3x21)f'(x) = -\sin(3x^2 - 1) \cdot 6x = -6x\sin(3x^2 - 1).

f(x)=6xsin(3x21)f'(x) = -6x\sin(3x^2 - 1)

Worked example

A nested composition with three layers

Differentiate f(x)=sin2(3x)f(x) = \sin^2(3x).

  1. Read the notation first. sin2(3x)\sin^2(3x) means (sin(3x))2(\sin(3x))^2: the sine of 3x3x, then squared. That is three functions nested together, square the sine of triple xx.
  2. Peel from the outside in. The outermost operation is squaring, so start there: the derivative of (something)2(\text{something})^2 is 2(something)2(\text{something}), giving 2sin(3x)2\sin(3x), with the inside left untouched.
  3. Move one layer in, to the sine. The derivative of sin(something)\sin(\text{something}) is cos(something)\cos(\text{something}), so this layer contributes cos(3x)\cos(3x), again leaving its own inside 3x3x untouched.
  4. Move to the innermost layer. The derivative of 3x3x is 33.
  5. Multiply all three layers together: f(x)=2sin(3x)cos(3x)3=6sin(3x)cos(3x)f'(x) = 2\sin(3x) \cdot \cos(3x) \cdot 3 = 6\sin(3x)\cos(3x).

f(x)=6sin(3x)cos(3x)f'(x) = 6\sin(3x)\cos(3x), which equals 3sin(6x)3\sin(6x) by the double-angle identity.

Frequently asked questions

How do I know whether to use the chain rule or the product rule?

Look at how the expression is built. The chain rule is for a composition, one function inside another, like cos(3x21)\cos(3x^2 - 1). The product rule is for two functions multiplied, like x2cosxx^2 \cos x. If you see a function tucked inside another function, it is the chain rule; if you see two separate factors multiplied, it is the product rule. Many problems use both, so check each piece.

Is sin2(x)\sin^2(x) the same as sin(x2)\sin(x^2)?

No. sin2(x)\sin^2(x) means (sinx)2(\sin x)^2, so the outer function is squaring and its derivative is 2sinxcosx2\sin x \cos x. sin(x2)\sin(x^2) means the sine of x2x^2, so the outer function is sine and its derivative is 2xcos(x2)2x\cos(x^2). Read the notation carefully before you differentiate.

What does the chain rule look like in Leibniz notation?

If y is a function of u and u is a function of x, then dy/dx equals dy/du times du/dx. Here u is the inner function, dy/du is the outer derivative, and du/dx is the inner derivative. This is the form the AP CED lists in Topic 3.1.