Solution:
Key idea: A first-order linear equation can be written as dxdy+Py=Q, where P and Q are functions of x only. Its integrating factor is IF=e∫Pdx. Multiplying the equation by the IF turns the left side into dxd(y⋅IF), so the solution is y⋅IF=∫Q⋅IFdx+c, where c is the arbitrary constant.
Step 1 — Write the equation in standard form.
We divide by tanxdx (on 0<x<2π, where tanx>0 and sinx>0).
dxdy=tanxsin2x−y
Since tanx1=cotx and tanxsin2x=sinxcosx:
dxdy+cotx⋅y=sinxcosx
Step 2 — Find the integrating factor.
Here P=cotx, whose integral is logsinx.
IF=sinx
Step 3 — Solve.
We multiply Q by sinx and put u=sinx, so du=cosxdx.
ysinx=∫sin2xcosxdx
ysinx=3sin3x+c
Step 4 — Make y the subject.
We divide every term by sinx.
y=3sin2x+sinxc
Therefore, the general solution is y=3sin2x+ccosecx.