Computing the following integral: \begin{equation*} I_n = \int_0^1 x^n e^x \: dx, \end{equation*} using the forward recursive formula \begin{align} I_0 &= e-1 \\ I_{n} &= e - n I_{n-1} \end{align} is an unstable calculation. Here we will consider a different approach that is stable.
Solve Equation (2) for $I_{n-1}$ to give a backwards recursive formula (one that expresses $I_{n-1}$ as a function of $I_n$).
$I_{n-1} = \frac{e-I_{n}}{n}$
Running both the recursion formulas in my MatLab program gives the following results
the unstable recursion the rewritten stable recursion
What I don't know how to answer is why does the backward recursive formula work so much better than the forward recursive formula? What is happening to the numerical error?