# When do we use the Chain Rule?

## The Formula

If s(x)=f(g(x)), and if g is differentiable at x and f is differentiable at g(x) then $$s'(x)=f'(g(x))g'(x)$$
At this point we have only found the derivative of functions built with arithmetic operations (addition, subtraction, multiplication, division). If two simpler functions were combined using multiplication we used the product rule to find the derivative, if they were combined using division we used the quotient rule, and if addition or subtraction was used the addition/subtraction rule implemented.

# What is composition?

Answer: We will now look at another operation, composition , which is when one function is embedded in another (f(g(x))). In the imagine below g associates g(x) with x and the function f associates f(g(x)) with g(x). Therefore, the composition of f with g associates f(g(x)) with each element x in the domain of g for which g(x) is in the domain of f.

This figure shows g(x) evalualted in f(x) .
Example of Compositon
Suppose $f(x)=\sqrt{x}$ and $g(x)=2x-3$. Then: $$f(g(x))=\sqrt{2x-3}$$ Similarly, $$g(f(x))=2\sqrt{x-3}$$
Now the question is can we find the derivative of $s(x)$ given $s(x)=f(g(x))$? More specifically can we express the first derivative of s in terms of the first derivatives of f and g? The answer is yes, and the \textit{chain rule} help us accomplish this. In fact, the chain rule will make the differentiation of many functions a lot easier.

# Identifying the composition of two functions

However, before we begin taking the derivative of functions using the chain rule, if is helpful for us to practice identifying the composition of functions. We will start off with one function inside another (f(gx)) and then progress into the composition of three functions h(f(g(x))). Once we become comfortable recognizing the order of the composition (inner most, next inner most, $\cdots$, outer most), taking the derivative with the chain rule becomes rather straight forward.

## Practice Identifying Composition of functions

 Function Inside Outisde Composition $sin(2x)$ $2x$ $sin(x)$ $f(g(x))$ $e^{5x+1}$ $(5x+1)$ $e^x$ $f(g(x))$ $\sqrt{3x^5}$ $3x^5$ $\sqrt{x}$ $f(g(x))$ $(5x^2+ln(x))^{10}$ $5x^2+ln(x)$ $x^{10}$ $f(g(x))$ $ln\big(\frac{x}{sin(x)}\big)$ $\frac{x}{sin(x)}$ $ln(x)$ $f(g(x))$ $\big(\frac{2x-5}{1-x^2}\big)^-5$ $\frac{2x-5}{1-x^2}$ $x^-5$ $f(g(x))$ $tan^2(x)$ $tan(x)$ $x^2$ $f(g(x))$

## Identifying the composition of three functions

 h(f(g(x))) g(x) f(x) h(x) Composition $ln(\sqrt{4x})$ $4x$ $\sqrt{x}$ $ln(x)$ $h(f(g(x))$ $cos^4(3x+2)$ $(3x+2)$ $cos(x)$ $x^4$ $h(f(g(x))$ $tan\big((6x)^{10}\big)$ $6x$ $x^{10}$ $tan(x)$ $h(f(g(x))$ $e^{e^{\pi x}}$ $\pi x$ $e^x$ $e^x$ $h(f(g(x))$ $csc(\sqrt[3]{1-sin(x)})$ $sin(x)$ $\sqrt[3]{x}$ $csc(x)$ $h(f(g(x)))$

# What is the chain rule?

If s(x)=f(g(x)), and if g is differentiable at x and f is differentiable at g(x) then $$s'(x)=f'(g(x))g'(x)$$

## The Chain Rule in Words

To find the derivative of s(x), find the derivative of the outside function $(f')$ evaluated at the inside function left alone $f'(g(x))$ times the derivative of the inside function $f'(g(x))g'(x)$. $$\frac{d}{dx}[f(g(x))]=f'(g(x))$$ Basically, we start with the outer most function take it derivative, leave everything else the same, multiplied by the derivative of the next outer most function. If there are multipliable functions, we keep work from outside to inside using the same technique .

## Examples of the Chain Rule

Example 1
$$s(x)=(3x^2+1)^5$$

Example 2
$$s(x)=sin^3(x)$$

Example 3
$$s(x)=\sqrt{ln(x)}$$

$$s(x)=e^{x^2}$$
$$s(x)=\big(\frac{3x+4}{6x-1}\big)^3$$