Given that

find dy/dx in terms of y;

I am not sure which rule to use, do I use the product rule or chain rule?

I thought I should use the chain rule and this is what I get;

first differentiate cos which = -sin

than do y^2 to get 2y.

so

I know this wrong, but can someone please tell me what I am doing wrong?

the correct answer is

thanks,