Given that $\displaystyle x = cosy^{2} $

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 $\displaystyle \frac{dx}{dy} = -sin2y $

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

the correct answer is $\displaystyle \frac{dx}{dy} = -siny^{2} \times 2y $

thanks,