# Solving an inhomogeneous difference equation

Consider the following difference equation: $$-(1+a)u_{i-1} + 2 u_i - (1-a) u_{i+1} - \frac{h^2}{\epsilon} = 0, \; i = 1, ..., N, \tag{1}$$ $$u_0 = 0, \; u_N = 1.$$

Can someone explain me how to solve this equation?

I read somewhere the following method:

1) Solve the homogeneous equation;

2) Find a particular solution of inhomogeneous equation (1);

3)The general solution of (1) is the sum of the particular solution and the solution of homogeneous equation.

Is this method right?

I can't find a particular solution of equation (1). Can someone help me?

Thank you!

Note that (1) can be written as $$(1+a)(u_i-u_{i-1})- (1-a)(u_{i+1}-u_i) = \frac{h^2}{\epsilon}. \tag{2}$$ Let $v_i=u_i-u_{i-1}$ and then (2) becomes $$(1+a)v_i- (1-a)v_{i+1} = \frac{h^2}{\epsilon} = 0$$ or $$(1+a)\left(v_i-\frac{h^2}{2a\epsilon}\right)=(1-a)\left(v_{i+1}-\frac{h^2}{2a\epsilon}\right)$$ or $$v_{i+1}-\frac{h^2}{2a\epsilon}=\frac{1+a}{1-a}\left(v_i-\frac{h^2}{2a\epsilon}\right)\tag{3}$$ From (3), one obtains $$v_i-\frac{h^2}{2a\epsilon}=\left(v_1-\frac{h^2}{2a\epsilon}\right)\left(\frac{1+a}{1-a}\right)^{i-1}=\left(u_1-\frac{h^2}{2a\epsilon}\right)\left(\frac{1+a}{1-a}\right)^{i-1}.$$ Thus \begin{eqnarray} u_i&=&\sum_{k=1}^i(u_k-u_{k-1})+u_0\\ &=&\sum_{k=1}^iv_i\\ &=&\sum_{k=1}^i\left[\frac{h^2}{2a\epsilon}+\left(u_1-\frac{h^2}{2a\epsilon}\right)\left(\frac{1+a}{1-a}\right)^{i-1}\right]\\ &=&\frac{h^2}{2a\epsilon}i+\left(u_1-\frac{h^2}{2a\epsilon}\right)\frac{1-\left(\frac{1+a}{1-a}\right)^{i}}{1-\frac{1+a}{1-a}}\\ &=&\frac{h^2}{2a\epsilon}i-\frac{1-a}{2a}\left(u_1-\frac{h^2}{2a\epsilon}\right)\left[1-\left(\frac{1+a}{1-a}\right)^{i}\right]. \end{eqnarray} Using $u_N=1$, one can determine $u_1$ and I omit the detail.
• I didn't understand why does $$v_i-\frac{h^2}{2a\epsilon}=\left(v_1-\frac{h^2}{2a\epsilon}\right)\left(\frac{1+a}{1-a}\right)^{i-1}=\left(u_1-\frac{h^2}{2a\epsilon}\right)\left(\frac{1+a}{1-a}\right)^{i-1}.$$ result from (3). Can you give me more details? Thank you! – g.pomegranate Nov 30 '16 at 18:18
• @g.pomegranate, this is because, if $a_{i+1}=qa_i$, then $a_i=a_1q^{i-1}$. $q$ is called the common ratio. – xpaul Nov 30 '16 at 18:34