AP Calculus AB/BC

Part 2 · differentiation

The chain rule

The rule for a function inside a function, and the one students most often apply without noticing they needed to.

By the end of this chapter you can

  • Identify the outer and inner function in a composition
  • Differentiate nested compositions correctly
  • Explain why the inner derivative appears as a factor
  • Recognise a composition disguised as something simpler

Everything so far differentiated functions that were added, multiplied or divided. The chain rule handles the remaining way to build a function: putting one inside another.

ddxf(g(x))=f(g(x))g(x)\frac{d}{dx} f\big(g(x)\big) = f'\big(g(x)\big)\cdot g'(x)

In words: differentiate the outside, leave the inside alone, then multiply by the derivative of the inside.

That final factor is the whole rule. Forgetting it is the single most common mistake in differential calculus, and it is silent — the answer looks plausible.

Why the inner derivative is there

Think about rates. If yy changes three times as fast as uu, and uu changes five times as fast as xx, then yy changes fifteen times as fast as xx. Rates through a chain multiply:

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

which is the same statement in Leibniz notation, and is the version worth remembering because the cancellation is a useful mnemonic — even though the symbols are not really fractions being cancelled.

  • ddxsin(2x)=2cos(2x)\frac{d}{d x} \sin{\left(2 x \right)} = 2 \cos{\left(2 x \right)}
  • ddxsin(x2)=2xcos(x2)\frac{d}{d x} \sin{\left(x^{2} \right)} = 2 x \cos{\left(x^{2} \right)}
  • ddxe3x=3e3x\frac{d}{d x} e^{3 x} = 3 e^{3 x}
  • ddx(x2+1)5=10x(x2+1)4\frac{d}{d x} \left(x^{2} + 1\right)^{5} = 10 x \left(x^{2} + 1\right)^{4}
checked by the build

Look at the first: sin(2x)\sin(2x) oscillates twice as fast as sinx\sin x, so its slope is twice as steep. The factor of 22 is not bookkeeping — it is the function genuinely changing twice as quickly.

Drag hh towards zero at x=0x = 0: the slope heads for 22, not 11. The derivative of sinx\sin x at zero is 11; compressing the input doubles it.

Spotting the composition

The hard part is not the rule, it is noticing that a composition is present. Ask: to evaluate this at a number, what would I compute first? That inner computation is gg.

Expression Inner gg Outer ff
sin(x2)\sin(x^2) x2x^2 sin\sin
(3x+1)7(3x+1)^7 3x+13x+1 ( )7(\ )^7
ecosxe^{\cos x} cosx\cos x e( )e^{(\ )}
1x2\sqrt{1 - x^2} 1x21 - x^2  \sqrt{\ }
ln(5x)\ln(5x) 5x5x ln\ln
  • ddx(3x+1)7=21(3x+1)6\frac{d}{d x} \left(3 x + 1\right)^{7} = 21 \left(3 x + 1\right)^{6}
  • ddxecos(x)=ecos(x)sin(x)\frac{d}{d x} e^{\cos{\left(x \right)}} = - e^{\cos{\left(x \right)}} \sin{\left(x \right)}
  • ddx1x2=x1x2\frac{d}{d x} \sqrt{1 - x^{2}} = - \frac{x}{\sqrt{1 - x^{2}}}
  • ddxlog(5x)=1x\frac{d}{d x} \log{\left(5 x \right)} = \frac{1}{x}
checked by the build

The last one is worth pausing on. The chain rule gives 15x5=1x\tfrac{1}{5x}\cdot 5 = \tfrac{1}{x} — the 55 cancels entirely. That is not a coincidence: ln(5x)=ln5+lnx\ln(5x) = \ln 5 + \ln x, and ln5\ln 5 is a constant, so the two functions differ by a constant and must have the same derivative. Two routes, one answer, and each checks the other.

Nesting deeper

Three layers is the same rule applied twice, working outward in:

ddxf(g(h(x)))=f(g(h(x)))g(h(x))h(x)\frac{d}{dx} f\big(g(h(x))\big) = f'\big(g(h(x))\big)\cdot g'\big(h(x)\big)\cdot h'(x)

  • ddxsin(e2x)=2e2xcos(e2x)\frac{d}{d x} \sin{\left(e^{2 x} \right)} = 2 e^{2 x} \cos{\left(e^{2 x} \right)}
  • ddxsin3(x2)=6xsin2(x2)cos(x2)\frac{d}{d x} \sin^{3}{\left(x^{2} \right)} = 6 x \sin^{2}{\left(x^{2} \right)} \cos{\left(x^{2} \right)}
checked by the build

Peel one layer at a time and write each factor as you go. The mechanical discipline matters more than cleverness here — most errors in nested problems are dropped factors, not misunderstood rules.

Where it shows up next

The chain rule is not one topic among several. It is the machinery behind:

  • implicit differentiation — every yy is secretly y(x)y(x), so differentiating it produces dydx\tfrac{dy}{dx} as an inner derivative,
  • related rates — every quantity is secretly a function of tt,
  • uu-substitution in integration, which is the chain rule run backwards.

Getting comfortable now pays three more times before the course ends.