# The Chain Rule

Theorem 1 (The Chain Rule): If $f$ is a differentiable function that is a composition of two other functions $g$ and $h$ such that $f(x) = g(h(x)) = f \circ g (x)$, then $f'(x) = g'(h(x)) \cdot h'(x)$. Written in Leibniz notation, if $u = h(x)$ and $y = g(h(x))$, then $\frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}$. |

We will not prove the chain rule at this time since the various proofs are rather complicated, but rather, skip directly into some examples.

## Example 1

**Differentiate the function $f(x) = \sin (x^2 - 3x)$.**

In this case we have a composite function. Our "inner" function can be seen as $x^2 - 3x$, while our outer function can be seen as $\sin x$. Thus we can apply the chain rule for differentiation:

(1)## Example 2

**Differentiate the function $f(x) = (3x - 2)^2$.**

In this case, we have a composite function again since the inner function is $3x - 2$, and the outer function is $x^2$. However, we do not necessarily need the chain rule to find the derivative of $f$ as we can expand and then differentiate this function as a polynomial. For example:

(2)Let's use the chain rule to see if we get the same result:

(3)Thus we get the same answer. Note that the first method is easier because the exponent is only to the power of 2, but sometimes we cannot expand easily as seen in the next example.

## Example 3

**Differentiate the function $f(x) = (x^3 - 5x^2 + 7x)^{100}$.**

Clearly this function can be expanded easily, so we will need to apply the chain rule to find the derivative:

(4)# The Chain Rule of a Function of Many Compositions

Suppose we have a function f(x) in the general form:

(5)The great thing is that we can still apply the chain rule. Let's first look at the case in which we have three functions forming a composite, namely $g_1, g_2, g_2$. Therefore:

(6)Now let's let $h(x) = g_2(g_3(x))$. Thus $f(x) = g_1(h(x))$, and we can solve this by using the chain rule:

(7)Notice that we can substitute $h(x) = g_2(g_3(x))$ back into our derivative equation to obtain:

(8)But now we need to simplify the expression for the derivative of h(x) = g_2(g_3(x)) . We can simply apply the chain rule again to obtain:

(9)We should be able to notice that there is a pattern with successive components of this derivative. This equation says that the derivative of $f(x)$ is equal to the derivative of $g_1$ with respect to $g_2$ with respect to $g_3$ multiplied by the derivative of $g_2$ with respect to $g_3$ multiplied by the derivative of $g_3$. In fact, it follows that a function with $k$ compositions has its derivative being equal to:

(10)