# The Chain Rule

When dealing with a composition

*h*(*x*) = *f*(*g*(*x*)),

the function *f* is called the **outside function** and the function *g* is called the **inside function**. *f* is the outside function because it's written on the outside of the parentheses:

*f*(*g*(*x*))

*g* is the inside function because it's written on the inside of the parentheses:

*f*(*g*(*x*)).

Written like this, the idea of outside and inside functions makes a lot of sense, but somehow it always gets more complicated when we start looking at actual functions.

## "Outside" and "Inside" Functions

Another way to think of outside and inside functions in the case of the composition

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

is to think about what we need to do in order to evaluate *h* at a particular value of *x*. First we would need to find the output of *g* at that value of *x*. Then we would put that output into *f*. The inside function creates the input that we need for the outside function. Like the product and quotient rules, the outside function is the one we evaluate last.

### Sample Problem

Look at the function

*h*(*x*) = *e*^{sin x}.

This is a composition of the function *e*^{{(□)}} and sin *x*. In order to evaluate this function at , the first thing we do

is find the output of sin at this value of *x*:

The next thing we do is find *e* raised to that power:

For this composition, sin* x* is the inside function because sin* x* is the *input* to *e*^{{(□)}}. Therefore *e*^{{(□)}} must be the outside function. We're writing

*e*^{{(□)}}

instead of

*e ^{x}*

to emphasize that we'll be raising *e* to some other power besides *x*.

The *chain rule* states that

(*f*(*g*(*x*)))' = *f* ' (*g*(*x*)) · *g ' *(*x*).

If we state the chain rule with words instead of symbols, it says this: to find the derivative of the composition *f*(*g*(*x*)),

- identify the outside and inside functions

- find the derivative of the outside function and then use the original inside function as the input

- multiply by the derivative of the inside function.

Of course, we also want to simplify the answer into something reasonable.

Some people like thinking about the chain rule as

*f* '(*g*(*x*)) · *g ' *(*x*),

while some prefer

(derivative of outside function evaluated at inside function)(derivative of inside function).

Some prefer Leibniz notation. Use the way that works best.

**Be Careful:** When using the chain rule, use the original inside function as input to the derivative of the outside function. Then remember to multiply by the derivative of the inside function.

We can use the chain rule on functions that are nested 3 or more deep; we just need to write things down carefully.