# Efficiently evaluating $\int x^{4}e^{-x}dx$ [duplicate]

This question already has an answer here:

The integral I am trying to compute is this:

$$\int x^{4}e^{-x}dx$$

I got the right answer but I had to integrate by parts multiple times. Only thing is it took a long time to do the computations. I was wondering whether there are any more efficient ways of computing this integral or is integration by parts the only way to do this question?

Edit: This question is similar to the question linked but slightly different because in the other question they are asking for any method to integrate the function which included integration by parts. In this question I acknowledge that integration by parts is a method that can be used to evaluate the integral but am looking for the most efficient way. This question has also generated different responses than the question linked such as the tabular method.

## marked as duplicate by J. M. is a poor mathematician, Semiclassical, T. Bongers, Pierre-Guy Plamondon, user147263 Apr 11 '16 at 23:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• Would need limits for this if you intend a numerical answer. Not meant to be a trivial statement since if the upper limit is infinity then more computation needed. – jim Apr 10 '16 at 18:50
• @mikevandernaald Gamma function has a limits , there is no limits – openspace Apr 10 '16 at 18:51
• I think that the simplest way to compute it is integrating by parts. – Crostul Apr 10 '16 at 18:52
• In the original question I was attempted the limits of integration were from 0 to 1 – user262291 Apr 10 '16 at 18:52
• Use the tabular method pages.pacificcoast.net/~cazelais/187/tabular.pdf – user258700 Apr 10 '16 at 18:57

## 3 Answers

While it still entails integration by parts, there exists a "quick" method of doing the integration by parts called the Tabular Method. Basically, you start with a table that has $3$ columns. One with alternating signs, one with a $u$ and one with $dv$. In the column for $u$, you should put the term that will eventually go to zero after multiple differentiations. In the last column is $dv$ which you will integrate multiple times. You'll want to pick something you can still integrate multiple times for $dv$. So in $\displaystyle \int x^4e^{-x}\,dx$, we can create the following table: $$\begin{matrix} & u & dv \\ + &x^4 & e^{-x} \\ - & 4x^3 & -e^{-x} \\ + & 12 x^2 & e^{-x} \\ - & 24x & -e^{-x} \\ + & 24 & e^{-x} \\ - & 0 & -e^{-x}.\end{matrix}$$ we now have all the parts to compute our solution. You start at the very first $+$, and multiply the corresponding $u$ term with the $dv$ term on the very next line. Continue this process until you get to the end of the $dv$ column. So our solution is $$\int x^4e^{-x}\,dx = -x^4e^{-x} -4x^3e^{-x} -12x^2e^{-x}-24xe^{-x}-24e^{-x} + C$$

• Why $-x^4e^{-x}$ instead of $x^4e^{-x}$ (and similar questions for the other terms)? – PyRulez Apr 11 '16 at 1:25
• It's because $x^4$ is multiplied by $-e^{-x}$ (the $dv$ entry on the second line). – jtbandes Apr 11 '16 at 3:03
• Yes, the $dv$ entry on the next line is the $v$, the integration, of the the $dv$ entry on the current line. This is what we want $\int u dv = uv - \int v du$. – Dominic108 Apr 11 '16 at 11:11

Usually this kind of integrals can be handled by making

\begin{align*} \int x^4e^{-x}\,\mathrm dx&=-x^4e^{-x} + (Ax^3+Bx^2+Cx+E)e^{-x} \end{align*} Where $A,\;B,\;C$, and $E$ are constants which satisfies $$x^4e^{-x}+(-4-A)x^3e^{-x}+(3A-B)x^2e^{-x}+(2B-C)xe^{-x}+(C-E)e^{-x}=x^4e^{-x}$$ So \begin{align*} -4-A&=0\\ 3A-B&=0\\ 2B-C&=0\\ C-E&=0 \end{align*} Then $A=-4$, $\;B=3A=-12$, $\;C=2B=-24$ and $E=C=-24$, then \begin{align*} \int x^4e^{-x}\,\mathrm dx&=-(x^4+4x^3+12x^2+24x+24)e^{-x}+K \end{align*} where $K$ is a constant.

Also, here is a more general problem related.

Here is a nice little trick to integrate it without using partial integration. $$\int x^4 e^{-x} \,\mathrm dx = \left. \frac{\mathrm d^4}{\mathrm d \alpha^4}\int e^{-\alpha x} \,\mathrm dx \right|_{\alpha=1} = \left.- \frac{\mathrm d^4}{\mathrm d \alpha^4} \frac{1}{\alpha} e^{-\alpha x}\right|_{\alpha=1}$$ The idea is to introduca a variable $\alpha$ in the exponent and write the $x^4$ term as the fourth derivative with respect to $\alpha$. This is especially helpful when you want to calculate the definite integral $\int_0^\infty$ because in this case the differentiation greatly simplifies. $$\int\limits_0^\infty x^n e^{-x} \,\mathrm dx = (-1)^n \left. \frac{\mathrm d^n}{\mathrm d \alpha^n} \frac{1}{\alpha} \right|_{\alpha=1} = n!\stackrel{n=4}{=} 24$$