Integration by parts of $\sin(x)e^x$ I'm studying analysis and I have a problem with the integral calculation of this function:
$$\int \sin(x)e^x\mathrm dx$$
I start by using integration by parts and I obtained this:
$$\int \sin(x)e^x\mathrm dx = \sin(x)e^x-\int \cos(x)e^x\mathrm dx$$
But now I don't know how to continue, will I enter in a infinite loop if I repeat integration by parts?
I do it one more time like the comment above said and I have:
$$\int \sin(x)e^x\mathrm dx = \sin(x)e^x-\cos(x)e^x-\int -\sin(x)e^x\mathrm dx$$
And if I move to the left I obtain:
$$\int \sin(x)e^x\mathrm dx+\int -\sin(x)e^x\mathrm dx = \sin(x)e^x-\cos(x)e^x$$
Right?
 A: Another way could be to consider $$I=\int \sin(x)\,e^x\,dx$$ $$J=\int \cos(x)\,e^x\,dx$$ Then $$J+i I=\int e^{ix}\,e^x\,dx=\int e^{(1+i)x}\,dx=\frac { e^{(1+i)x}} {1+i}=\left(\frac{1}{2}-\frac{i}{2}\right) e^{(1+i) x}$$ Expand the last term to get $$J+i I=\frac{1}{2} e^x \sin (x)+\frac{1}{2} e^x \cos (x)+i \left(\frac{1}{2} e^x \sin
   (x)-\frac{1}{2} e^x \cos (x)\right)$$
Doing the same for $$K=\int \sin(ax)\,e^{bx}\,dx$$ $$L=\int \cos(ax)\,e^{bx}\,dx$$ $$L+iK=\int e^{iax}e^{bx}\,dx=\int e^{(b+ia)x}dx=\frac {e^{(b+ia)x}}{b+ia}=\frac {b-ia}{a^2+b^2}{e^{(b+ia)x}}$$ and expanding again $$L+iK=\frac{a e^{b x} \sin (a x)}{a^2+b^2}+\frac{b e^{b x} \cos (a x)}{a^2+b^2}+i
   \left(\frac{b e^{b x} \sin (a x)}{a^2+b^2}-\frac{a e^{b x} \cos (a
   x)}{a^2+b^2}\right)$$
A: You are going well, just do the next thing:
$\int\sin(x)e^xdx = \sin(x)e^x - \cos(x)e^x - \int\sin(x)e^xdx \rightarrow
2\int\sin(x)e^xdx =sin(x)e^x - cos(x)e^x \rightarrow \int\sin(x)e^xdx=\frac{1}{2}(\sin(x)e^x - \cos(x)e^x) $
A: Another way to do this question

$$I=\int\frac{1}{2}e^x(\sin x -\cos x +\cos x +\sin x)$$
$$=\int \frac{1}{2}e^x(f(x) +f'(x))$$
A: By indeterminate coefficients:
Seeing the expressions obtained by parts, you are hinted to try a solution of the form
$$(a\cos x+b\sin x)e^x.$$
After differentiation,
$$((a+b)\cos x+(b-a)\sin x)e^x.$$
Then by identification
$$\begin{cases}a+b=0,\\a-b=-1\end{cases}$$ is trivial.
A: Observe that
$$(\sin x\,e^x)'=(\sin x+\cos x)e^x=\sqrt2\sin\left(x+\frac\pi4\right)e^x.$$
From this,
$$(\sin x\,e^x)''=\left(\sqrt2\sin\left(x+\frac\pi4\right)e^x\right)'={\sqrt2}^2\sin\left(x+2\frac\pi4\right)e^x$$
and by induction
$$(\sin x\,e^x)^{(k)}={\sqrt2}^k\sin\left(x+k\frac\pi4\right)e^x.$$
gives the $k^{th}$ derivative.
Similarly, $k=-1$ corresponds to the antiderivative
$$\int\sin x\,e^x\,dx=\sqrt2^{-1}\sin\left(x-\frac\pi4\right)e^x=\frac12(\sin x-\cos x)e^x+C.$$
For other negative $k$, you get the $k^{th}$ antiderivatives (plus a polynomial).
A: Let $\int\sin xe^x = I$.  
$I = \sin xe^x - \cos xe^x -I$
$2I = \sin xe^x - \sin xe^x$
$I = (\sin xe^x - \cos xe^x)/2.$
