# Difference equation

1. Oct 21, 2005

### Benny

I am currently struggling to solve Difference equations (especially the first order ones). Here is a 'simple' one which I cannot get the correct answer to despite trying many times. Here is what I think is my most decent attempt.
$$2y_{n + 1} = y_n + 2$$
Rearranging gives $$y_{n + 1} = \frac{1}{2}y_n + 1$$.
Iterating: $$y_1 = \frac{1}{2}y_0 + 1,y_2 = \frac{1}{2}y_1 + 1 = \left( {\frac{1}{2}} \right)^2 y_0 + 1 + \frac{1}{2}$$
$$\Rightarrow y_n = \left( {\frac{1}{2}} \right)^n y_0 + \sum\limits_{i = 0}^{n - 1} {\left( {\frac{1}{2}} \right)} ^i$$
$$= \left( {\frac{1}{2}} \right)^n y_0 + \sum\limits_{i = 0}^n {\left( {\frac{1}{2}} \right)} ^i - \left( {\frac{1}{2}} \right)^n$$
$$= \left( {\frac{1}{2}} \right)^n y_0 + \frac{{1 - \left( {\frac{1}{2}} \right)^{n + 1} }}{{1 - \frac{1}{2}}} - \left( {\frac{1}{2}} \right)^n$$
$$= \left( {\frac{1}{2}} \right)^n y_0 + 2 - \left( {\frac{1}{2}} \right)^n - \left( {\frac{1}{2}} \right)^n$$
The answer is what I obtained except without the two subtracted (1/2)^n terms at the end. By the way is there a way to solve first order difference equations without using an iterative approach like the one I used? Any help would be good thanks.

Edit: Hmm I just realised that I could've the substitution y_n = lambda^n to find the solution to homogeneous equation and then set y_n = constant to find particular solution. However I would still like to know how to do it through the summation method I used. Any help or suggestions for alternative solutions would be good thanks.

Last edited: Oct 21, 2005
2. Oct 21, 2005

### HallsofIvy

Staff Emeritus
No, that's wrong. If
$$y_n = \left( {\frac{1}{2}} \right)^n y_0 + \sum\limits_{i = 0}^{n - 1} {\left( {\frac{1}{2}} \right)} ^i$$$$y_1 = \frac{1}{2}y_0 + 1$$
alright but then $$y_2= \frac{1}{2}y_1+ 1= \frac{1/2}\frac{1}{2}y_0+ \frac{1/2}+ 1= \left(\frac{1}{2}\right)^2y_0+ \frac{3}{2}$$

Last edited: Oct 21, 2005
3. Oct 21, 2005

### Tide

Try setting $y_n = z_n + 2$.

(EDIT: Corrected constant.)

Last edited: Oct 22, 2005
4. Oct 21, 2005

### Benny

I don't understand which part you are saying is wrong. I know that my initial answer is incorrect but it seems to fit in with what I'm getting.

$$y_1 \equiv \left( {\frac{1}{2}} \right)y_0 + 1$$ from y_(n+1) = (1/2)y_(n) + 1

$$y_2 \equiv \left( {\frac{1}{2}} \right)y_1 + 1 = \left( {\frac{1}{2}} \right)\left[ {\left( {\frac{1}{2}} \right)y_0 + 1} \right] + 1 = \left( {\frac{1}{2}} \right)^2 y_0 + 1 + \frac{1}{2}$$

If $$y_n = \left( {\frac{1}{2}} \right)^n y_0 + \sum\limits_{i = 0}^{n - 1} {\left( {\frac{1}{2}} \right)^i }$$ then:

$$y_1 = \left( {\frac{1}{2}} \right)y_0 + \sum\limits_{i = 0}^{1 - 1} {\left( {\frac{1}{2}} \right)^i } = \left( {\frac{1}{2}} \right)y_0 + 1$$

Ok that seems right. Set n = 2 and what happens?

$$y_2 = \left( {\frac{1}{2}} \right)^2 y_0 + \sum\limits_{i = 0}^{2 - 1} {\left( {\frac{1}{2}} \right)^i } = \left( {\frac{1}{2}} \right)^2 y_0 + \sum\limits_{i = 0}^1 {\left( {\frac{1}{2}} \right)^i } = \left( {\frac{1}{2}} \right)^2 y_0 + 1 + \frac{1}{2}$$

As before.

So if instead of using my formula and I simply interated I would get the same answer.

It is absolutely incorrect to 'replace' y_0 by y_1 in the first formula that I found. I know what the my formula is not correct but I don't see how it doesn't fit in with what I found.

Tide - Thanks for the help but if possible could you please explain the motivation behind that substitution?

5. Oct 22, 2005

### Tide

Benny,

Quite simple but I did type in the wrong number in my original post - which I'll edit. (The correct substitution is $y_n = z_n + 2$)

If you didn't have that +1 on the right side of your original equation then you would have a difference equation for a simple geometric series. Is there a way of eliminating the +1? Yes, try $y_n = z_n + A$ and find out whether there is any value of A that gets rid of the +1.

Making the substitution gives $z_n + A = \frac {1}{2}z_n + \frac{1}{2} A + 1$. Therefore, if $A = 2$ we have $z_{n+1} = \frac{1}{2}z_n$ which is very easily solved. Don't forget to replace $z_n$ with $y_n - 2$ to find the required solution.

Last edited: Oct 22, 2005
6. Oct 22, 2005

### Benny

Oh ok, I see what you did now. It seems kind of like setting y_n = C and then solving for C.

7. Oct 22, 2005

### Tide

Benny,

My typing fingers aren't working right today! This is the equation you get after making the substitution:

$$z_{n+1} = \frac{1}{2}z_n$$

I had mistyped n instead of n+1 for the index on the left side.

8. Oct 22, 2005

### Benny

Thanks, I figured that it's what you meant to type before.

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook