solution of difference equation I am trying to solve the following difference equation:
$$-\frac{\epsilon}{h^2}U_{n+1}+\left(\frac{2\epsilon}{h^2}+\frac{1}{h}\right)U_{n}-\left(\frac{\epsilon}{h^2}+\frac{1}{h}\right)U_{n-1}=0,\mbox{ }\mbox{ }\mbox{ }\mbox{ }U_0=1,\mbox{ }U_1=0.$$
I try $U_{n}=Aw^n$ then I get
$$w_{1,2}=\frac{\left(\frac{2\epsilon}{h^2}+\frac{1}{h}\right)\pm\sqrt{\left(\frac{2\epsilon}{h^2}+\frac{1}{h}\right)^2-4\frac{\epsilon}{h^2}\left(\frac{\epsilon}{h^2}+\frac{1}{h}\right)}}{2\frac{\epsilon}{h^2}}.$$
This seems a bit far from what I want to get. I am trying to verify that the solution is
$$U_n=\dfrac{1-(1+\rho)^{n-N}}{1-(1+\rho)^{-N}},$$
where $0\leq n\leq N$ and $\rho=h/\epsilon$.

First of all note that, inside the square root, we have
$$
\left(\frac{2\epsilon}{h^2}+\frac{1}{h}\right)^2-4\frac{\epsilon}{h^2}\left(\frac{\epsilon}{h^2}+\frac{1}{h}\right) = \frac{1}{h^2}
$$
So the answers read
$$w_{1,2}=\frac{\left(\frac{2\epsilon}{h^2}+\frac{1}{h}\right)\pm \frac{1}{h}}{2\frac{\epsilon}{h^2}}.
\Longrightarrow w_1=1, w_2=1+\frac{h}{\epsilon}
$$
This means that the solution reads $U_n=A+B(1+\rho)^n$. Now let us impose boundary conditions . Since $U_0=1$, we get that $A+B=1$. Also, since $U_1=0$, we get that $A+B(1+\rho)=0$ or equivalently, $A=-(1+\rho)B$. Plugging this into the first equation, we get that $B=\frac{-1}{\rho}$, and that $A=\frac{1+\rho}{\rho}$, leading to a solution of the form 
$$U_n=\frac{1+\rho}{\rho} \bigg[ 1-(1+\rho)^{n-1} \bigg].
$$
We can readily check that for $n=1$, we get $U_1=0$, and $n=0$, we get $U_0=1$. 
bBut this is not what you are trying to recover. Your desired answer has $N$ in it, which is defined nowhere in the statement of the problem. My conjecture is that, $n$ is limited to the range $0,N$. 
Let us now consider the following set of boundary conditions: 
$$U_0=1,U_N=0$$
Imposing the first condition on  $U_n=A+B(1+\rho)^n$, we get $A+B=1$. Imposing the second condition, we get $A+B(1+\rho)^N=0$, which can be equivalently expressed as $A=-B(1+\rho)^N$. Plugging this into the first equation, we obtain $B=\frac{1}{1-(1+\rho)^N}$
. Also for $A$ we obtain $A=\frac{ -(1+\rho)^N}{1-(1+\rho)^N}$. 
For the solution, we use the values of $A,B$ obtained above, and arrive at
$$
U_n=\frac{(1+\rho)^n-(1+\rho)^N}{1-(1+\rho)^N}$$
Dividing both the numerator and the denominator by $-(1+\rho)^N$, we arrive at
$$
U_n=\frac{1-(1+\rho)^{n-N}}{1-(1+\rho)^{-N}}$$
