How to integrate a three products

If you don't want to try with complex calculus, you might use this:

Let's define $g(x) = e^x \sin{x} $, so we have: $J = \int x g(x) \, dx$.

Then, if you use chain rule, you will have:

$$J = x\, \int g(x) \, dx - \iint g(x) \, dx^2, $$

where, using again the chain rule:

$$\int g(x) \, dx = \int e^x \sin{x} \, dx = \frac{e^x}{2} (\sin{x} - \cos{x})$$

Thus:

$$\iint g(x) dx^2 = \int \frac{e^x}{2} (\sin{x} - \cos{x}) \, dx $$

where the first integral has already been computed. Using again the chain rule for the cosine integral, it finally yields:

$$\large{ \color{blue}{ J = \frac{x}{2} e^x (\sin{x} - \cos{x} ) + \frac{e^x}{2} \cos{x} } }$$

Do not forget the integration constant! Cheers.


One general idea with products of three functions is to use the product rule in the form $$ (u v w)' = u' v w + u v' w + uv w' $$ and the get partial integration in the form $$ \int u' v w = uvw - \int u v' w - \int uv w' $$ and then the solution of your problem is straightforward but tedious.

After two applications of above rule (with $u=e^x$) and some reorganization you find
$$ 2 \int x e^x \sin x \, dx = xe^x \sin x - x e^x \cos x -\int e^x \sin x \, dx + \int e^x \cos x \, dx $$ and the rest is easy.


Let me elaborate on Nigel's hint, and btw he meant $e^{ix} = i \sin x +\cos x$. There is no $\pi$.

then the integral you want is J. define the integral $I = \int x \cos x e^x \text{d}x$.

Then $I + iJ = \int x e^{ix}e^x \text{d}x = \int xe^{(i+1)x}\text{d}x$

note $i$ is square root of minus one, so it i just a constant, you integrate this by part and seperate out real and imaginary part. The imaginary part is what you want.

At first I wanted to post this, but I guessed this is not what OP wanted.

however, without this, this integral is a pain in the backside...