Chain rule

Differentiate the outside function, keep the inside unchanged, then multiply by the derivative of the inside.

\[\left(f \circ g\right)' = f'(g)\,g'\]

What it says

When one function is applied to another, the rates of change multiply. If \(y\) changes three times as fast as \(u\), and \(u\) changes twice as fast as \(x\), then \(y\) changes six times as fast as \(x\). In Leibniz notation the statement is almost self-evident: \(\frac{dy}{dx} = \frac{dy}{du}\cdot\frac{du}{dx}\).

The practical procedure is: identify the outer function and the inner one, differentiate the outer while leaving the inner argument exactly as it is, then multiply by the derivative of the inner. The factor \(g'\) is the part most often forgotten.

Chains can nest to any depth. For \(\sin\!\left(\sqrt{x^{2}+1}\right)\) you peel one layer at a time, multiplying a new factor at each step.

When it applies

  • A function is applied to something more complicated than the bare variable.
  • Any composite: \(\sin(3x)\), \(e^{x^{2}}\), \(\ln(1 + x^{2})\), \((2x + 1)^{5}\).
  • Whenever an inner expression would need a rule of its own to differentiate.

Five worked examples

Every line is the step the calculator would show, in the order it applies them. Each graph is live: hover it to read both curves and see the tangent whose slope is the derivative, drag to pan, scroll to zoom.

Example 1
\[\frac{d}{dx}\left[\sin\left(3 x\right)\right]\]
  1. Outer is \(\sin\), inner is \(u = 3x\). Differentiate the outer, keeping \(3x\) inside.

    \[= \cos\left(3x\right)\cdot\frac{d}{dx}\left[3x\right]\]
  2. The inner derivative is \(3\).

    \[= 3\cos\left(3x\right)\]
Answer
\[3 \cos\left(3 x\right)\]

Three full oscillations of f in the space \(\sin x\) would take for one, and a derivative reaching \(\pm 3\) rather than \(\pm 1\). The two curves stay a quarter of a compressed period apart the whole way along.

Without the factor \(3\) the answer would be wrong by a factor of three — the classic chain-rule slip.

Open sin(3x) in the calculator
Example 2
\[\frac{d}{dx}\left[\left(2 x + 1\right)^{5}\right]\]
  1. Outer is the fifth power, inner is \(2x + 1\).

    \[= 5\left(2x + 1\right)^{4}\cdot\frac{d}{dx}\left[2x + 1\right]\]
  2. The inner derivative is \(2\).

    \[= 10\left(2x + 1\right)^{4}\]
Answer
\[10 \cdot \left(2 x + 1\right)^{4}\]

A steep curve centred on \(x = -\tfrac{1}{2}\), where f and f′ touch zero together — the behaviour of \(x^{5}\) at the origin, shifted and compressed.

Expanding a fifth power first would work but is far more labour.

Open (2x+1)^5 in the calculator
Example 3
\[\frac{d}{dx}\left[e^{x^{2}}\right]\]
  1. Outer is \(e^{u}\), which is its own derivative; inner is \(u = x^{2}\).

    \[= e^{x^{2}}\cdot\frac{d}{dx}\left[x^{2}\right]\]
  2. Inner derivative \(2x\).

    \[= 2xe^{x^{2}}\]
Answer
\[2 x e^{x^{2}}\]

A rapidly rising bowl, flat at the origin, with f′ negative to the left and positive to the right.

Note \(e^{x^{2}}\), not \(e^{2x}\) — the exponent is untouched by the differentiation.

Open e^(x^2) in the calculator
Example 4
\[\frac{d}{dx}\left[\ln\left(1 + x^{2}\right)\right]\]
  1. Outer is \(\ln u\) with derivative \(\frac{1}{u}\); inner is \(1 + x^{2}\).

    \[= \frac{1}{1 + x^{2}}\cdot\frac{d}{dx}\left[1 + x^{2}\right]\]
  2. Inner derivative \(2x\).

    \[= \frac{2x}{1 + x^{2}}\]
Answer
\[\frac{2 x}{1 + x^{2}}\]

Defined for every real x, since \(1 + x^{2}\) is never zero. f is a symmetric well and f′ peaks at \(x = \pm 1\).

For a logarithm the pattern is always \(\frac{u'}{u}\) — derivative of the inside over the inside.

Open ln(1+x^2) in the calculator
Example 5
\[\frac{d}{dx}\left[\sqrt{\sin\left(x\right)}\right]\]
  1. Rewrite as a power: outer \(u^{1/2}\), inner \(\sin x\).

    \[= \tfrac{1}{2}\left(\sin x\right)^{-1/2}\cdot\frac{d}{dx}\left[\sin x\right]\]
  2. Inner derivative \(\cos x\).

    \[= \frac{\cos x}{2\sqrt{\sin x}}\]
Answer
\[\frac{\cos\left(x\right)}{2 \sqrt{\sin\left(x\right)}}\]

Defined only where \(\sin x \geq 0\), so the curve arrives in arches, with f′ blowing up at both ends of each one.

Two rules stacked: power rule outside, trigonometric rule inside, joined by the chain rule.

Open sqrt(sin(x)) in the calculator

Watch out for

  • Forgetting \(g'\) altogether — the most frequent error in all of differentiation.
  • Changing the inside while differentiating the outside: the derivative of \(\sin(3x)\) starts \(\cos(3x)\), never \(\cos x\).
  • For nested compositions, every layer contributes a factor; stopping after one layer leaves the answer incomplete.