Chain Rule

Premier
lean4-proofcalculusderivativesvisualization
ddx[f(g(x))]=f(g(x))g(x)\frac{d}{dx}[f(g(x))] = f'(g(x)) \cdot g'(x)

The chain rule allows us to differentiate composite functions. If we have a function h(x)=f(g(x))h(x) = f(g(x)), then its derivative is:

ddx[f(g(x))]=f(g(x))g(x)\frac{d}{dx}[f(g(x))] = f'(g(x)) \cdot g'(x)

Intuition

Think of it as peeling layers: differentiate the outer function, then multiply by the derivative of the inner function.

Step-by-step example

Given h(x)=(x2+1)3h(x) = (x^2 + 1)^3, we identify:

  • Outer function: f(u)=u3f(u) = u^3, so f(u)=3u2f'(u) = 3u^2
  • Inner function: g(x)=x2+1g(x) = x^2 + 1, so g(x)=2xg'(x) = 2x

Applying the chain rule:

h(x)=3(x2+1)22x=6x(x2+1)2h'(x) = 3(x^2 + 1)^2 \cdot 2x = 6x(x^2 + 1)^2

General form

For a composition of nn functions:

ddx[f1f2fn](x)=k=1nfk(fk+1fn(x))\frac{d}{dx}[f_1 \circ f_2 \circ \cdots \circ f_n](x) = \prod_{k=1}^{n} f_k'(f_{k+1} \circ \cdots \circ f_n(x))