Derivatives of compositions of functions: f(g(x))


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 forget about memorizing the quotient rule 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, g(h(x)). For example, in the first, h(x) = x2 - 4 and the outer function is g(x) = sin(x): g(h(x)) = sin(x2 - 4).


Derivation of the chain rule


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) = cos(3t2), where y(x) = cos(x) and x(t) = 3t2. In terms of the changes in y and x, we have:

,

where the Δ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:

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.

The Chain Rule

If a function can be expressed as a composition of two functions, f(x) and g(x), such as f(g(x)), then its derivative is:


Learning the chain rule

It's best 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.

Example 1

Find the derivative of   f(x) = sin(x2)

The outer function is f(x) = sin(x) and the inner function is g(x) = x2. Let's let a = x2 and differentiate the outer function as f(a) = sin(a):

f'(a) = cos(a).

Then we differentiate the inner function, g'(x) = 2x, and multiply it by f(a)':

f' = 2x·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 x2 for a:

f'(x) = 2x·cos(x2).


Example 2

Find the derivative of   f(x) = (x2 - 5)3

The outer function is f(x) = x3 and the inner function is g(x) = x2- 5. Let's let a = x2 - 5 and differentiate the outer function as f(a) = a3:

f'(a) = 3a2.

Then we differentiate the inner function, g'(x) = x2- 5 with respect to x, and multiply it by f':

f' = 2x·3a2

The last step is to re-substitute (x2 - 5) for a:

f'(x) = 6x·(x2 - 5)2.


Example 3

Find the derivative of   f(x) = (x2 + x)1/2

Now we'll do without substitution of the placeholder variable and use the chain rule directly. The first step is to take the derivative of the whole outer function, treating the inner function (x2 + x) as a single unit.

½(x2 + x)-1/2       ← not finished, just pausing!

Then multiply by the derivative of the inner function, 2x + 1

f'(x) = (2x + 1)1/2(x2 + x)-1/2


Example 4

Find the derivative of   f(x) = (x2 - 4)-1


The outer function is x-1 and the inner is x2 - 4. The derivative is f'(x) = -1(x2 - 4)-2(2x), which can be simplified a bit, but I'll leave that to you.


Video examples

There are a bunch of video examples of chain rule derivatives here.


Practice problems

Find the derivatives of these compound functions. You can download solutions below (try not to peek until you've tried them).


Video examples


1. Simple chain rule examples

Here are a few examples of taking derivatives of simpler compound functions:

  • f(x) = cos(x3),
  • g(x) = tan(1/x), and
  • h(x) = e3x-1

Minutes of your life: 3:22


2. More difficult chain rule examples

These are just a little bit more difficult. Notice that it's called the chain rule because we can use it to find derivatives of a function of a function of a function of ..., like f(g(h(x))) = tan(ln(x2)), where f(x) = tan(x), g(x) = ln(x) and h(x) = x2.

Minutes of your life: 3:22



3. Challenging chain rule derivatives

If you can find derivatives of functions like these, you'll have mastered the chain rule.

Minutes of your life: 3:22



Creative Commons License   optimized for firefox
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.