TITLE: $a_n=(1-\frac{1}{n})a_{n-1}+\frac{1}{n}a_{n-2}$, $\lim_{n\to \infty}a_n$ is
QUESTION [5 upvotes]: Given $a_1,a_2,n\in \mathbb N$
$$a_n=(1-\frac{1}{n})a_{n-1}+\frac{1}{n}a_{n-2}$$
Then $\lim_{n\to \infty}a_n$ is
(A) $2(a_2-a_1)+a_1e^{-1}$
(B) $2(a_1-a_2)e^{-1}+a_2$
(C) $2(a_1-a_2)e^{-1}+a_1$
(D) $2(a_2-a_1)e^{-1}+a_1$
My attempt,
$a_1,a_2\in \mathbb N$
$$a_3=(1-\frac{1}{3})a_{2}+\frac{1}{3}a_{1}$$
$$a_4=(1-\frac{1}{4})a_{3}+\frac{1}{4}a_{2}$$ $$=(1-\frac{1}{4})((1-\frac{1}{3})a_{2}+\frac{1}{3}a_{1})+\frac{1}{4}a_{2}$$ $$=(1-\frac{1}{4})(1-\frac{1}{3})a_{2}+(1-\frac{1}{4})\frac{1}{3}a_{1}$$
$$a_5=(1-\frac{1}{5})a_{4}+\frac{1}{5}a_{3}$$ $$=(1-\frac{1}{5})((1-\frac{1}{4})(1-\frac{1}{3})a_{2}+(1-\frac{1}{4})\frac{1}{3}a_{1})+\frac{1}{5}((1-\frac{1}{3})a_{2}+\frac{1}{3}a_{1})$$ 
But I am not able to conclude from here, I couldn't able to generalise anything from here.

REPLY [7 votes]: Multiplying both sides of the equation by $n$ and rearranging, you get that: $$n(a_n-a_{n-1}) = -(a_{n-1}-a_{n-2})$$
Setting $b_n = a_n-a_{n-1}, n\geq 2$ and $b_1 =a_1$, this becomes: $$b_n = \frac{-1}{n}b_{n-1} = ... = (-1)^n\frac{2}{n!}b_2 =  (-1)^n\frac{2}{n!}(a_2-a_1),\text{ for } n \geq2.$$
So, $a_n = a_n-a_{n-1} + a_{n-1} - a_{n-2}+...-a_1+a_1 = \sum \limits_{i=1}^n b_i = a_1 + 2(a_2-a_1)\sum \limits_{i=2}^n \frac{(-1)^n}{n!}.$
It remains to calculate $\lim\limits_{n\rightarrow \infty}a_n = a_1+2(a_2-a_1)\sum \limits_{i=2}^\infty \frac{(-1)^n}{n!}.$ But this infinite series is the Taylor expansion of $e^x$ evaluated at $x=-1$.
So, the final answer is: $$\lim\limits_{n\rightarrow \infty}a_n =  a_1+2(a_2-a_1)e^{-1}.$$

REPLY [4 votes]: Let $f(x) = \sum_{n\geq 1} a_n x^n$. Then
\begin{align*}
(1-x) f'(x)
&= a_1 + (2a_2 - a_1) x + x \sum_{n \geq 1} ((n+2) a_{n+2} - (n+1) a_{n+1}) x^n \\
&= a_1 + (2a_2 - a_1) x + x \sum_{n \geq 1} a_n x^n \\
&= a_1 + (2a_2 - a_1) x + x f(x).
\end{align*}
This gives a first-order linear ODE, and solving this together with the initial condition $f(0) = 0$ gives
$$ f(x) = \frac{(2a_2 - a_1)x + 2(a_2 - a_1) (e^{-x} - 1)}{1-x}. $$
Comparing the coefficient of $x^n$ of both sides, we get
$$ a_n = 2a_2 - a_1 + 2(a_2 - a_1) \sum_{k=1}^{n} \frac{(-1)^{k}}{k!}. $$
As $n\to\infty$, this converges to
$$ \lim_{n\to\infty} a_n = 2a_2 - a_1 + 2(a_2 - a_1)(e^{-1} - 1) = 2(a_2 - a_1)e^{-1} + a_1. $$