Chain rule

In calculus, the chain rule describes the derivative of a "function of a function": the composition of two function, where the output z is a given function of an intermediate variable y which is in turn a given function of the input variable x.

Suppose that y is given as a function $$y = g(x)$$ and that z is given as a function $$z = f(y)$$. The rate at which z varies in terms of y is given by the derivative $$f'(y)$$, and the rate at which y varies in terms of x is given by the derivative $$g'(x)$$. So the rate at which z varies in terms of x is the product $$f'(y).g'(x)$$, and substituting $$y = g(x)$$ we have the chain rule


 * $$(f \circ g)' = (f' \circ g) . g' . \,$$

In traditional "d" notation we write


 * $$\frac{\mathrm{d} z}{\mathrm{d} x} = \frac{\mathrm{d} z}{\mathrm{d} y} \cdot \frac{\mathrm{d} y}{ \mathrm{d} x} . \, $$