Given:

$\displaystyle y= \frac{sin^2 x}{1+ ctgx} + $$\displaystyle \frac{cos^2 x}{1+ ctgx}$

Find $\displaystyle y'$

I know that answer is $\displaystyle -cos2x $, but can't calculate it.

I got so far:

$\displaystyle y'=(\frac{sin^2 x}{1+ ctgx} +\frac{cos^2 x}{1+ ctgx} )'= \frac{(sin^2 x)'(1+ ctgx) - sin^2 x (1+ ctgx)'}{(1+ ctgx)^2} $ + $\displaystyle \frac{(cos^2 x)'(1+ tgx) - cos^2 x (1+ tgx)'}{(1+ tgx)^2} = $

$\displaystyle

=\frac{2sinx(1+ctgx)+1}{(1+ ctgx)^2} +\frac{2cos x(1+tgx)-1}{(1+ tgx)^2}

$