<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] A different method (though not really easier) is to use the fact that $\sin x$ can be expressed using exponents:
$$\sin x = \frac{e^{ix} - e^{-ix}}{2i}$$
So that your integral is:
$$\int e^{2x} \sin x\ dx = \int \frac{e^{2x+ix} - e^{2x-ix}}{2i} dx= \frac{e^{2x+ix}}{4ix-2x} - \frac{e^{2x-ix}}{4ix+2x}+C$$
$$=\frac{-1}{10}(2i+1)e^{2x+ix} +\frac{1}{10} (2i-1)e^{2x-ix}+C$$
$$=\frac{2}{5}e^{2x}\sin x-\frac{1}{5}e^{2x}\cos x +C$$
</s>