The chain rule

A function nested inside another is differentiated with the chain rule1. We check it with f(x)=sin(x2)f(x) = \sin(x^2).

The formula

Differentiate the outside with respect to the inside, and multiply by the derivative of the inside with respect to xx.

{g(h(x))}=g(h(x))h(x)\{ g(h(x)) \}' = g'(h(x)) \cdot h'(x)

Here g(t)=sintg(t) = \sin t and h(x)=x2h(x) = x^2, so g(t)=costg'(t) = \cos t and h(x)=2xh'(x) = 2x, and the derivative is as follows.

f(x)=cos(x2)2x=2xcos(x2)f'(x) = \cos(x^2) \cdot 2x = 2x\cos(x^2)

The factor cos(x2)\cos(x^2) alone is not enough. The derivative 2x2x of the inside always multiplies it.

How the 2x2x shows itself

The graph makes the effect of 2x2x visible. The larger xx becomes, the faster the inside x2x^2 grows, so the wave of sin(x2)\sin(x^2) bunches up toward the right. The amplitude of the derivative also grows in proportion to 2x2x.

The spacing of the wave can be followed numerically as well. We have f=0f = 0 when x2=nπx^2 = n\pi, that is at x=nπx = \sqrt{n\pi}.

nnZero at x=nπx = \sqrt{n\pi}Gap from the previous
111.77\approx 1.771.77\approx 1.77
222.51\approx 2.510.73\approx 0.73
333.07\approx 3.070.56\approx 0.56

It nests to any depth

For sin(ex2)\sin\left( e^{x^2} \right), multiplying from the outside inward by cos(ex2)\cos\left( e^{x^2} \right), then ex2e^{x^2}, then 2x2x gives 2xex2cos(ex2)2xe^{x^2}\cos\left( e^{x^2} \right).

A way to remember it

dydx=dydtdtdx\frac{dy}{dx} = \frac{dy}{dt} \cdot \frac{dt}{dx}

It looks as though dtdt cancels like a fraction, but that is only the appearance of the notation; the proof goes by rewriting it as a product of average rates of change.

Relation to substitution in integrals

Integration by substitution is this rule used backwards. Knowing that the chain rule multiplies by the derivative of the inside, one can read off the following integral.

2xcos(x2)dx=sin(x2)+C\int 2x\cos(x^2)\,dx = \sin(x^2) + C

What differentiation multiplies in, integration has to find and take back out.

The wave bunching up to the right is y=sin(x2)y = \sin(x^2), the wave of growing amplitude is the derivative, and the large dots are the origin and (π,0)\left( \sqrt{\pi}, 0 \right).

  1. Chain rule, Wikipedia