\[ y'(x)+y(x) \cos (x)-e^{2 x}=0 \] ✓ Mathematica : cpu = 0.382991 (sec), leaf count = 39
\[\left \{\left \{y(x)\to e^{-\sin (x)} \int _1^xe^{2 K[1]+\sin (K[1])}dK[1]+c_1 e^{-\sin (x)}\right \}\right \}\] ✓ Maple : cpu = 0.112 (sec), leaf count = 21
\[ \left \{ y \left ( x \right ) = \left ( \int \!{{\rm e}^{2\,x+\sin \left ( x \right ) }}\,{\rm d}x+{\it \_C1} \right ) {{\rm e}^{-\sin \left ( x \right ) }} \right \} \]
\begin {equation} \frac {dy}{dx}+y\left ( x\right ) \cos \left ( x\right ) =e^{2x}\tag {1} \end {equation}
Integrating factor \(\mu =e^{\int \cos \left ( x\right ) dx}=e^{\sin \left ( x\right ) }\). Hence (1) becomes
\[ \frac {d}{dx}\left ( e^{\sin \left ( x\right ) }y\left ( x\right ) \right ) =e^{\sin \left ( x\right ) }e^{2x}\]
Integrating both sides
\begin {align*} e^{\sin \left ( x\right ) }y\left ( x\right ) & =\int e^{\sin \left ( x\right ) }e^{2x}+C\\ y\left ( x\right ) & =e^{-\sin \left ( x\right ) }\int e^{2x+\sin \left ( x\right ) }+Ce^{-\sin \left ( x\right ) } \end {align*}