\[ y'(x)+y(x) \cos (x)-\frac {1}{2} \sin (2 x)=0 \] ✓ Mathematica : cpu = 0.0282852 (sec), leaf count = 18
DSolve[-1/2*Sin[2*x] + Cos[x]*y[x] + Derivative[1][y][x] == 0,y[x],x]
\[\left \{\left \{y(x)\to \sin (x)+c_1 e^{-\sin (x)}-1\right \}\right \}\] ✓ Maple : cpu = 0.036 (sec), leaf count = 15
dsolve(diff(y(x),x)+y(x)*cos(x)-1/2*sin(2*x) = 0,y(x))
\[y \left (x \right ) = \sin \left (x \right )-1+{\mathrm e}^{-\sin \left (x \right )} c_{1}\]
Hand solution
\begin {equation} \frac {dy}{dx}+y\left ( x\right ) \cos \left ( x\right ) =\frac {1}{2}\sin \left ( 2x\right ) \tag {1} \end {equation}
Integrating factor \(\mu =e^{\int \cos dx}=e^{\sin \left ( x\right ) }\). Therefore (1) becomes2\[ \frac {d}{dx}\left ( e^{\sin \left ( x\right ) }y\left ( x\right ) \right ) =\frac {1}{2}e^{\sin \left ( x\right ) }\sin \left ( 2x\right ) \] Integrating\begin {align*} e^{\sin \left ( x\right ) }y\left ( x\right ) & =\frac {1}{2}\int e^{\sin \left ( x\right ) }\sin \left ( 2x\right ) +C\\ y\left ( x\right ) & =\frac {e^{-\sin \left ( x\right ) }}{2}\int e^{\sin \left ( x\right ) }\sin \left ( 2x\right ) +e^{-\sin \left ( x\right ) }C \end {align*}
But \(e^{\sin \left ( x\right ) }\sin \left ( 2x\right ) \) can be integrated by parts which gives \(e^{\sin \left ( x\right ) }\left ( -2+2\sin \left ( x\right ) \right ) \). Hence the above becomes\begin {align*} y\left ( x\right ) & =\frac {e^{-\sin \left ( x\right ) }}{2}\left ( e^{\sin \left ( x\right ) }\left ( -2+2\sin \left ( x\right ) \right ) \right ) +e^{-\sin \left ( x\right ) }C\\ & =-1+\sin \left ( x\right ) +e^{-\sin \left ( x\right ) }C \end {align*}