Given $f(x) = x^n e^{-x}$, show that $\int_0^1 f(x)\, dx$ is equal to a given expression. Consider the function:
$$f : \mathbb{R} \rightarrow \mathbb{R} \hspace{2cm} f(x) = x^n e^{-x}$$
I have to show the following:
$$\int_0^1 f(x) dx = n! \bigg [ 1 - \dfrac{1}{e} \bigg ( 1 + \dfrac{1}{1!} + \dfrac{1}{2!} + \dfrac{1}{3!} + ... + \dfrac{1}{n!} \bigg ) \bigg ]$$
I used the notation:
$$I_n = \int_0^1 f(x)dx$$
And by integrating by parts I got the recurrence formula:
$$I_n = - \dfrac{1}{e} + n \cdot I_{n - 1}$$
But I don't have any idea as to how I could show what is asked.
 A: What you did is fine. And it is easy to see that $I_0=1-\frac1e$. On the other hand, if$$I_{n-1}=(n-1)!\left(1-\frac1e\left(1+\frac1{1!}+\frac1{2!}+\cdots+\frac1{(n-1)!}\right)\right),$$then\begin{align}I_n&=-\frac1e+nI_{n-1}\\&=-\frac1e+n\times(n-1)!\left(1-\frac1e\left(1+\frac1{1!}+\frac1{2!}+\cdots+\frac1{(n-1)!}\right)\right)\\&=-\frac1e+n!\left(1-\frac1e\left(1+\frac1{1!}+\frac1{2!}+\cdots+\frac1{(n-1)!}\right)\right)\\&=n!\left(1-\frac1{n!e}-\frac1e\left(1+\frac1{1!}+\frac1{2!}+\cdots+\frac1{(n-1)!}\right)\right)\\&=\left(1-\frac1e\left(1+\frac1{1!}+\frac1{2!}+\cdots+\frac1{(n-1)!}+\frac1{n!}\right)\right).\end{align}
A: My intuition first goes to repeated substitution:
$$ \begin{split}
I_n &= - \frac 1 e + n\left(-\frac 1e + (n-1) \left(-\frac 1e+\dots\right) \right) \\ &= -\frac 1e - \frac n e - \frac{n(n-1)}e - \dots - \frac{n(n-1)\cdots (2)}e + n! I_0.
\end{split}$$
Direct computation of $I_0$ and collecting $n!$ results in the formula you want.
Otherwise, you may show that the closed formula satisfies the recursion and be done by the axiom of induction.
A: Clearly, the answer is true for $n=0$. 
Now supposing it is true for $n-1$, let us prove for $n$. 
We know thaf $I_n=-\frac{1}{e}+n\cdot I_{n-1}$. 
Expand that out to see that $$I_n=-n!\frac{1}{n!e}+n!(1-\frac{1}{e}(1+...+\frac{1}{(n-1)!}))$$.
Take the common terms, and we see the statement holds for $n$ as well, and we have completed our proof. 
A: Let
$$n!J_n=I_n=-\frac1e+nI_{n-1}=-\frac1e+n(n-1)!J_{n-1}=-\frac1e+n!J_{n-1}$$
Then
$$\begin{align}\sum_{k=1}^n(J_k-J_{k-1})&=\sum_{k=1}^{n-1}J_k+J_n-J_0-\sum_{k=2}^nJ_{k-1}=J_n-J_0=J_n-\frac1{0!}I_0\\
&=J_n-\int_0^1e^{-x}dx=J_n\left.+e^{-x}\right|_0^1=\frac1{n!}I_n+e^{-1}-1\\
&=\sum_{k=1}^n\left(-\frac1e\frac1{k!}\right)\end{align}$$
So
$$I_n=n!\left(1-\frac1e\sum_{k=0}^n\frac1{k!}\right)$$
Similar to the other proofs but I think introduction of the intermediate variable $J_n$ turning the problem into a telescoping sum results in less complicated expressions and a cleaner proof.
A: You could take the integral directly and square off with it. Integration by parts yields:
$=\displaystyle -x^ne^{-x}-\int -nx^{n-1}e^{-x}$
$=\displaystyle -x^ne^{-x}+\int nx^{n-1}e^{-x}$
$=\displaystyle -x^ne^{-x}+(-nx^{n-1}e^{-x}+\int n(n-1)x^{n-2}e^{-x})$
$=\displaystyle -x^ne^{-x}-nx^{n-1}e^{-x}-n(n-1)x^{n-2}e^{-x}-n(n-1)(n-2)x^{n-3}e^{-x} \ldots -n! \cdot xe^{-x}-n! \cdot e^{-x}$
$=\displaystyle -e^{-x}(x^n+nx^{n-1}-nx^{n-1}-n(n-1)x^{n-2}-n(n-1)(n-2)x^{n-3} \ldots -n! \cdot x-n!)$
$=\displaystyle -e^{-x} \cdot {\sum_{k=0}^n \dfrac{n!}{(n-k)!}x^{n-k}} + c$
So that's the best way I could write the indefinite integral. Evaluating it for 0 and 1 becomes:
$=-\dfrac{1}{e} \cdot (\displaystyle \sum_{k=0}^n \dfrac{n!}{(n-k)!})-(-1 \cdot (\sum_{k=0}^{n-1} \dfrac{n!}{(n-k)!} \cdot 0+n! \cdot e^{-0}))$
Let me emphasize that last part where I changed the sum. The last term does not have an $x$ term like the others so is not necessarily herded off to $0$ like the others.
$=-\dfrac{1}{e} \cdot (\sum_{k=0}^n \dfrac{n!}{(n-k)!})+n!$
$=-\dfrac{1}{e}(\dfrac{n!}{0!}+\dfrac{n!}{1!}+\dfrac{n!}{2!} \cdots \dfrac{n!}{(n-1)!}+\dfrac{n!}{n!})+n!$
$\text{And robbing everyone of a factorial gives:}$
$n! \bigg [ 1 - \dfrac{1}{e} \bigg ( 1 + \dfrac{1}{1!} + \dfrac{1}{2!} + \dfrac{1}{3!} + ... + \dfrac{1}{n!} \bigg ) \bigg ]$
