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

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.

• Your process will work. The trick is you don't have to integrate, say, $xe^{2x}$ by parts; you make the substitution $y=2x$ and use the result you had previously. You'll find it easier if you extend your notation slightly and define $I_n=\int \left(xe^x\right)^n dx$. Jan 18 at 11:06
• Use integration by parts to find a recurrrence relation on $J_n:=\int y^ne^ydy$. Jan 18 at 11:15
• @AnneBauval, I have tried but can't find any relation. Jan 18 at 11:16
• I guess. Doesn't that method gives loads of terms though for $n\geq 4$? I think OP is looking for something more elegant/efficient. Jan 18 at 11:24
• I think there is a nice way to get two inter-related recurrence relations $I_n, I_{n-1},\ldots I_1,$ and $J_n, J_{n-1},\ldots J_1,$ and then go back and forth between them, all the way down to $I_1$ and $J_1$. I'll try to make it work and turn it into and answer. Jan 18 at 11:44

I record this here as it might be useful.

Let $$-\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.

• Thank you very much @nejimban Jan 18 at 12:28

Note that

\begin{align} &\int (xe^{x})^{n}dx =\frac{d^n}{da^n} \bigg(\int e^{ax}dx\bigg)_{a=n} =\frac{d^n}{da^n}\left(\frac{e^{ax}}a\right)_{a=n}\\ \end{align}

Then, apply the product rule $$\frac{d^n}{da^n}f(a)g(a) =\sum_{k=0}^n \binom nk f^{(n-k)}(a) g^{(n)}(a)$$ to obtain

$$\int (xe^{x})^{n}dx= e^{nx} \sum_{k=0}^n \frac{(-1)^k n!}{n^{k+1}(n-k)!} {x^{n-k}}$$

$$I_n:=\int (x)^n e^{xn }dx$$ Let $$xn =t$$, $$dx =\frac{dt}{n}$$

$$I_n=\frac{1}{n^{n+1}}\int (t)^n e^{t }dx$$

Note that $$\int e^t t dt = te^t -e^t = \sum\limits_{k=0}^{1}(-1)^{k} e^t t^ {1-k} P(1,k)$$ such that $$P(n,k )= \frac{n!}{k!}$$

Assume that $$I_{n-1} =\frac{1}{n^{n+1}}\sum\limits_{k=0}^{n-1}(-1)^{k} e^t t^ {n-1-k} P(n-1,k)$$ $$I_{n}= \frac{1}{n^{n+1}} \bigg(e^t t^n - n\int t^{n-1}e^t dt \bigg)+C= \frac{1}{n^{n+1}}\bigg(e^t t^n-n\sum\limits_{k=0}^{n-1}(-1)^{k} e^t t^ {n-1-k} P(n-1,k)\bigg)$$ $$=\frac{1}{n^{n+1}}\sum\limits_{k=0}^{n}(-1)^{k} e^t t^ {n-k} P(n,k)$$

Bu induction $$I_{n}=\frac{1}{n^{n+1}}\sum\limits_{k=0}^{n}(-1)^{k} e^t t^ {n-k} P(n,k)$$ for all $$n$$

$$I_{n}= \frac{1}{n^{n+1}}\sum\limits_{k=0}^{n}(-1)^{k} e^t t^ {n-k} P(n,k) =\frac{1}{n^{n+1}}\sum\limits_{k=0}^{n}(-1)^{k} e^{ nx}{(nx)}^ {n-k} P(n,k)$$