In calculus, the chain rule is a formula that expresses the derivative of the composition of two differentiable functions f and g in terms of the derivatives of f and g. More precisely, if h = f ∘ g {\displaystyle h=f\circ g} is the function such that h ( x ) = f ( g ( x ) ) {\displaystyle h(x)=f(g(x))} for every x, then the chain rule is, in Lagrange's notation, h ′ ( x ) = f ′ ( g ( x ) ) g ′ ( x ) . {\displaystyle h'(x)=f'(g(x))g'(x).} or, equivalently, h ′ = ( f ∘ g ) ′ = ( f ′ ∘ g ) ⋅ g ′ . {\displaystyle h'=(f\circ g)'=(f'\circ g)\cdot g'.}
The chain rule may also be expressed in Leibniz's notation. If a variable z depends on the variable y, which itself depends on the variable x (that is, y and z are dependent variables), then z depends on x as well, via the intermediate variable y. In this case, the chain rule is expressed as d z d x = d z d y ⋅ d y d x , {\displaystyle {\frac {dz}{dx}}={\frac {dz}{dy}}\cdot {\frac {dy}{dx}},} and d z d x | x = d z d y | y ( x ) ⋅ d y d x | x , {\displaystyle \left.{\frac {dz}{dx}}\right|_{x}=\left.{\frac {dz}{dy}}\right|_{y(x)}\cdot \left.{\frac {dy}{dx}}\right|_{x},} for indicating at which points the derivatives have to be evaluated.
In integration, the counterpart to the chain rule is the substitution rule.