What is the integral of $\int e^x\,\sin x\,\,dx$? I'm trying to solve the integral of $\left(\int e^x\,\sin x\,\,dx\right)$ (My solution):
$\int e^x\sin\left(x\right)\,\,dx=$
$\int \sin\left(x\right) \,e^x\,\,dx=$
$\left(\sin(x)\,\int e^x\right)-\left(\int\sin^{'}(x)\,\left(\int e^x\right)\right)$
$\left(\sin(x)\,e^x\right)-\left(\int\cos(x)\,e^x\right)$
$\left(\sin(x)\,e^x\right)-\left(\cos(x)\,e^x-\left(\int-\sin\left(x\right)\,e^x\right)\right)$
$\left(\sin(x)\,e^x\right)-\left(\cos(x)\,e^x-\left(-\sin\left(x\right)\,e^x-\int-\cos\left(x\right)\,e^x\right)\right)$
I don't know how to complete because the solution gonna be very complicated.
 A: 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.
A: 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$.
A: Hint
$$\sin x =\mathrm{Im}(e^{ix})$$
A: 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.
A: Another way via leibniz theorem,
$$ \frac{d^4 (e^x \sin x)}{dx^4} =e^x \left[\binom{4}{0} \sin x+ \binom{4}{1} \cos x - \binom{4}{2} \sin x - \binom{4}{3} \cos x+ \binom{4}{4}  \sin x\right]$$
Or,
$$ \frac{1}{ \sum_{k=0}^2 \binom{4}{2k} } \frac{d^4 (e^x \sin x)}{dx^4} = e^x \sin x$$
Integrate both sides and apply leibniz for third derivative again,
$$ \int e^x \sin x dx =  \frac{1}{ \sum_{k=0}^2 (-1)^k \binom{4}{2k} } \int  \frac{d^4 (e^x \sin x)}{dx^4} dx=e^x \frac{\sum_{j=0}^3 \binom{3}{j} \sin( x + j \frac{\pi}{2})}{ \sum_{k=0}^2 (-1)^k \binom{4}{2k} }  $$
Since,
$$ \frac{d^i}{dx^i} \sin x = \sin( x +i \frac{\pi}{2} )$$
