# How do you differentiate f(x) = sin((− x^2 − 1)^2) *(x^2 − 9)^2 using the chain rule?

Hey there!

To differentiate your function, you want to start by looking, overall, at what type of function you have. In short, you have a product (with chains inside). This could get a bit messy, haha!

Recall that chain rule looks like this:

If $f \left(x\right) = g \left(h \left(x\right)\right)$ then,

$f ' \left(x\right) = g ' \left(h \left(x\right)\right) \cdot h ' \left(x\right)$

#### Explanation:

First, start off with the product rule where if:

$f \left(x\right) = g \left(x\right) h \left(x\right)$ then,

$f ' \left(x\right) = g ' \left(x\right) h \left(x\right) + h ' \left(x\right) g \left(x\right)$

Note that the order of multiplication doesn't matter!

Differentiate the first part: $\sin \left({\left(- {x}^{2} - 1\right)}^{2}\right)$:

The derivative of sin(x) is cos(x), but your "x" is much more complicated; it's a chain of functions and thus, by Chain Rule, you must multiply by the inside of the function. Therefore the derivative of the first part is:

$\cos {\left(- {x}^{2} - 1\right)}^{2} \cdot 2 \left(- {x}^{2} - 1\right) \cdot \left(- 2 x\right)$

Note that you had to do chain rule on the ${\left(- {x}^{2} - 1\right)}^{2}$ since that whole expression is being raised to a power. That's where the $- 2 x$ came from. Also, to get the 2 in front, you do Power Rule since you have a function being raised to a power. Now just add in the second function "h(x)" unchanged as seen in the general product rule formula.

So far we have:

$f ' \left(x\right) = \left(\cos {\left(- {x}^{2} - 1\right)}^{2} \cdot 2 \left(- {x}^{2} - 1\right) \cdot \left(- 2 x\right)\right) \left({\left({x}^{2} - 9\right)}^{2}\right) + \ldots$

Now we need to differentiate the second half of the equation. This is a simple chain rule problem.

To differentiate ${\left({x}^{2} - 9\right)}^{2}$:

By Chain Rule / Power Rule the derivative is:

$2 \left({x}^{2} - 9\right) \cdot \left(2 x\right)$

Now you just multiply by the first part of the function unchanged to get:

(2(x^2-9)*2x)(sin((-x^2-1)^2)

Finally, combine everything to get:

 f'(x) = (cos(-x^2-1)^2 * 2(-x^2-1)*(-2x))((x^2-9)^2) + (2(x^2-9)*2x)(sin((-x^2-1)^2)

I know this was a bit messy, but hopefully everything was clear! Chain rule, combined with the other rules for derivatives can get quite complicated, it just requires practice! Hopefully this helps! :)