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

Solution 1:

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$$

Solution 2:

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.