### What is the chain rule and how does it work?

The chain rule is used when you're trying to differentiate a complicated function, and it allows you to split up the function into easier ones. The trick is spotting where to split the function, and what part you should substitute.
Say, for example, you're trying to find the derivative of: y=(1+x)^2 . If you can replace a suitable function of x with a function of u, you would be left with y=f(u) and u=g(x), y and u being functions of u and x respectively.
Now, if you differentiate y with respect to u, and u with repsect to x, you're left with the equation: dy/dx = dy/du * du/dx . On the RHS, you're left with dy/dx, as the du's cancel out, which is what you were after at the beginning. All that you would have to do is replace any remaining u with your function of x to find your desired derivative.
It's better understood through an example. Let's have a look at the example above, y=(1+x)^2. Take u=1+x, and youre left with y=u^2. Now, differentiate both fuctions, y=f(u) and u=g(x), and you're left with: dy/du=2u and du/dx=1.
Now, from the formula above, we know that dy/dx=dy/du * du/dx. Therefore: dy/dx = 2u * 1 = 2u. Now all that's left to do is replace u with the function of x you originally took out. In this case, u=1+x, so: dy/dx = 2(1+x) .
For a slightly harder example, try: y=1/(x^2+4x)^1/2 . Rearrange this to have y in terms of powers, similar to the first example: y=(x^2+4x)^-1/2 .
Now, take an appropriate function of x to equal u. In this example, it would be a good choice to take u=x^2+4x , leaving y=u^-1/2. Differentiating both of these functions gives: dy/du=-1/2(u)^-3/2 and du/dx=2x+4.
We know that dy/dx=dy/du * du/dx, therefore: dy/dx = -1/2(u)^-3/2 * (2x+4) . Replacing u with the function of x you took out gives:
dy/dx = -1/2(x^2+4x)^-3/2 * (2x+4) .
Rearranging and simplifying this expression gives:
dy/dx = -(x+2) / (x^2+4x)^3/2 .

See more