8
$\begingroup$

Evaluate:

$$\int x e^{x} \sin x dx$$

Have you ever come across such an integral? I have no idea how to start with the calculation.

  • 0
    Where did such an integral come from? Here is an answer: https://www.wolframalpha.com/input/?i=integral+x+sin(x)+e%5Ex2017-01-02
  • 0
    I'm doing some calculations which are based on Schrodingers equation (of course some things are simplified). Thanks!2017-01-02
  • 2
    HINT: Use Euler's Formula to write $$x\sin(x)e^x=\text{Im}(xe^{(1+i)x})$$2017-01-02
  • 0
    I'd recommend integration by parts. You'll have to do it twice. Euler's theorem will help.2017-01-02
  • 0
    @jaustin: You integrate by parts twice for $\int x \sin x$ or $\int x \Bbb e^x$ or $\int \Bbb e ^x x$, but here you have all these three functions in the integrand, so it's a bit longer then that.2017-01-02
  • 0
    I don't think that integration by parts is necessary here... Differentiation under the integral sign should suffice once we write in complex exponential form.2017-01-02
  • 0
    I'd do this by calculating the derivative of $xe^x\sin x$, as well as the derivative of other terms that might appear in the answer such as $xe^x\cos x$, $e^x\sin x$, and $e^x\cos x$. Then, I'd try to see if I can write your integrand ($xe^x\sin dx$) as a sum of this derivatives.2017-01-02

8 Answers 8

-1

By parts,

$$\int te^tdt=(t-1)e^t.$$

Then by the change of variable $t=(1+i)x$,

$$\int xe^x\sin x\,dx=\Im\left(\frac1{(1+i)^2}((1+i)x-1)e^{(1+i)x}\right)=\Im\left(\left(\frac{1-i}2x+\frac i2\right)e^{(1+i)x}\right).$$

9

If one may recall that $\sin(x)=\Im e^{ix}$, then

$$\int x\sin(x)e^x\ dx=\Im\int xe^{(1+i)x}\ dx$$

With a quick integration by parts, we have

$$=\Im\left(\frac1{1+i}xe^{(1+i)x}-\frac1{1+i}\int e^{(1+i)x}\ dx\right)\\=\Im\left(\frac1{1+i}xe^{(1+i)x}-\frac1{(1+i)^2}e^{(1+i)x}+C\right)\\=\frac12\left(x\sin(x)e^x-x\cos(x)e^x+\cos(x)e^x\right)$$

  • 0
    Very nice solution! And it's pretty short. Thanks :)2017-01-02
  • 0
    @Hendrra No problem. Shortness and all that good stuff comes with using complex numbers, so I highly recommend you learn it a bit, maybe just for checking your work ;-)2017-01-02
  • 0
    I think I should learn how to use complex numbers a bit! Sometimes it's great to know some shorters ways of doing something. Can you recommend me some textbooks, please?2017-01-02
  • 0
    Oh... uh.. see, I haven't read any textbooks. Especially any about complex numbers. I'll have to recommend you look up "Euler's formula" though:$$e^{ix}=\cos(x)+i\sin(x)$$which was the basis of my answer. @Hendrra2017-01-02
  • 0
    Thank you! That formula is amazingly beautiful for $x = \pi$2017-01-02
  • 0
    @Hendrra $100%$ beautify for all $x$ IMO. Particularly enough values of $x$ so that I can cheat all my integrals and summations that involve trig functions ;)2017-01-02
  • 0
    I think it should be $+\cos x$ at the end, otherwise it's good.2017-01-02
  • 0
    @Momo Thanks, a lot of sign changes happening at the end there.2017-01-02
7

Solution without complex numbers:

Let $I=\int e^x x\sin xdx$ Integrating by parts:

$$I=e^x x\sin x-\int e^x x\cos xdx-\int e^x\sin xdx$$

Then one more time by parts:

$$\int e^x x\cos xdx=e^x x\cos x + I-\int e^x\cos xdx$$

So:

$$2I=e^x x\sin x-e^x x\cos x+\int e^x(\cos x-\sin x)dx$$

Now (by parts again or by direct observation):

$$\int e^x(\cos x-\sin x)dx=e^x \cos x$$

So:

$$I=\frac{e^x x\sin x-e^x x\cos x+e^x \cos x}{2}$$

  • 2
    Thanks. I really appreciate this solution because I didn't want to use complex numbers. It's a nice one :)2017-01-02
3

HINTS:

Use Euler's Formula to write $$x\sin(x)e^x=\text{Im}(xe^{(1+i)x})$$Integrate $\int xe^{(1+i)x}\,dx$ by parts with $u=x$ and $v=\frac{e^{(1+i)x}}{1+i}$ and finish by taking the imaginary part.

1

This solution doesn't use integration by parts. We start with

$$\int\exp(x) dx = \exp(x)$$

Substituting $x = \lambda t$ yields:

