# The Chain Rule

#### Step-by-step differentiation...

The chain rule allows us to differentiate a function that contains another function. What does that mean? Let's start with an example:

$$f(x) = 4x^2+7x-9$$ $$f'(x) = 8x+7$$

We just took the derivative with respect to x by following the most basic differentiation rules. The function $$f(x)$$ is simple to differentiate because it is a simple polynomial. But, what if we have something more complicated?

$$f(x)=(4x+4)^3$$

This is where we use the chain rule, which is defined below:

$$F(x) = f(g(x))$$ $$F'(x) = f'(g(x))*g'(x)$$

### But what does that really mean???

The chain rule says that if one function depends on another, and can be written as a "function of a function", then the derivative takes the form of the derivative of the whole function times the derivative of the inner function. That probably just sounded more complicated than the formula!

Let's see how that applies to the example I gave above.

$$F(x) = (4x+4)^3$$ $$F(x) = (g(x))^3$$ $$g(x) = 4x+4$$

I took the inner contents of the function and redefined that as $$g(x)$$. Now the original function, $$F(x)$$, is a function of a function! See how it works? Now when we differentiate each part, we can find the derivative of $$F(x)$$:

$$g(x)=4x+4$$ $$g'(x)=4$$ $$f(x)=x^3$$ $$f'(x)=3x^2$$ $$f'(g(x))=3(g(x))^2$$

Finding $$g(x)$$ was pretty straightforward since we can easily see from the last equations that it equals $$4x+4$$. But how did we find $$f'(x)$$? Well, we found out that $$f(x)$$ is $$x^3$$. The derivative, $$f'(x)$$, is simply $$3x^2$$, then. Since, in this case, we're interested in $$f(g(x))$$, we just plug in $$(4x+4)$$ to find that $$f'(g(x))$$ equals $$3(g(x))^2$$.

So what's the final answer? Remember what the chain rule says:

$$F(x) = f(g(x))$$ $$F'(x) = f'(g(x))*g'(x)$$

We already found $$f'(g(x))$$ and $$g'(x)$$ above. Multiply them together:

$$f'(g(x))=3(g(x))^2$$ $$g'(x)=4$$ $$F'(x)=f'(g(x))g'(x)$$ $$F'(x)=3(4x+4)^2*4=12(4x+4)^2$$

That was REALLY COMPLICATED!! Well, not really. Here's the "short answer" for what I just did. I pretended like the part inside the parentheses was just an unknown chunk. Then I differentiated like normal and multiplied the result by the derivative of that chunk!

This lesson is still in progress... check back soon!