### When do we use the chain rule?

Can any other rule be applied to the function? If not, then it is likely time to use the chain rule. If the function does not seem to be a product, quotient, or sum of simpler functions then the best bet is trying to decompose the function to see if the chain rule works.

To be more precise, if the function is the composition of two simpler functions then the chain rule is necessary. If you are pretty sure that nothing else can be done, then go ahead and try the chain rule. Every function can be written as a composition, but the chain rule only helps when the inside function is not simply $x$.

### How do we decompose a function?

The hard part is usually dealing with the composition of functions, but with enough experience it will become obvious how to decompose a function for the chain rule. I usually give students vague advice about knowing it when they see it and most humans are able to figure it out most of the time. But when programming I cannot tell the computer that it should pick the obvious inside function. So here is the basic idea of how I taught the computer to apply the chain rule. It really boils down to check a few straightforward cases that come up.

First, identify the outside function. This is easy because there are only a few options available for the outside function. Assuming you have already stripped away everything except the composition the outside function must be one of the four basic functions we discussed earlier. Look for a trigonometric, exponential, logarithmic, or power function. There might be something messy on the inside, but the outside will be the same every time.

Does the function look like $\sin(......)$ where the ...... can be any function of $x$? Does it look like another trigonometric or inverse trigonometric function on the outside--i.e. $\cos(......)$ or $\tan^{-1}(......)$ or the other 9 possible functions? If so, you have identified the outside function and whatever is on the inside is your inside function.

Does the function look like $\ln(......)$ or $\log_b(......)$ or $e^{(......)}$ or $b^{(......)}$? If so, use the same approach as with the trig function. Does the function look like $(......)^c$? Again the ...... will be the inside function and $x^c$ will be the outside function.

### How do we apply the chain rule?

Once you have identified the two functions then it is time to differentiate. Differentiate each function separately. Then be careful with the outside function and evaluate it at the inside function. This sounds harder than it is. Just plug in the inside function to the derivative of the outside function. Then multiply that derivative by the derivative of the inside function. See it in action with our calculator until you get the hang of it.### Why is the notation so confusing?

The chain rule is a little awkward because the independent variable $x$ can be reused in different functions. Or a different variable like $u$ can be used. Either way might seem weird to you, but since there are three different functions to deal with (the original, the outside, and the inside) there are multiple independent variables required.Ultimately $f(u)=u^2+1$ and $f(x)=x^2+1$ are the same thing because the variable is irrelevant. The independent variable of the outside function will be replaced by a function of $x$, and often letting $u$ represent this inside function is the easiest thing to do because $f'(u)$ is more intuitive than $f'(\sin(x))$ or whatever may be inside.