$$\int\exp(\lambda t) dt = \frac{\exp(\lambda t)}{\lambda}$$

Substitute $\lambda = 1+\epsilon + i$ and expand both sides to first order in $\epsilon$. Equating the coefficient of $\epsilon$ of both sides yields:

$$\begin{split}\int t\exp(t)\exp(i t) dt &= \exp(t)\exp(it)\left[\frac{1-i}{2}t + \frac{i}{2}\right]\\ & = \exp(t)\left[\frac{\exp(i(t-\frac{\pi}{4}))}{\sqrt{2}}t + \frac{\exp(i(t+\frac{\pi}{2}))}{2}\right] \end{split} $$

Finally, take the imaginary part of both sides:

$$\int t\exp(t)\sin(t) dt = \exp(t)\left[\frac{\sin\left(t-\frac{\pi}{4}\right)}{\sqrt{2}}t + \frac{\cos(t)}{2}\right]$$

1

By indeterminate coefficients:

A term like $xe^x\sin x$ can be generated by the derivative of itself (due to $e^x$), which will also generate $xe^x\cos x$ and $e^x\sin x$.

Then we are tempted to try

$$f(x)=e^x(x(A\sin x+B\cos x)+(C\sin x+D\cos x)),$$

and

$$f'(x)=e^x(x(A\sin x+B\cos x)+(C\sin x+D\cos x)+(A\sin x+B\cos x)+x(A\cos x-B\sin x)+(C\cos x-D\sin x)).$$

We identify,

$$A-B=1,\\A+B=0,\\C+A-D=0,\\D+B+C=0$$

and obtain

$$\frac12xe^x(\sin x-\cos x)+\frac12\cos x.$$

1

This can also be solved another way (a little longer but correct nevertheless and could be more basic and readable for people who just started learning calculus):

We will use the results of following(easy - just substitute):

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

$$ \int e^{\ln(x)+x}dx = \int xe^xdx = xe^x-e^x + C $$ and

$$ \int e^x cos(x) dx = \frac{e^x sin(x) + e^x cos(x)}{2} + C $$

Now, back to the main integral. The main problem is that the formula contains not the usual two but three factors($x$, $e^x$ and $sin(x)$). However, using basic logarithm and $exp$ properties we can transform the expression into one with just two factors:

$$ x e^x = e^{\ln(x)} e^x = e^{ln(x) + x} $$

this leaves us with

\begin{equation*} I = \int xe^xsinx dx = \int e^{ln(x) + x} sin(x) dx = \end{equation*}

integrate by parts with substituting:

$$ \begin{equation*} \left[ \begin{alignedat}{2} u &= \sin(x) \quad & du &=cos(x) \\ dv &= e^{ln(x)+x} \quad & v &= xe^x-e^x \end{alignedat}\, \right] \end{equation*} $$

$$ = e^xxsin(x)-e^xsin(x)-\int xe^xcos(x) -e^xcos(x)dx $$

$$ = e^xxsin(x)-e^xsin(x)-\int xe^xcos(x)dx + \int e^xcos(x)dx $$

Now, another three factor integral appears, which can also be integrated by parts using the previous trick.

$$ \int xe^xcos(x)dx = $$ $$ \begin{equation*} = \int e^{ln(x)+x}cos(x)dx = \left[ \begin{alignedat}{2} u &= \cos(x) \quad & du &=-sin(x) \\ dv &= e^{ln(x)+x} \quad & v &= xe^x-e^x \end{alignedat}\, \right] = \end{equation*} $$ $$ = xe^xcos(x)-e^xcos(x)+ \int x e^x sin(x) dx - \int e^x sin(x) dx = $$ $$ = xe^xcos(x)-e^xcos(x)+ I - \int e^x sin(x) dx $$

Back to the previous equation, plug in the result above flipping the signs accordingly:

$$ I = e^xxsin(x)-e^xsin(x) + \int e^xcos(x)dx - xe^xcos(x)+e^xcos(x)- I + \int e^x sin(x) dx $$ Great! We obtained the wanted integral with negative sign. Let's move it to the other side of equation: $$ 2I = e^xxsin(x)-e^xsin(x) + \int e^xcos(x)dx - xe^xcos(x)+e^xcos(x) + \int e^x sin(x) dx $$ and plug in the results of simpler integrals: $$ 2I = e^xxsin(x)-e^xsin(x) + \frac{e^x sin(x) + e^x cos(x)}{2} - xe^xcos(x)+e^xcos(x) + \frac{e^x sin(x) - e^x cos(x)}{2} + C $$ now just simplify the right side and divide by 2 to obtain the final result: $$ I = \frac {xe^xsin(x) - xe^xcos(x) +e^xcos(x)}{2} + C $$

0

First integrate $\sin(x) \exp(x),$ by parts, with the exponential as $d v.$ (you will need to do the integration by parts twice), then use the same method for the original integral.