U have to use the chain rule, because you're dealing with composite functions:

You're first step is good. But then it went wrong, because you didn't use the chain rule:

If you want to calculate for example:

Let

so you get:

Use also the chainrule to calculate or notice that