If you’re asked to find a derivative of some function, sometimes it’s not a trivial thing to do. If you’re lucky and the function is among common functions, you can write down the required derivative right away using table of derivatives if necessary. But what if given expression is more complicated? That’s what this section is about. Let’s discuss chain rule for derivatives or so called outside-inside rule. This rule is needed when we want to find derivative of non-common function which is in fact composition of two or more common functions.

## Composition of functions

First of all, what is composition of functions? Actually it means function of another function. For example, consider the following function:

h(x)=g(f(x))

Composite function h(x) is a composition of functions f and g. To obtain value of function h at some point x we should first apply function f; then we apply g to the obtained result. In real analysis, it’s proved that if function f has derivative at the point x_0 and function g has derivative at the point f(x_0) then composite function h(x)=g(f(x)) also has a derivative at the point x_0.

Check video version of this tutorial:

## Chain Rule for two functions

Chain rule states that the derivative of composite function h(x) is found as follows:

(h(x))’=(g(f(x)))’=g’(f(x))\cdot f’(x)

Let’s find out what this rule implies. Here we have two functions g and f and function f, so to speak, is enclosed into function g. Therefore we’ll call function g an **outside function** and function f an **inside function**. Note that it’s not scientific terms but just informal way to call functions for better understanding. Thus, chain rule states that derivative of composite function equals derivative of outside function evaluated at the inside function multiplied by the derivative of inside function:

## Example: applying chain rule to find derivative

Consider the following example:

h(x)=\sin{(2x+3)}

We see that under sine there is not simply “x” but a polynomial 2x+3 so we can’t right away find derivative using table of derivatives for standard functions. Also we note that we can’t apply rules for product, quotient or sum/difference because we can’t “divide” sine into parts. What we mean is that the following is **wrong**:

\sin{(2x+3)}=\sin{(2x)}+\sin{(3)}

Thus, we can say for sure that the given function h(x)=\sin{(2x+3)} is composite. Moreover, here polynomial 2x+3 is an inside function and \sin{(2x+3)} is an outside function. The first thing you need to do when dealing with composite function is to find out which function is inside and which is outside. Do not mix this up, be attentive. But how to determine this? There’s simple idea, this you can do mentally or on draft. Imagine that you need to evaluate the given function \sin{(2x+3)} at some point x using calculator. Let’s pick x=1, for example. Particular value doesn’t matter here. So what do you do at first? Obviously, you’ll need to calculate 2\cdot 1+3=5 therefore polynomial 2x+3 is an inside function. Then you’ll calculate \sin{(5)} and therefore \sin{(2x+3)} is an outside function.

Ok, now we can perform derivation. To apply chain rule, at first we need to find derivative of the outside function g(f)=\sin{(f)}. Using standard table of derivatives we find out that (\sin {x})’=\cos{x}. In our case instead of x we should put 2x+3 (inside function is the argument for the outside function). Thus, we obtain:

g'(f(x))=\cos{(2x+3)}

Note that we place polynomial 2x+3 as an argument and it remains unchanged. Now we need to find derivative of the inside function:

f'(x)=(2x+3)’=2

Finally we substitute obtained derivatives into the formula for chain rule:

h'(x)=(g(f(x)))’=(\sin{(2x+3)})’=\cos{(2x+3)}\cdot 2=2\cos{(2x+3)}

## Chain rule in case of more than two functions

We’ve considered chain rule for the case when exactly one function is in and one is out. But how are we going to find derivative of something like this?

h(x)=e^{\cos{(\ln{x})}}

Let’s find out what function is inside here. As before, let’s pick arbitrary value of x, for example x=2. The first expression to calculate would be ln(x). So logarithm is inside. The next in line is cosine and the function outside is exponent.

Generally, chain rule for the case of more than two functions can be written in the following manner. Suppose we have composite function h(x):

h(x)=f_n (f_(n-1) (….(f_1 (x))))

Then, if derivatives of functions f_k, k=\bar{1,n} at corresponding points exist, the derivative of composite function h(x) is:

h'(x)=(f_n (f_{n-1}(…(f_1(x)))))’=f_n'(f_{n-1}(…(x)))\cdot f_{n-1}'(f_{n-2}(…(x)))\cdot … \cdot f_1′(x)

## Chain rule for three functions

In case of three functions the formula for derivative of composite function h(x)=y(g(f(x))) look like this:

h'(x)=(y(g(f(x))))’=y'(g(f(x)))\cdot g'(f(x)) \cdot f'(x)

Now let’s return to our example:

h(x)=e^{\cos{(\ln{x})}}

For this example in terms of formula mentioned above we have

y=e^g

g=\cos{f}

f=\ln{x}

As we’ve found out the outside function is exponent. Using table of derivatives for standard functions we get that (e^{x})’=e^x. So the derivative of the outside function is:

y'(g(f(x)))=e^{\cos{(\ln{x})}}

Remember that we evaluate derivative of the outside function using the whole expression under the outside function as an argument . In our example it’s \cos{(\ln{x})}. Now we can find the derivative of function g(f). As we know \cos{x}’=-\sin{x}. So we obtain:

g'(f(x))=-\sin{(\ln{x})}

Finally, we need to find derivative of the inside function f(x)=\ln{x}. It’s one of standard functions:

f'(x)=(\ln{x})’=\frac{1}{x}

Now we can apply chain rule:

h’=(e^{\cos{(\ln{x})}})’=e^{\cos{(\ln{x})}}\cdot (-\sin{(\ln{x})})\cdot \frac{1}{x}=-\frac{e^{\cos{(\ln{x})}} \sin{(\ln{x})}}{x}

and that’s our answer. As you can see, chain rule in case of three functions is hardly more complicated than for just two of them.

Summing up.

If you are asked to find derivative of composite function, apply the chain rule for derivatives. To do so, follow these steps:

1. Determine how many enclosed functions are there in your given expression and in which order them come: name inside and outside functions. Use “calculator approach” described above if needed.

2. Find derivative of the outside function due to table of derivatives using the whole enclosed expression as an argument (i.e. substitute it instead of “x” into the formula for derivative from the table).

3. Proceed if there’s more than one outside function.

4. Find derivative of the inside function. This time the argument is simply “x” (or some other symbol due to initial denotation).

5. Substitute all the derivatives into the formula for chain rule.

Still have questions on chain rule? Stuck with your calculus homework? Confused with other math stuff? Ask questions, we are ready to help.