# When To Use Chain Rule

**Firstly, what is the chain rule?**

The chain rule is the way to find the derivative when you are dealing with a composite function. When the inner function is something other than just x, this is when we apply the chain rule. The chain rule rewrites the problem for us into something that we definitely know how to differentiate.

For example, imagine you were asked to differentiate y=sin(x^{2}).

Instead of dealing with sin(x^{2}), we can let u=x^{2}.

We know how to differentiate sin(u) with respect to u.

dy/du = cos(u).

Of course, we didn’t want to differentiate with respect to u.

But this is where the chain rule comes into play.

dy/du = cos(u) and with u=x^{2}, du/dx = 2x

To obtain dy/dx. All we need to do is multiply dy/du with du/dx.

This gives us 2xcos(u)

Finally we can replace u with the x^{2} from earlier on.

This leaves us with 2xcos(x^{2}).

In three simple steps:

1. Differentiate the angle x^{2} → 2x

2. State what the main function differentiates to, sin() → cos()

3. Keep the angle the same x^{2}

**OK, then how do you know when to use the chain rule? **

If the original equation is something like x^{7}, there would be no need for the chain rule.

It's when you have something more complex than just x inside that you should use the chain rule, such as (3x + 1)^{7} or even (x^{2} + 1)^{7}. Sometimes the chain rule may make no difference. For instance, if you have the function (x + 1)^{7}, taking the derivative of the inside function just gives you 1, so multiplying by that inside derivative of 1 will not change the overall answer. However, it can't hurt to use the chain rule anyway, so it's a good idea to get in the habit of using it so that you don't forget it when it really does make a difference.

You might be scared of the chain rule and decide that you would feel more comfortable expanding the brackets and differentiating using the standard power rule that you are so familiar with. Yes, you would get the same result and be my guest but it is extremely tedious and unnecessary. What happens if you come across (4x+1)^{54}, have fun expanding that one!

We use the chain rule when differentiating a 'function of a function' AKA a composite function, like f(g(x)) in general.

Take an example, f(x) = sin(3x). The two functions here are as follows: function one is 3x and function two is sin(x). The composite function here is sin(3x). We have to use the chain rule to differentiate these types of functions.

There are three simple steps to chain rule:

1) differentiate the 'angle'

2) what does the main function differentiate to

3) the angle stays the same

Applying this rule

1) the angle 3x differentiates to 3

2) the main function sin(x) differentiates to cos(x)

3) the angle must stay the same

So here we get 3 multiplied by cos(3x)

So f'(x)=3cos(3x)

Just be sure to not confuse this with seeing two functions being multiplied together. In this instance we would use the product rule. Check out my Youtube channel to learn all about the product rule:

https://www.youtube.com/@Neil-Trivedi-MES-Maths