Chain Rule: Unpacking Nested Rates of Change
The chain rule is like Russian nesting dolls for rates of change. To find the derivative of a nested function, you multiply the derivatives of the 'outer' and 'inner' functions. It's the engine behind backpropagation in neural networks.
WHY IT EXISTS Systems often involve chains of dependency: a final output depends on an intermediate result, which in turn depends on an initial input. The chain rule was developed to calculate the overall rate of change in such systems without needing to first substitute and simplify the entire nested expression into a single, complex function.
THE MENTAL MODEL Think of a series of gears. Turning gear A at a certain speed causes gear B to turn, which in turn causes gear C to turn. To find how fast gear C turns relative to gear A, you multiply the gear ratios: (C's speed / B's speed) * (B's speed / A's speed). The chain rule does this for nested functions, multiplying their rates of change.
HOW IT WORKS For a composite function h(x) = f(g(x)), its derivative is the derivative of the outer function f (with the inner function g(x) left inside) multiplied by the derivative of the inner function g. In Lagrange's notation, this is h'(x) = f'(g(x)) * g'(x). In Leibniz's notation, which is very intuitive, if y = f(u) and u = g(x), then dy/dx = dy/du * du/dx. The 'du' terms appear to cancel out, giving the correct relationship.
WHEN TO USE IT Use it any time you need the derivative of a composite function. Its most famous modern application is in machine learning for training neural networks via backpropagation. The network's final error is a deeply nested function of its weights, and the chain rule allows us to calculate the error gradient for each weight, layer by layer, to perform optimization.
WHEN NOT TO USE IT If a function is a simple sum, product, or quotient of non-nested functions, use the sum, product, or quotient rules instead. The chain rule is specifically for composition, like sin(x^2), not for combinations like sin(x) + x^2 or sin(x) * x^2.
ONE CANONICAL EXAMPLE Let's find the derivative of h(x) = (5x + 2)^3. The outer function is f(u) = u^3, and the inner function is g(x) = 5x + 2. The derivative of the outer function is f'(u) = 3u^2. The derivative of the inner function is g'(x) = 5. Applying the rule h'(x) = f'(g(x)) * g'(x), we get: h'(x) = 3(5x + 2)^2 * 5, which simplifies to 15(5x + 2)^2.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.