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. We also use the standard integrals ∫eaxsinbxdx=a2+b2eax(asinbx−bcosbx) and ∫eaxcosbxdx=a2+b2eax(acosbx+bsinbx).
Step 1 — Part (i): standard form and IF.
We move the y term to the left.
dxdy−tanx⋅y=−2sinx
Here P=−tanx. On −2π<x<2π (where cosx>0) its integral is logcosx.
IF=cosx
Step 2 — Part (i): solve.
We multiply Q by the IF and use 2sinxcosx=sin2x.
ycosx=−∫sin2xdx
ycosx=2cos2x+c1
We multiply by 2 and rename 2c1 as c.
2ycosx=cos2x+c
Step 3 — Part (ii): solve.
Here P=1, so the IF is ex. We use the standard integral with a=1, b=1.
yex=∫exsinxdx
yex=2ex(sinx−cosx)+c
y=21(sinx−cosx)+ce−x
Step 4 — Part (iii): solve.
The IF is again ex; now we use the cosine form with a=1, b=1.
yex=∫excosxdx
yex=2ex(cosx+sinx)+c
y=21(sinx+cosx)+ce−x
Step 5 — Part (iv): solve.
Here P=2, so the IF is e2x. We use the sine form with a=2, b=1, so a2+b2 is 5.
ye2x=∫e2xsinxdx
ye2x=5e2x(2sinx−cosx)+c
y=51(2sinx−cosx)+ce−2x
Step 6 — Part (v): standard form and IF.
We divide every term by 2 so that dxdy has coefficient 1.
dxdy+2y=21sin2x
Here P=2, so the IF is e2x.
Step 7 — Part (v): solve.
We use the sine form with a=2, b=2, so a2+b2 is 8.
ye2x=21∫e2xsin2xdx
ye2x=21⋅8e2x(2sin2x−2cos2x)+c
ye2x=8e2x(sin2x−cos2x)+c
y=81(sin2x−cos2x)+ce−2x
Step 8 — Part (v): check by substitution.
We put the particular part y1=81(sin2x−cos2x) back into 2y′+4y.
2y1′=21(cos2x+sin2x)
4y1=21(sin2x−cos2x)
Adding the two lines, the cosine terms cancel.
2y1′+4y1=sin2x
Note: In part (v) the coefficient is 81; with 41 in its place, the left side would come to 2sin2x instead of sin2x.
Step 9 — Part (vi): standard form and IF.
We divide by tanx. On the right, secxcotx simplifies because the cosx cancels.
secxcotx=sinx1
So the standard form is:
dxdy+2cotx⋅y=sinx1
Here P=2cotx; on 0<x<2π its integral is 2logsinx.
IF=sin2x
Step 10 — Part (vi): solve.
We multiply Q by sin2x, leaving sinx to integrate.
ysin2x=∫sinxdx
ysin2x=−cosx+c
Therefore, (i) 2ycosx=cos2x+c; (ii) y=21(sinx−cosx)+ce−x; (iii) y=21(sinx+cosx)+ce−x; (iv) y=51(2sinx−cosx)+ce−2x; (v) y=81(sin2x−cos2x)+ce−2x; (vi) ysin2x+cosx=c.