Solve $\int x^2e^x\sin x$

My attempt is as follows:-

$$I_1=\int e^x\sin x$$ $$I_1=e^x\sin x-\int e^x\cos x$$ $$I_1=e^x\sin x-e^x\cos x-\int\sin (x)e^x$$ $$2I_1=e^x\left(\sin x-\cos x\right)$$ $$I_1=\dfrac{e^x\left(\sin x-\cos x\right)}{2}\tag{1}$$

$$I_2=\int e^x\cos x$$ $$I_2=e^x\cos x+\int e^x\sin x$$ $$I_2=e^x\cos x+e^x\sin x-\int e^x \cos x$$ $$I_2=\dfrac{e^x(\cos x+\sin x)}{2}$$

$$I=\int x^2e^x\sin x$$ $$I=I_1x^2-2\int xI_1$$ $$I=I_1x^2-\int xe^x(\sin x-\cos x)$$ $$I=I_1x^2-\int xe^x\sin x+\int xe^x\cos x$$

$$I=I_1x^2-xI_1+\int I_1+xI_2-\int I_2$$ $$I=I_1x^2-xI_1+xI_2+\int I_1-\int I_2$$ $$I=I_1x^2-xI_1+xI_2+\dfrac{1}{2}\int e^x\left(\sin x-\cos x\right) -\dfrac{1}{2}\int e^x\left(\cos x+\sin x\right)$$

$$I=I_1x^2-xI_1+xI_2+\dfrac{I_1}{2}-\dfrac{I_2}{2} -\dfrac{I_2}{2}-\dfrac{I_1}{2}$$

$$I=I_1x^2-xI_1+xI_2-I_2$$ $$\dfrac{e^x}{2}\left(x^2\sin x-x^2\cos x-x\sin x+x\cos x+x\cos x+x\sin x-\sin x-\cos x \right)+C$$

$$\dfrac{e^x}{2}\left((x^2-1)\sin x-(x-1)^2\cos x \right)+C$$

Is there any better way to solve it which is short and clean. Mine got very long.

  • $\begingroup$ How about $\sin x=\Im e^{i x}$ $\endgroup$ – Ali Shather Dec 24 '19 at 19:46
  • 1
    $\begingroup$ no we can't use complex numbers. $\endgroup$ – user3290550 Dec 24 '19 at 19:47
  • 2
    $\begingroup$ I think you're forgetting a few integration constants here and there. $\endgroup$ – Arthur Dec 24 '19 at 19:49
  • $\begingroup$ You can get rid of the $i$ at the end. $\endgroup$ – Ali Shather Dec 24 '19 at 19:50
  • 1
    $\begingroup$ An obvious way to save a line is to note $$I_2=e^x \sin(x)-I_1$$ so you don't need to recalculate after having calculated $I_1$ $\endgroup$ – Maximilian Janisch Dec 24 '19 at 19:52

I don't know if you like this or not. Let $$ I(a)=\int e^{ax}\sin(x)dx. $$ It is easy to see $$ I''(a)=\int x^2 e^{ax}\sin(x)dx. $$ But $$ I(a)=\frac{e^{ax}(-\cos x+a\sin x)}{a^2+1}+C(a). $$ Now taking the 2nd derivative will give the answer.

| cite | improve this answer | |

Start with writing $\sin x=\color{red}{\Im}e^{ix}$

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


$$=x^2 \color{red}{\Im} \frac{e^{(1+i)x}}{1+i}-2x \color{red}{\Im}\frac{e^{(1+i)x}}{(1+i)^2}+2\color{red}{\color{red}{\Im}} \frac{e^{(1+i)x}}{(1+i)^3}$$

$$=x^2\left(\frac12e^x\sin x-\frac12e^x\cos x\right)-2x\left(-\frac12e^x\cos x\right)+2\left(-\frac14e^x\sin x-\frac14e^x\cos x\right)$$

$$=\frac12e^x\sin x(x^2-1)-\frac12e^x\cos x(x-1)^2+C$$

| cite | improve this answer | |
  • $\begingroup$ by the way your answer is wrong. $\endgroup$ – user3290550 Dec 24 '19 at 20:05
  • $\begingroup$ yes i know what i did wrong. thanks $\endgroup$ – Ali Shather Dec 24 '19 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.