<s>[INST] is there a nicer way to $\int e^{2x} \sin x\, dx$? I have to solve this:
$\int e^{2x} \sin x\, dx$
I managed to do it like this:
let $\space u_1 = \sin x \space$ and let $\space \dfrac{dv}{dx}_1 = e^{2x}$
$\therefore \dfrac{du}{dx}_1 = \cos x \space $ and $\space v_1 = \frac{1}{2}e^{2x}$
If I substitute these values into the general equation:
$\int u\dfrac{dv}{dx}dx = uv - \int v \dfrac{du}{dx}dx$
I get:
$\int e^{2x} \sin x dx =  \frac{1}{2}e^{2x}\sin x - \frac{1}{2}\int e^{2x}\cos x\, dx$
Now I once again do integration by parts and say:
let $u_2 = \cos x$ and let $\dfrac{dv}{dx}_2 = e^{2x}$
$\therefore \dfrac{du}{dx}_2 = -\sin x$ and $v_2 = \frac{1}{2}e^{2x}$
If I once again substitute these values into the general equation I get:
$\int e^{2x}\sin x dx =\frac{1}{2}e^{2x}\sin x - \frac{1}{4}e^{2x}\cos x - \frac{1}{4}\int e^{2x}\sin x dx$
$\therefore \int e^{2x}\sin x dx = \frac{4}{5}(\frac{1}{2}e^{2x}\sin x - 
\frac{1}{4}e^{2x}\cos x) + C$
$\therefore \int e^{2x}\sin x\, dx = \frac{2}{5}e^{2x}\sin x - \frac{1}{5}e^{2x}\cos x + C$
I was just wondering whether there was a nicer and more efficient way to solve this?
Thank you :)
 [/INST] $$
\begin{align*}
\\ \int e^{2x}\sin x dx &= \Im \int e^{2x}(\cos x + i\sin x) dx
\\ &= \Im \int e^{(2 + i)x}dx
\\ &= \Im \frac{e^{(2 + i)x}}{2+i} + C
\\ &= \Im \frac15 e^{2x}(\cos x + i\sin x)(2-i) + C
\\ &= \frac15 e^{2x}(2\sin x - \cos x)  +C
\end{align*}$$
</s>