The chain rule is one of the most useful tools in differential calculus. Equipped with your knowledge of specific derivatives, and the power, product and quotient rules, the chain rule will allow you to find the derivative of any function.
The chain rule is a bit tricky to learn at first, but once you get the hang of it, it's really easy to apply, even to the most stubborn of functions. Knowing it will also allow you to forego the more cumbersome quotient rule in many cases, because any denominator $h(x)$ can be expressed as a multiple,$[h(x)]^{-1}$.
Each of the functions in the box on the right is a composition of functions, $f(x) = g(h(x))$. For example, in the first, $h(x) = x^2 - 4$ and the outer function is $g(x) = \text{sin}(x)$: $g(h(x)) = \text{sin}(x^2 - 4)$.
$$ \begin{align} f(x) &= \text{sin}(x^2 - 4) \\[5pt] f(x) &= \sqrt{2x^3 - x + 3} \\[5pt] f(x) &= (\text{cos}^2(x) - 3x)^2 \\[5pt] f(x) &= \text{log}(6x^2 - x + 2) \end{align}$$
To derive the chain rule, consider a function $y(t)$ that is actually a composition of functions, $y(x)$ and $x(t)$. It might be something like $y(t) = \text{cos}(3t^2)$, where $y(x) = \text{cos}(x)$ and $x(t) = 3t^2$. In terms of the changes in $y$ and $x$, we have:
$$ \require{cancel} \frac{\Delta y}{\cancel{\Delta x}} \frac{\cancel{\Delta x}}{\Delta t} = \frac{\Delta y}{\Delta x}$$
where the $\Delta x$ terms cancel to give the overall change in $y$ with respect to $t$. We can use the same cancellation in terms of differentials, but a word about that is in order:
While Leibniz, who invented the $df/dx$ notation, never intended it to be used as such, we can safely consider $df/dx$ to be simply a ratio of differentials, making the analogous cancellation possible:
$$\frac{d y}{\cancel{d x}} \frac{\cancel{d x}}{d t} = \frac{d y}{d x}$$
Thus the derivative of a composition of functions can be expanded as a product of derivatives, the first the derivative of the outer function with respect to the full inner function (e.g. by treating it like a single "placeholder" variable), the second just the derivative of the inner function with respect to its independent variable.
It's easiest to learn the chain rule by working through examples. In the first two examples below, we'll substitute a "dummy variable" for the inner function, but you'll find that in no time you wont need to do that any more.
Find the derivative of $f(x) = \text{sin}(x^2)$
$$f'(a) = cos(a)$$
Then we differentiate the inner function, $g'(x) = 2x$, and multiply it by $f'(a)$:
$$f' = 2x\cdot \text{cos}(a)$$
I didn't write a variable behind $f'$ above because at the moment I've got a weird hybrid function of $x$ and $a$. The last step is to re-substitute $x^2$ for $a$:
$$f'(x) = 2x\cdot cos(x^2)$$
This method of making a substitution for the inner function is a good way to learn the chain rule, but eventually, you'll want to do it without substitution. Learn to ignore the inner function(s), leaving them intact while you write down the derivative of the outer function.
Find the derivative of $f(x) = (x^2 - 5)^3$
$$f'(a) = 3 a^2$$
Then we differentiate the inner function, $g'(x) = x^2 - 5$ with respect to $x$, and multiply it by $f'$:
$$f' = 2x\cdot 3a^2 = 6x\cdot a^2$$
The last step is to re-substitute $(x^2 - 5)$ for $a$:
$$f'(x) = 6x\cdot (x^2 - 5)^2$$
Find the derivative of $f(x) = (x^2 + x)^{1/2}$
$$\frac{1}{2} (x^2 + x)^{\frac{1}{2}}$$
Then multiply by the derivative of the inner function, $x^2 + x$
$$f'(x) = \frac{1}{2}(x^2 + x)^{\frac{1}{2}}(2x + 1)$$
Find the derivative of $f(x) = (x^2 - 4)^{-1}$
Find the derivatives of these compound functions using the chain rule. You may have to also use the product or quotient rules.
$$f(x) = (x^3 + x^2 - x + 1)^3$$
$$\begin{align} f'(x) &= \frac{1}{2} (1 - 3x)^{-\frac{1}{2}}(-3) \\[5pt] &= \frac{-3}{2 \sqrt{1 - 3x}} \end{align}$$
Note: in calculus, it's almost always best to replace radicals with rational exponents.
$$f(x) = \frac{1}{x^2 - 1}$$
$$\begin{align} f'(x) &= -(x^2 - 1)^{-2} \cdot 2x \\[5pt] &= \frac{-2x}{(x^2 - 1)^2} \end{align}$$
Note that this derivative could also be done by using the quotient rule directly. Try that and make sure you get the same derivative
$$f(x) = \frac{1}{1 + \text{cos}(x)}$$
$$\begin{align} f'(x) &= -(1 + \text{cos}(x))^{-2} \cdot -\text{sin}(x) \\[5pt] &= \frac{\text{sin}(x)}{[1 + \text{cos}(x)]^2} \end{align}$$
Note that this derivative could also be done by using the quotient rule directly. Try that and make sure you get the same derivative
$$f(x) = \frac{1}{\text{cos}^2(x)}$$
If we rewrite f(x) as $f(x) = (\text{cos}^2(x))^{-1}$, and realize that the funky shorthand we use for raising trig functions to powers actually means
$$f(x) = [(\text{cos}(x))^2]^{-1},$$
Then our function, written in the best shape to use the chain rule, is $f(x) = [\text{cos}(x)]^{-2}$
$$\begin{align} f'(x) &= -2 [\text{cos}(x)]^{-3} \cdot -\text{sin}(x) \\[5pt] &= \frac{2 \text{sin}(x)}{\text{cos}^3(x)} \end{align}$$
This derivative could also be done by using the quotient rule directly. Try that and make sure you get the same result.
$$f(x) = x^2 + \text{cos}^2(x)$$
This is the sum of two functions; recall that the derivative of a sum is the sum of derivatives, so the derivative of the first term is just $2x$. The second function is a composite function:
$$\begin{align} f'(x) &= 2x + 2\text{cos}(x)\cdot (-\text{sin}(x)) \\[5pt] &= 2[x - \text{sin}(x) \text{cos}(x)] \end{align}$$
$$f(\theta) = 3 \text{cot} (n\theta)$$
The inner function is very simple for this composite function $(3\theta)$, but it is there, so the chain rule is necessary.
$$f'(\theta) = 3 n\cdot \text{csc}^2(n\theta)$$
If you forgot the derivative of $f(x) = \text{cot}(x)$, it's easy to figure out just by rewriting it as $\frac{\text{cos}(x)}{\text{sin}(x)}$ and using the quotient rule.
$$f(x) = (2x - 3)^4(x^2 + x + 1)^4$$
This is a product of composite functions: $f(g(x)) \cdot f(h(x))$, where $f(x) = x^4, \; g(x) = 2x - 2 \; \text{and} \; h(x) = x^2 + x + 1$
$$\begin{align} f'(x) &= 4(2x - 3)^3 \cdot 2 \cdot (x^2 + x + 1)^4 \\[5pt] &+ (2x - 3)^4 \cdot 4 \cdot (x^2 + x + 1)^3 (2x + 1) \\[5pt] &= 4(x^2 + x + 1)^3\cdot(2x - 3)^3 \cdot \\[5pt] &[2(x^2 + x + 1) + (2x + 1)(2x - 3)] \end{align}$$
$$f(x) = \left(\frac{x^2 + 1}{x^2 - 1}\right)^3$$
After taking the simple derivative of the outer function, we'll have to multiply it by the quotient-rule derivative of the inner function.
$$\begin{align} f'(x) &= 3 \left(\frac{x^2 + 1}{x^2 - 1}\right)^2 \left(\frac{x^2 - 1)\cdot 2x - (x^2 + 1)(2x)}{(x^2 - 1)^2}\right) \\[5pt] &= 3 \left(\frac{x^2 + 1}{x^2 - 1}\right)^2 \left( \frac{2x(x^2 - 1 - x^2 - 1)}{(x^2 - 1)^2}\right) \\[5pt] &= 3 \left(\frac{x^2 + 1}{x^2 - 1}\right)^2 \left( \frac{-2x}{(x^2 - 1)^2} \right) \end{align}$$
$$f(x) = \sqrt{\frac{x^2 + 1}{x^2 + 4}}$$
Rewrite the radical as a rational exponent:
$$f(x) = \sqrt{\frac{x^2 + 1}{x^2 + 4}} = \left( \frac{x^2 + 1}{x^2 + 4}\right)^{\frac{1}{2}}$$
After taking the simple derivative of the outer function, we'll have to multiply it by the quotient-rule derivative of the inner function.
$$\begin{align} f'(x) &= 3 \left(\frac{x^2 + 1}{x^2 + 4}\right)^{-\frac{1}{2}} \left(\frac{x^2 + 4)\cdot 2x - (x^2 + 1)(2x)}{(x^2 + 4)^2}\right) \\[5pt] &= \frac{1}{2} \left(\frac{x^2 + 1}{x^2 + 4}\right)^{-\frac{1}{2}} \left( \frac{2x(x^2 + 4 - x^2 - 1)}{(x^2 + 4)^2}\right) \\[5pt] &= \frac{1}{2} \left(\frac{x^2 + 1}{x^2 + 4}\right)^{-\frac{1}{2}} \left( \frac{6x}{(x^2 + 4)^2} \right) \end{align}$$
This could be simplified more, of course ...
$$f(x) = \frac{x}{\sqrt{7 - 3x}}$$
It can help to rewrite this function as a product, and also use a rational exponent instead of the radical sign:
$$f(x) = \frac{x}{\sqrt{7 - 3x}} = x (7 - 3x)^{-\frac{1}{2}}$$
Now use the product rule and the chain rule:
$$\begin{align} f'(x) &= (1)(7 - 3x)^{-\frac{1}{2}} - x \left(\frac{1}{2}\right)(7 - 3x)^{-\frac{3}{2}}(3) \\[5pt] &= \frac{1}{\sqrt{7 - 3x}} - \frac{3x}{2(7 - 3x)^{\frac{3}{2}}} \end{align}$$
$$f(x) = \frac{(x - 1)^4}{(x^2 + 2x)^5}$$
Let's do this one using the quotient rule, but we'll need the chain rule to do the inner derivatives:
$$\begin{align} f'(x) &= \frac{(x^2 + 2x)^5 \cdot 4(x - 1)^3 - (x - 1)^4 (5) (x^2 + 2x)^4(2x + 2)}{(x^2 + 2x)^{10}} \\[5pt] &= \frac{(x^2 + 2x)^4 \cdot (x - 1)^3 [4(x^2 + 2x) - 5(x - 1)(2x + 2)]}{(x^2 + 2x)^{10}} \\[5pt] &= \frac{(x - 1)^3[4x^2 + 8x - 10x^2 + 10]}{(x^2 + 2x)^{6}} \\[5pt] &= \frac{(x - 1)^3[-6x^2 + 8x + 10]}{(x^2 + 2x)^{6}} \end{align}$$
Of course, this could also be done by experssing the quotient as a product and using the product and chain rules.
$$f(x) = \text{sin}(\text{cos}(2x))$$
$$f(x) = \text{sin}(\text{cos}(2x))$$
This function is a composite of three functions $f(g(h(x)))$, where $h(x) = 2x$, $g(x) = \text{cos}(x)$ and $f(x) = \text{sin}(x)$. This is a good example of why we call this the chain rule: We take the derivative of the outermost function, leaving everything else as is, multiply (or "chain") the derivatie of the next inner function, leaving the innermost intact, and finally, multiply on to the growing chain the derivative of the innermost functions.
$$f'(x) = \text{cos}(\text{cos}(2x)) \cdot -\text{sin}(2x) (2)$$
$$f'(x) = -2 \text{sin} (2x) \cdot \text{cos}(\text{cos}(2x))$$
$$f(x) = \left(\frac{1 - \text{cos}(2x)}{1 + \text{cos}(2x)}\right)^4$$
The derivative of the inner function will have to be found using the quotient rule.
$$ \begin{align} f'(x) &= 4 \left( \frac{1 - \text{cos}(2x)}{1 + \text{cos}(2x)} \right)^3 \cdot \\[5pt] &\frac{(1 + \text{cos}(2x))\cdot 2 \text{sin}(2x) - (1 - \text{cos}(2x))(-2 \text{sin}(2x))}{(1 + \text{cos}(2x))^2} \\[5pt] &= 4 \left( \frac{1 - \text{cos}(2x)}{1 + \text{cos}(2x)} \right)^3 \cdot \\[5pt] &\frac{2\cdot \text{sin}(2x)[(1 + \text{cos} (2x)) + (1 - \text{cos}(2x))]}{(1 + \text{cos}(2x))^2} \end{align}$$
Quotient-rule derivatives are often difficult to simplify, with plenty of opportunity to make small errors. Don't let that take up too much of your time. Take care of the obvious simplifications and let it go.
$$f(x) = [x^2 + (1 - 3x)^5]^3$$
$$ \begin{align} f'(x) &= 3 [x^2 + (1 - 3x)^5]^2 \cdot \\[5pt] &[2x + 5(1 - 3x)^4 (-3)] \end{align}$$
Notice that the last inner derivative (-3) applies only to the $(1 - 3x)^5$ term.
There's not much point in simplifying here. You might not really gain that much. That's the way it goes, sometimes.
$$f(x) = \frac{\text{cos}(x)}{\text{sin}(x) + \text{cos}(x)}$$
Let's rewrite this function as a product using a -1 exponent on the denominator. Then we can use the product rule and chain rule.
$$ \begin{align} f'(x) &= -\text{sin}(x) (\text{sin}(x) + \text{cos}(x))^{-1} \\[5pt] &+ \text{cos}(x)[-\text{sin}(x) + \text{cos}(x))^{-2}][\text{cos}(x) \\[5pt] &- \text{sin}(x)] \\[5pt] &= \frac{-\text{sin}(x)}{\text{sin}(x) + \text{cos}(x)} \\[5pt] &= \frac{\text{cos}(x) \text{sin}(x) -\text{cos}^2(x)}{[\text{sin}(x) + \text{cos}(x)]^2} \\[5pt] &= \frac{-1 - 2 \, \text{cos}(x) \text{sin}(x)}{[\text{sin}(x) + \text{cos}(x)]^2} \end{align}$$
$$f(x) = x \cdot \text{sin} \left( \frac{1}{x}\right)$$
$$f(x) = x \cdot \text{sin} \left( \frac{1}{x}\right) = x \cdot \text{sin}(x^{-1})$$
$$f'(x) = (1)\cdot \text{sin}(x^{-1}) + x\cdot \text{cos} (x^{-1})(-x^{-2})$$
$$= \text{sin} \left( \frac{1}{x} \right) - \frac{1}{x^2} \cdot \text{cos} \left( \frac{1}{x} \right)$$
$$f(x) = \text{sin}(\text{sin}(\text{sin}(x)))$$
$$f(x) = \text{sin}(\text{sin}(\text{sin}(x)))$$
$$f'(x) = \text{cos}(\text{sin}(\text{sin}(x))) \cdot \text{cos}(\text{sin}(x)) \cdot \text{cos}(x)$$
$$f(\theta) = 2 \text{cot}(n\theta)$$
$$f(\theta) = 2 \text{cot}(n\theta)$$
$$f'(x) = 2 n\, \text{csc}^2 (n \theta)$$
$$f(x) = \sqrt{\frac{x}{x^2 + 4}}$$
Here again, expressing the radical using a rational exponent makes this one easier:
$$f(x) = \sqrt{\frac{x}{x^2 + 4}} = \left( \frac{x}{x^2 + 4} \right)^{\frac{1}{2}}$$
$$\begin{align} f'(x) &= \frac{1}{2} \left( \frac{x}{x^2 + 4} \right)^{-\frac{1}{2}} \left( \frac{(x^2 + 4)(1) - x(2x)}{(x^2 + 4)^2} \right) \\[5pt] &= \frac{1}{2} \left( \frac{x^2 + 4}{x}) \right)^{\frac{1}{2}}\left( \frac{4 - x^2}{(x^2 + 4)^2} \right) \\[5pt] \end{align}$$
Here are eight examples (four videos) of chain rule derivatives. Enjoy! (OK, maybe that's overdoing it. I do hope they're helpful, though).
Here are two examples of using the chain rule where the inner function [ $g(x)$ in $f(g(x))$ ] is a polynomial, and $f(x)$ is a simple power function like $f(x) = x^2$.
Minutes of your life: 0:00
In the second of these two examples, the outer function, $f(x)$, is a squared trig. function, $\text{sin}^2(x)$.
Minutes of your life: 0:00
The first of these two examples involves a polynomial function that is the exponent of an exponential function, the second a polynomial inside a sine function.
Minutes of your life: 0:00
Here are two trickier chain rule problems, three nested functions like $f(g(h(x)))$.
Minutes of your life: 0:00
xaktly.com by Dr. Jeff Cruzan is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. © 2012, Jeff Cruzan. All text and images on this website not specifically attributed to another source were created by me and I reserve all rights as to their use. Any opinions expressed on this website are entirely mine, and do not necessarily reflect the views of any of my employers. Please feel free to send any questions or comments to jeff.cruzan@verizon.net.