The Chain Rule

Trigonometry

Trigonometry Logo

The Chain Rule

This is the most important rule that allows to compute the derivative of the composition of two or more functions.

Consider first the notion of a composite function. Let the function \(g\) be defined on the set \(X\) and can take values in the set \(U\). In this case we say that the function \(g\) maps the set \(X\) to \(U\) and the function is written as

\[u = g\left( x \right),\;\;\text{where}\;\;\;x \in X,u \in U.\]

Now imagine that another function \(f\) is defined on the set \(U\). This function maps the set \(U\) to \(Y:\)

\[y = f\left( u \right),\;\;\text{where}\;\;\;u \in U,y \in Y.\]

This double mapping, in which the range of the first map is a subset of the domain of the second map is called the composition of maps, and the corresponding functions form a composition of functions.

If \(g:X \to U\) and \(f:U \to Y\), then the composition of functions \(g\) and \(f\) is denoted as

\[y = \left( {f \circ g} \right)\left( x \right) = f\left( {g\left( x \right)} \right) = f\left( u \right)\]

and represents a "two-layer" composite function or a function of a function.

If \(f\) and \(g\) are differentiable functions, then the composite function \(y = f\left( {g\left( x \right)} \right)\) is also differentiable in \(x\) and its derivative is given by

\[\frac{{dy}}{{dx}} = \frac{d}{{dx}}\left( {f \circ g} \right)\left( x \right) = \frac{d}{{dx}}f\left( {g\left( x \right)} \right)g'\left( x \right) = \frac{{df}}{{du}}\frac{{du}}{{dx}}.\]

Looking more closely at the formula, we notice that it involves multiplication of a derivative value for the outer function times a derivative value for the inner function. However, when we differentiate the composite function \(y = f\left( {g\left( x \right)} \right)\) at the point \(x\), we multiply the derivative value of the inner function at \(x\) times the derivative value of the outer function at \(u = g\left( x \right)\) ... not at \(x!\)

Let us prove the above formula.

Take an arbitrary point \({x_0}\). We assume that the function \(u = g\left( x \right)\) is differentiable at \({x_0}\) and the function \(y = f\left( u \right)\), respectively, is differentiable at \({u_0} = g\left( {{x_0}} \right)\). This means that the derivatives \(g'\left( x \right)\) and \(f'\left( u \right)\) exist at the indicated points, and the functions \(g\left( x \right)\) and \(f\left( u \right)\) are continuous in a neighborhood of these points.

The derivative of the outer function \(y = f\left( u \right)\) at the point \({u_0}\) is written using the limit definition as

\[f'\left( {{u_0}} \right) = \lim\limits_{\Delta u \to 0} \frac{{\Delta y}}{{\Delta u}}.\]

This expression can be rewritten in the form:

\[\Delta y = f'\left( {{u_0}} \right)\Delta u + \varepsilon \left( {\Delta u} \right)\Delta u,\]

where the error \(\varepsilon \left( {\Delta u} \right)\)) depends on the increment \(\Delta u\) and the following condition is met:

\[\lim\limits_{\Delta u \to 0} \varepsilon \left( {\Delta u} \right) = \varepsilon \left( 0 \right) = 0.\]

Divide the expression for \(\Delta y\) by the increment of the internal variable \(\Delta x \ne 0:\)

\[\frac{{\Delta y}}{{\Delta x}} = f'\left( {{u_0}} \right)\frac{{\Delta u}}{{\Delta x}} + \varepsilon \left( {\Delta u} \right)\frac{{\Delta u}}{{\Delta x}}.\]

Because the inner function \(u = g\left( x \right)\) is differentiable at \({x_0},\) then

\[\lim\limits_{\Delta x \to 0} \frac{{\Delta u}}{{\Delta x}} = g'\left( {{x_0}} \right).\]

We also note that \(\lim\limits_{\Delta x \to 0} \Delta u = 0\) by the continuity of the function \(u\left( x \right)\) and hence

\[\lim\limits_{\Delta x \to 0} \varepsilon \left( {\Delta u} \right) = \varepsilon \left( {\lim\limits_{\Delta x \to 0} \Delta u} \right) = \varepsilon \left( 0 \right) = 0.\]

As a result, the derivative of the composite function at \({x_0}\) is expressed by the following formula:

\[y'\left( {{x_0}} \right) = \lim\limits_{\Delta x \to 0} \frac{{\Delta y}}{{\Delta x}} = \lim\limits_{\Delta x \to 0} \left[ {f'\left( {{u_0}} \right)\frac{{\Delta u}}{{\Delta x}} + \varepsilon \left( {\Delta u} \right)\frac{{\Delta u}}{{\Delta x}}} \right] = f'\left( {{u_0}} \right)\lim\limits_{\Delta x \to 0} \frac{{\Delta u}}{{\Delta x}} + \lim\limits_{\Delta x \to 0} \varepsilon \left( {\Delta u} \right) \cdot \lim\limits_{\Delta x \to 0} \frac{{\Delta u}}{{\Delta x}} = f'\left( {{u_0}} \right)g'\left( {{x_0}} \right) + 0 \cdot g'\left( {{x_0}} \right) = f'\left( {{u_0}} \right)g'\left( {{x_0}} \right) = f'\left( {g\left( {{x_0}} \right)} \right)g'\left( {{x_0}} \right).\]

This rule is easily generalized for composite functions consisting of three and more "layers". For example, the derivative of a "three-layer" composite function \(y = f\left( {g\left( {h\left( x \right)} \right)} \right)\) is given by the formula

\[y' = {\left( {f \circ g \circ h} \right)^\prime }\left( x \right) = \left[ {f\left( {g\left( {h\left( x \right)} \right)} \right)} \right]^\prime = f'\left( {g\left( {h\left( x \right)} \right)} \right) \cdot g'\left( {h\left( x \right)} \right) \cdot h'\left( x \right).\]

You may notice that the derivative of a composite function is represented as a serial product of the derivatives of the constituent functions. The arguments of the functions are linked (chained) so that the value of an internal function is the argument for the following external function. Therefore, the rule for differentiating a composite function is often called the chain rule.

In Examples \(1-55,\) find the derivatives of the given functions.

Solved Problems

Click or tap a problem to see the solution.

Example 1

\[y = \ln {x^2}\]

Example 2

\[y = {\ln ^2}x\]

Example 3

\[y = \sqrt {\ln x}\]

Example 4

\[y = \cos {x^3}\]

Example 5

\[y = \cos \left( {3x + 2} \right)\]

Example 6

\[y = \tan 2x\]

Example 7

\[y = {\sin ^3}x\]

Example 8

\[y = {\cos ^4}x\]

Example 9

\[y = {3^{\cos x}}\]

Example 10

\[y = \ln \sin x\]

Example 1.

\[y = \ln {x^2}\]

Solution.

\[y'\left( x \right) = \left( {\ln {x^2}} \right)^\prime = \frac{1}{{{x^2}}} \cdot {\left( {{x^2}} \right)^\prime } = \frac{1}{{{x^2}}} \cdot 2x = \frac{{2x}}{{{x^2}}} = \frac{2}{x}\;\;\left( {x \ne 0} \right).\]

Example 2.

\[y = {\ln ^2}x\]

Solution.

\[y'\left( x \right) = \left( {{{\ln }^2}x} \right)^\prime = 2\ln x \cdot {\left( {\ln x} \right)^\prime } = 2\ln x \cdot \frac{1}{x} = \frac{{2\ln x}}{x}\;\;\;\left( {x \gt 0} \right).\]

Example 3.

\[y = \sqrt {\ln x}\]

Solution.

The outer function is the square root \(y = \sqrt u ,\) the inner function is the natural logarithm \(u = \ln x.\) Hence, by the chain rule,

\[y^\prime = \left( {\sqrt {\ln x} } \right)^\prime = \frac{1}{{2\sqrt {\ln x} }} \cdot \left( {\ln x} \right)^\prime = \frac{1}{{2\sqrt {\ln x} }} \cdot \frac{1}{x} = \frac{1}{{2x\sqrt {\ln x} }}.\]

Example 4.

\[y = \cos {x^3}\]

Solution.

\[y'\left( x \right) = \left( {\cos {x^3}} \right)^\prime = \sin {x^3} \cdot {\left( {{x^3}} \right)^\prime } = \sin {x^3} \cdot 3{x^2} = 3{x^2}\sin {x^3}.\]

Example 5.

\[y = \cos \left( {3x + 2} \right)\]

Solution.

\[y'\left( x \right) = \left[ {\cos \left( {3x + 2} \right)} \right]^\prime = - \sin \left( {3x + 2} \right) \cdot {\left( {3x + 2} \right)^\prime } = - 3\sin \left( {3x + 2} \right).\]

Example 6.

\[y = \tan 2x\]

Solution.

\[y'\left( x \right) = {\left( {\tan 2x} \right)^\prime } = \frac{1}{{{{\cos }^2}2x}} \cdot {\left( {2x} \right)^\prime } = \frac{2}{{{{\cos }^2}2x}}.\]

The domain of the function and the derivative are given by

\[2x \ne \frac{\pi }{2} + \pi n,\;\;\Rightarrow x \ne \frac{\pi }{4} + \frac{{\pi n}}{2},\;\;n \in \mathbb{Z}.\]

Example 7.

\[y = {\sin ^3}x\]

Solution.

\[y'\left( x \right) = \left( {{{\sin }^3}x} \right)^\prime = 3\,{\sin ^2}x \cdot {\left( {\sin x} \right)^\prime } = 3\,{\sin ^2}x\cos x.\]

Example 8.

\[y = {\cos ^4}x\]

Solution.

\[y'\left( x \right) = \left( {{{\cos }^4}x} \right)^\prime = 4\,{\cos ^3}x \cdot {\left( {\cos x} \right)^\prime } = 4\,{\cos ^3}x \cdot \left( { - \sin x} \right) = - 4\,{\cos ^3}x\sin x.\]

Example 9.

\[y = {3^{\cos x}}\]

Solution.

Since \({\left( {{a^x}} \right)^\prime } = {a^x}\ln a\), then by the chain rule we have

\[y'\left( x \right) = \left( {{3^{\cos x}}} \right)^\prime = {3^{\cos x}} \cdot \ln 3 \cdot {\left( {\cos x} \right)^\prime } = - {3^{\cos x}}\ln 3\sin x.\]

Example 10.

\[y = \ln \sin x\]

Solution.

\[y'\left( x \right) = \left( {\ln \sin x} \right)^\prime = \frac{1}{{\sin x}} \cdot {\left( {\sin x} \right)^\prime } = \frac{1}{{\sin x}} \cdot \cos x = \frac{{\cos x}}{{\sin x}} = \cot x.\]

Note that this function is defined for \(2\pi n \lt x \lt \pi + 2\pi n\), \(n \in \mathbb{Z}\).