Integral of the product $x^n e^x$ I would be very pleased if you could give me your opinion about this way of integrating the following expression. I think that it has no issues, but just wanted to confirm:
$$ \int x^n e^x dx $$
$$ e^x = u $$
$$ e^x dx = du $$
$$ \int x^n e^x dx = \int \ln(u)^n du = nu(\ln(u) - 1) + C $$
$$ \int x^n e^xdx = ne^x (x-1) + C $$
Many thanks!

Here is one way to proceed.  Note that
$$\begin{align}
\int x^ne^x\,dx&=\left.\left(\frac{d^n}{da^n}\int e^{ax}\,dx\right)\right|_{a=1}\\\\
&=\left.\left(\frac{d^n}{da^n}\frac{e^{ax}}{a}\right)\right|_{a=1}\\\\
&=\left.\left(\sum_{k=0}^n\binom{n}{k}\frac{d^k a^{-1}}{da^k}\frac{d^{n-k} e^{ax}}{da^{n-k}}\right)\right|_{a=1}\\\\
&=e^x\sum_{k=0}^n (-1)^k \left(\binom{n}{k}\,k!\right)x^{n-k}\\\\
&=e^x\left(x^n+\sum_{k=1}^n (-1)^n\left(n(n-1)(n-2)\cdots (n-k+1)\right)x^{n-k}\right)
\end{align}$$
which gives the explicit form of the polynomial, $p(x)$, as discussed in the post by egreg.
