\[ y'(x)+y(x) \cos (x)-\frac {1}{2} \sin (2 x)=0 \] ✓ Mathematica : cpu = 0.026934 (sec), leaf count = 18
\[\left \{\left \{y(x)\to c_1 e^{-\sin (x)}+\sin (x)-1\right \}\right \}\] ✓ Maple : cpu = 0.044 (sec), leaf count = 15
\[ \left \{ y \left ( x \right ) =\sin \left ( x \right ) -1+{{\rm e}^{-\sin \left ( x \right ) }}{\it \_C1} \right \} \]
\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*}