Mathematics.

differential calculus

Chain Rule

Calculus I35 minDifficulty4 out of 10

You should know: derivative

Overview

The chain rule tells you how to differentiate a composition of functions — a function inside another function. It's the single most-used differentiation rule in practice, because most real functions you'll differentiate are compositions (sin(x²), e^(3x), √(x+1), etc.).

Intuition

Imagine three gears meshed together: gear A turns gear B, which turns gear C. If gear A speeds up, how fast does gear C speed up? You multiply the two individual speed-up ratios (A-to-B and B-to-C) together. The chain rule works the same way for rates of change: if y depends on u, and u depends on x, then the rate y changes with respect to x is the product of how y changes with u and how u changes with x.

Interactive Graph

Drag the point to see the tangent to a composite function

Loading visualization…

Formal Definition

Definition

For a composite function y = f(g(x)):

ddxf(g(x))=f(g(x))g(x)\frac{d}{dx}f(g(x)) = f'(g(x)) \cdot g'(x)
Chain Rule
dydx=dydududx\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}

Leibniz form: y depends on u, u depends on x

Notation

NotationMeaning
f(g(x))g(x)f'(g(x))\cdot g'(x)Lagrange form of the chain rule
dydududx\frac{dy}{du}\cdot\frac{du}{dx}Leibniz form, treating the derivatives like fractions that cancel du

Derivation

Differentiating y = sin(x²) using the chain rule, identifying the outer function f(u)=sin(u) and inner function u=g(x)=x²:

dydu=cos(u)=cos(x2)\frac{dy}{du} = \cos(u) = \cos(x^2)

Derivative of the outer function, evaluated at the inner function

dudx=2x\frac{du}{dx} = 2x

Derivative of the inner function

dydx=cos(x2)2x=2xcos(x2)\frac{dy}{dx} = \cos(x^2) \cdot 2x = 2x\cos(x^2)

Multiply the two pieces together

Properties

Generalizes to any depth of composition

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

Applications

Backpropagation — the algorithm that trains every neural network — IS the chain rule applied repeatedly through the layers of the network, computing how the loss changes with respect to each weight.

Worked Examples

  1. Outer function: u⁵, inner function: u = 3x+1.

    dydu=5u4,dudx=3\frac{dy}{du} = 5u^4,\quad \frac{du}{dx}=3
  2. Multiply and substitute back u = 3x+1.

    dydx=5(3x+1)43=15(3x+1)4\frac{dy}{dx} = 5(3x+1)^4 \cdot 3 = 15(3x+1)^4

Answer: 15(3x+1)⁴

Practice Problems

Difficulty 4/10

Differentiate y = √(x² + 1).

Difficulty 6/10

A spherical balloon's radius grows at dr/dt = 2 cm/s. Using V = (4/3)πr³ and the chain rule, how fast is the volume increasing when r = 5 cm?

Difficulty 5/10

A cooling body has temperature T(t) = 20 + 40e^(−0.1t). Use the chain rule to find the rate of cooling dT/dt at t = 0.

Common Mistakes

Common Mistake

Forgetting to multiply by the derivative of the inner function.

d/dx[sin(x²)] is NOT cos(x²) — you must also multiply by the inner derivative 2x, giving 2x·cos(x²).

Quiz

What is d/dx[(2x+3)⁴]?

Flashcards

1 / 2

Historical Background

Leibniz used an early form of the chain rule as early as 1676, expressed in his differential notation, though the first explicit general statement is often credited to Leibniz's later correspondence and to Guillaume de l'Hôpital's 1696 calculus textbook, the first ever published on the subject.

  1. 1676

    Leibniz applies chain-rule reasoning implicitly in unpublished notes

    Gottfried Wilhelm Leibniz

  2. 1696

    L'Hôpital's Analyse des Infiniment Petits, the first calculus textbook, includes chain-rule-style computations

    Guillaume de l'Hôpital

Summary

  • The chain rule differentiates a composition f(g(x)): multiply the outer derivative (evaluated at the inner function) by the inner derivative.
  • Leibniz form: dy/dx = dy/du · du/dx.
  • Extends to any depth of nested composition — multiply all the layers together.
  • Backpropagation in deep learning is the chain rule applied layer by layer through a network.

References