# 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$.

-
In your third term in your difference equation, did you mean $U_{n-1}$? –  Cameron Williams Jul 4 at 18:19
If you want to verify a solution you already have, just substitute it in the equation and check it is true, and also check the initial conditions. –  ABC Jul 4 at 18:39
Note that the homogeneous equation has solution $U_n=1$, equivalently you have a solution $w_1=1$. This makes life a lot easier. –  Mark Bennet Jul 4 at 18:39
@CameronWilliams, yes and thanks for that. –  Vaolter Jul 5 at 7:40
@MarkBennet, could you elaborate. –  Vaolter Jul 5 at 7:42
show 1 more comment