What is the integral of $\int e^x\,\sin x\,\,dx$?

Notice that you got

$$\begin{align}\int e^x\sin (x) \, dx=&\left(\sin(x)\,e^x\right)-\left(\cos(x)\,e^x-\left(\int-\sin\left(x\right)\,e^x\,dx\right)\right)\\=&\sin(x)\,e^x-\left(\cos(x)\,e^x+\int\sin\left(x\right)e^x\,dx\right)\\=&e^x\sin (x)-e^x\cos(x)-\int e^x\sin(x)\, dx\end{align}$$

This implies $\displaystyle \int e^x\sin (x) \, dx+\int e^x\sin (x) \, dx=e^x(\sin(x)-\cos(x))$.

Conclude.


Denote $B=\int e^x\sin\left(x\right)\,\,dx$ and $A=\int e^x\cos\left(x\right)\,\,dx$. Then consider $I=A+iB$. The integral you are looking for is the imaginary part of $I$. So you have $I=\int e^x(\cos\left(x\right)+i\sin\left(x\right))\,\,dx=\int e^x\cdot e^{ix}\,\,dx=\int e^{x(1+i)}\,\,dx=\frac{1}{1+i}e^{x(1+i)}+C$. The imaginary part of $\frac{1}{1+i}e^{x(1+i)}+C=\frac{1}{2}e^x(1-i)(\cos(x)+i\sin(x))+C$ is exactly $\frac{1}{2}e^x(\sin(x)-\cos(x))+C$.


Hint

$$\sin x =\mathrm{Im}(e^{ix})$$


You’re fine down through the fifth line, apart from the missing $dx$’s, which at this level I consider essential:

$$\int e^x\sin x\,dx=e^x\sin x-\left(e^x\cos x-\int(-\sin x)e^x\,dx\right)\;.$$

Now just expand the righthand side,

$$\int e^x\sin x\,dx=e^x\sin x-e^x\cos x-\int e^x\sin x\,dx\;,$$

and combine the terms containing the integral:

$$2\int e^x\sin x\,dx=e^x\sin x-e^x\cos x\;.$$

Now solve, not forgetting to insert a constant of integration:

$$\int e^x\sin x\,dx=\frac12e^x(\sin x-\cos x)+C\;.$$

This technique of doing two integrations by parts and then solving for the integral crops up rather often.