In calculus, the chain rule is a formula to compute the derivative of a composite function. That is, if f and g are differentiable functions, then the chain rule expresses the derivative of their composite f ∘ g — the function which maps x to
f
(
g
(
x
)
)
{\displaystyle f(g(x))}
— in terms of the derivatives of f and g and the product of functions as follows:
(
f
∘
g
)
′
=
(
f
′
∘
g
)
⋅
g
′
.
{\displaystyle (f\circ g)'=(f'\circ g)\cdot g'.}
Alternatively, by letting h = f ∘ g (equiv., h(x) = f(g(x)) for all x), one can also write the chain rule in Lagrange's notation, as follows:
h
′
(
x
)
=
f
′
(
g
(
x
)
)
g
′
(
x
)
.
{\displaystyle h'(x)=f'(g(x))g'(x).}
The chain rule may also be rewritten in Leibniz's notation in the following way. If a variable z depends on the variable y, which itself depends on the variable x (i.e., y and z are dependent variables), then z, via the intermediate variable of y, depends on x as well. In which case, the chain rule states that:
d
z
d
x
=
d
z
d
y
⋅
d
y
d
x
.
{\displaystyle {\frac {dz}{dx}}={\frac {dz}{dy}}\cdot {\frac {dy}{dx}}.}
More precisely, to indicate the point each derivative is evaluated at,
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}}
.
The versions of the chain rule in the Lagrange and the Leibniz notation are equivalent, in the sense that if
z
=
f
(
y
)
{\displaystyle z=f(y)}
and
y
=
g
(
x
)
{\displaystyle y=g(x)}
, so that
z
=
f
(
g
(
x
)
)
=
(
f
∘
g
)
(
x
)
{\displaystyle z=f(g(x))=(f\circ g)(x)}
, then
d
z
d
x
|
x
=
(
f
∘
g
)
′
(
x
)
{\displaystyle \left.{\frac {dz}{dx}}\right|_{x}=(f\circ g)'(x)}
and
d
z
d
y
|
y
(
x
)
⋅
d
y
d
x
|
x
=
f
′
(
y
(
x
)
)
g
′
(
x
)
=
f
′
(
g
(
x
)
)
g
′
(
x
)
.
{\displaystyle \left.{\frac {dz}{dy}}\right|_{y(x)}\cdot \left.{\frac {dy}{dx}}\right|_{x}=f'(y(x))g'(x)=f'(g(x))g'(x).}
Intuitively, the chain rule states that knowing the instantaneous rate of change of z relative to y and that of y relative to x allows one to calculate the instantaneous rate of change of z relative to x. As put by George F. Simmons: "if a car travels twice as fast as a bicycle and the bicycle is four times as fast as a walking man, then the car travels 2 × 4 = 8 times as fast as the man."In integration, the counterpart to the chain rule is the substitution rule.