1. ## Difference Equations

I have the following question:

Find the solution to the difference equation

$\displaystyle y(t) - \frac{1}{4}y(t-2) = 0$
Under initial conditions $\displaystyle y(-1) = 1$ and $\displaystyle y(-2) = 0$

I can't for the life of me remember how to do these, I've looked through my notes and got nothing. I understand how to do PDE's but I'm not sure what a difference equation is??

Any help would be great

p.s. Is there a way of solving this in MATLAB?

2. Originally Posted by jezzyjez
I have the following question:

Find the solution to the difference equation

$\displaystyle y(t) - \frac{1}{4}y(t-2) = 0$
Under initial conditions $\displaystyle y(-1) = 1$ and $\displaystyle y(-2) = 0$

I can't for the life of me remember how to do these, I've looked through my notes and got nothing. I understand how to do PDE's but I'm not sure what a difference equation is??

Any help would be great

p.s. Is there a way of solving this in MATLAB?
Well, just start by writing down some numbers:
Y(-2)= 0
Y(-1)= 1
Y(0)- (1/4)Y(0-2)= 0 so Y(0)- (1/4)0= 0, Y(0)= 0.
Y(1)- (1/4)Y(1-2)= 0 so Y(1)- 1/4= 0, Y(1)= 1/4.
Y(2)- (1/4)Y(2-2)= 0 so Y(2)- 0= 0, y(2)= 0.
Y(3)- (1/4)Y(1)= 0 so Y(3)- 1/16= 0, Y(3)= 1/16= 1/(4^2).
Y(4)- (1/4)Y(2)= 0 so Y(4)- 0= 0, Y(4)= 0.
Y(5)- (1/5)Y(3)= 0 so Y(5)- 1/4^2= 0, Y(5)= 1/4^3

Get the idea? This clearly gives two different formulas, one for even indices, the other for odd.

3. Let's write the DE in a more 'usual' form...

$\displaystyle y_{n+2} = \frac{1}{4}\cdot y_{n}$ , $\displaystyle y_{0}=0 , y_{1} = 1$ (1)

It is fully evident from (1) that the solution is the combination of two interleaved sequences, one for n even and one for n odd, and both tend to 0...

$\displaystyle y_{n} = 0,1,0,\frac{1}{4}, 0,\frac{1}{16}, \dots$ (2)

Kind regards

$\displaystyle \chi$ $\displaystyle \sigma$

4. Originally Posted by jezzyjez
I have the following question:

Find the solution to the difference equation

$\displaystyle y(t) - \frac{1}{4}y(t-2) = 0$
Under initial conditions $\displaystyle y(-1) = 1$ and $\displaystyle y(-2) = 0$

I can't for the life of me remember how to do these, I've looked through my notes and got nothing. I understand how to do PDE's but I'm not sure what a difference equation is??
A difference equation is an equation the solution of which is a sequence. So it might be a bit more suggestive to write your equation like this: $\displaystyle y_n-\frac{1}{4}y_{n-2}=0$

Instead of the differential operator you have the "shift operator" (that shifts the sequence by a certain fixed number of places). So your difference equation is a homoegenous second-order linear difference equation.
Because it is linear and homogeneous the general solution is a linear combination of certain base solutions. The base solutions can be found by setting $\displaystyle y_n := z^n$, and pluging this into your equation:

$\displaystyle z^n -\frac{1}{4}z^{n-2}=0$, the non-trivial solutions of which are $\displaystyle z_{1,2}=\pm \frac{1}{2}$.
Thus the general solution of your homogeneous linear difference equation is $\displaystyle y_n = c_1 \left(\frac{1}{2}\right)^n+c_2\left(-\frac{1}{2}\right)^n$.
Now bring in the "initial conditions" to figure out what $\displaystyle c_{1,2}$ should be...

Is there a way of solving this in MATLAB?
I don't know MATLAB well enough to tell, but most CAS systems do have solvers for difference equations. Typically they are variants of a general solve() procedure.

5. Originally Posted by Failure
A difference equation is an equation the solution of which is a sequence. So it might be a bit more suggestive to write your equation like this: $\displaystyle y_n-\frac{1}{4}y_{n-2}=0$

Instead of the differential operator you have the "shift operator" (that shifts the sequence by a certain fixed number of places). So your difference equation is a homoegenous second-order linear difference equation.
Because it is linear and homogeneous the general solution is a linear combination of certain base solutions. The base solutions can be found by setting $\displaystyle y_n := z^n$, and pluging this into your equation:

$\displaystyle z^n -\frac{1}{4}z^{n-2}=0$, the non-trivial solutions of which are $\displaystyle z_{1,2}=\pm \frac{1}{2}$.
Thus the general solution of your homogeneous linear difference equation is $\displaystyle y_n = c_1 \left(\frac{1}{2}\right)^n+c_2\left(-\frac{1}{2}\right)^n$.
Now bring in the "initial conditions" to figure out what $\displaystyle c_{1,2}$ should be...

Ok I put in the two initial conditions:

$\displaystyle y(-1) = c_1 (\frac{1}{2}) ^{-1} + c_2 (-\frac{1}{2})^ {-1}$

This gives me

$\displaystyle 2c_1 - 2c_2 = 1$

Solving the other one I get

$\displaystyle 4c_1 - 4c_2 = 0$

which I cant solve as it says the constants are equal in the second one. And that they are not equal in the first???

6. Originally Posted by jezzyjez
Ok I put in the two initial conditions:

$\displaystyle y(-1) = c_1 (\frac{1}{2}) ^{-1} + c_2 (-\frac{1}{2})^ {-1}$

This gives me

$\displaystyle 2c_1 - 2c_2 = 1$

Solving the other one I get

$\displaystyle 4c_1 {\color{red}-} 4c_2 = 0$
No, what you get is $\displaystyle y(-2)=4c_1{\color{red}+}4c_2= 0$, and it follows that $\displaystyle c_1=\frac{1}{4}, c_2 = -\frac{1}{4}$.