Calculus – Shortcut to Evaluate Integral of (xe^x)^n

calculusindefinite-integralsintegration

Q)Is there any shortcut method to evaluate $$\int (xe^{x})^{n}dx,$$ where $n$ is a positive integer?

Ans) My approach:

Let $$I=\int (xe^{x})^{n}dx$$
Now let's solve by cases.

Case-1) When $n=1$, then we can write
$$I=\int xe^{x}dx.$$ Now we have to integrate by applying Integration By Parts.

Therefore, $$I=x\int e^{x}dx-\int \frac{d}{dx}(x)\int e^{x}dx$$
$$\implies I= e^{x}(x-1)+C.$$

Case-2) When $n=2$, then we can write
$$I=\int x^{2}e^{2x}dx.$$ Now again we have to integrate by applying Integration By Parts.

$$I=\int x^{2}e^{2x}dx$$
$$\implies I=x^{2}\int e^{2x}dx-\int\frac{d}{dx}(x^{2})\int e^{2x}dx$$
$$\implies I=\frac{x^{2}}{2}e^{2x}-\int xe^{2x}dx$$

Now after this step we have to integrate $$\int xe^{2x}dx$$ by applying Integration By Parts.

My doubt:

It will be very difficult to integrate $$\int (xe^{x})^{n} dx$$ by applying Integration By Parts for $n\geq 4$. The calculation will go on becoming lengthy. I want to know whether there is any shortcut method for this Integral ? Please help me out with this Integral.

Best Answer

I record this here as it might be useful.

Let $-\infty<a<b\le\infty$ and $\lambda\in\mathbb C$ such that $b<\infty$ or $\Re\lambda>0$. Let $P$ be a polynomial. Then by integration by parts, \begin{align*} &&\int_a^bP(x)\,\mathrm e^{-\lambda x}\,\mathrm dx &=-\left[P(x)\,\frac{\mathrm e^{-\lambda x}}\lambda\right]_a^b+\frac1\lambda\int_a^bP'(x)\,\mathrm e^{-\lambda x}\,\mathrm dx, \end{align*} where $P'$ is again a polynomial. Applying the same with $P'(x)/\lambda$ in place of $P(x)$ yields $$\int_a^bP(x)\,\mathrm e^{-\lambda x}\,\mathrm dx=-\left[P(x)\,\frac{\mathrm e^{-\lambda x}}\lambda+P'(x)\,\frac{\mathrm e^{-\lambda x}}{\lambda^2}\right]_a^b+\frac1{\lambda^2}\int_a^bP''(x)\,\mathrm e^{-\lambda x}\,\mathrm dx.$$ Iterating, since eventually $P^{(k)}=0$ we can write $$\int_a^bP(x)\,\mathrm e^{-\lambda x}\,\mathrm dx=-\left[\sum_{k=0}^\infty P^{(k)}(x)\,\frac{\mathrm e^{-\lambda x}}{\lambda^{k+1}}\right]_a^b,$$ or in indefinite form, $$\int P(x)\,\mathrm e^{-\lambda x}\,\mathrm dx=-\sum_{k=0}^\infty\frac{P^{(k)}(x)\,\mathrm e^{-\lambda x}}{\lambda^{k+1}}+C.$$


Apply with $\lambda=-n$ and $P(x)=x^n$. The $P^{(k)}(x)$ are easy to compute.