Chain rule
Composites of more than two functions

The chain rule can be applied to composites of more than two functions. To take the derivative of a composite of more than two functions, notice that the composite of f, g, and h (in that order) is the composite of f with g ∘ h. The chain rule states that to compute the derivative of f ∘ g ∘ h, it is sufficient to compute the derivative of f and the derivative of g ∘ h. The derivative of f can be calculated directly, and the derivative of g ∘ h can be calculated by applying the chain rule again.

For concreteness, consider the function

This can be decomposed as the composite of three functions:

So that y = f (g (h (x))) {\displaystyle y=f(g(h(x)))}.

Their derivatives are:

The chain rule states that the derivative of their composite at the point x = a is:

In Leibniz's notation, this is:

or for short,

The derivative function is therefore:

Another way of computing this derivative is to view the composite function f ∘ g ∘ h as the composite of f ∘ g and h. Applying the chain rule in this manner would yield:

This is the same as what was computed above. This should be expected because (f ∘ g) ∘ h = f ∘ (g ∘ h).

Sometimes, it is necessary to differentiate an arbitrarily long composition of the form f 1 ∘ f 2 ∘ ⋯ ∘ f n − 1 ∘ f n {\displaystyle f_{1}\circ f_{2}\circ \cdots \circ f_{n-1}\circ f_{n}\!}. In this case, define

where f a.. a = f a {\displaystyle f_{a\,.\,.\,a}=f_{a}} and f a.. b (x) = x {\displaystyle f_{a\,.\,.\,b}(x)=x} when b < a {\displaystyle b<a}. Then the chain rule takes the form

or, in the Lagrange notation,
language:response_language[Portuguese]