For the following diferential equation

dy/dx = (2 co^{2}x - sin^{2}x + y^{2})/ 2 cos x , -pi/2<x<pi/2

show that the substitution y(x) = sin x + (1/u(x)) yields the deferential equation for u(x),

du/dx = -u tanx - (1/2) sec x

Hence find the solution y(x) to the original deferential equation that satisfies the condition

y(0) = 2. Find the interval on which the solution to the initial value problem is defined.

Im having trouble doing this question. I have had about 4 attempts and can not seem to get to the du/dx they have. I'm solving the y= sinx +1/u to give dy/du= cosx -u^{-2}

and then letting that = the original dy/dx. Is this the way to go about it or am i missing something? i also rearrange the substitution so u= 1/(y-sin x).