DerivCalc
Focused calculus lesson

Mastering the Chain Rule

Master the chain rule for nested functions with outside-in identification, multi-layer examples, mistakes, and practice.

Guide 3 · Core rules

Mastering the Chain Rule

Written by SilverCodeLabsReviewed for mathematical clarityRevised August 27, 2026
Recognize

One function sits inside another function.

Apply

Differentiate outside, preserve inside, multiply by inside derivative.

Verify

Count layers; each normally contributes a derivative factor.

The Chain Rule is one of the most powerful tools in calculus, used to differentiate composite functions — functions nested within one another. It describes how rates of change propagate through a system of dependent variables, like a chain reaction.

The Core Concept: Outside-In Differentiation

A composite function \(h(x) = f(g(x))\) has an "outer function" \(f\) and an "inner function" \(g\). The Chain Rule states that the derivative is the derivative of the outer function (evaluated at the original inner function) multiplied by the derivative of the inner function.

The rule in two notations

Lagrange's notation: \((f(g(x)))' = f'(g(x)) \cdot g'(x)\)

Leibniz's notation: if \(y=f(u)\) and \(u=g(x)\), then \(\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}\)

Example: differentiating \(h(x) = \sin(x^2)\)

  • Outer function \(f(u)=\sin(u)\): derivative is \(\cos(u)\).
  • Inner function \(g(x)=x^2\): derivative is \(2x\).
  • Apply the rule: \(h'(x) = \cos(x^2)\cdot(2x) = 2x\cos(x^2)\)

Advanced Compositions

The rule can be applied recursively for functions with multiple layers.

Nested functions: \(k(x) = \cos^4(7x^2+1)\)

Rewrite as \(k(x) = [\cos(7x^2+1)]^4\). This has three layers:

  1. Outermost (\(u^4\)): \(4[\cos(7x^2+1)]^3\)
  2. Middle (\(\cos(v)\)): \(-\sin(7x^2+1)\)
  3. Innermost (\(7x^2+1\)): \(14x\)

Combine all parts: \(k'(x) = -56x \cos^3(7x^2+1)\sin(7x^2+1)\)

Real-World Applications

  • Related rates: used with time as the variable to find how the rate of change of one quantity affects another (for example, relating a balloon's volume change to its radius change).
  • Machine learning: the Chain Rule is the engine behind "backpropagation," the algorithm used to train artificial neural networks by calculating the gradient of the network's error.
  • Implicit differentiation: the Chain Rule is the justification for why we multiply by \(\frac{dy}{dx}\) when differentiating terms involving \(y\) — see the implicit differentiation lesson.

The Chain Rule is far more than a procedure. It is the essential instrument that allows calculus to move from analyzing static quantities to studying dynamic, interconnected systems — the causal chains that govern processes in science, engineering, and beyond.

Try it: differentiate sin(x²) and watch the chain rule fire

Check your understanding

  1. Differentiate (5x−2)⁷.
    Show answer

    35(5x−2)⁶.

  2. Differentiate e^(x²+1).
    Show answer

    2x e^(x²+1).

  3. Differentiate cos³(2x).
    Show answer

    −6cos²(2x)sin(2x).

Reference standard: Rule statements and notation follow OpenStax Calculus Volume 1, Chapter 3. DerivCalc's explanations and examples are independently written.

Editorial note: Examples are checked symbolically and with numerical sampling. Read the methodology and limitations or report a correction.