We have, (1+tany)(dx−dy)+2xdy=0 ⇒(1+tany)dx=(1+tany−2x)dy ⇒dydx+1+tany2x=1, which is linear differential equation.
I.F. =e2∫1+tanydy=e∫siny+cosy2cosydy =e∫(1+siny+cosycosy−siny)dy=ey+log(cosy+siny) =(cosy+siny)ey
So, the solution is xey(siny+cosy)=∫ey(siny+cosy)dy+c
i.e. xey(siny+cosy)=eysiny+c.
i.e. x(siny+cosy)=siny+ce−y