# Difference equation solution

1. May 3, 2015

### zoom1

1. The problem statement, all variables and given/known data
Given the following difference equation;
x(k+2)-x(k+1)+0.25x(k)=u(k+2)

where

x(0)=1; x(1)=2; u(k)= 1 for k=1,2,3,…

2. Relevant equations
Z- transformation

3. The attempt at a solution

To be able to solve this difference equation, I think I need to transform it into z domain then after some manipulations I need to convert it back to discrete time signal.

Here's my attemp

z2 X(z) - z2 X(0) - zX(1) - [zX(z) - zX(0) ] + 0.25X(z) = z2 [z/(z-1)]

u(k+2) is the step input. Transformation of step is z/(z-1). However, I'm not sure about the transformation of u(k+2)

Even if it is z2 [z/(z-1)], I couldn't proceed further with the equation I obtained.

I would appreciate any help

2. May 3, 2015

### vela

Staff Emeritus
Isn't u(k)=1 for k=0 too?

Try applying the definition of the z-transform to u(k+2).

3. May 3, 2015

### zoom1

Yes, it is. My mistake sorry.

I think it should be z2 [z/(z-1)] but I'm not sure

4. May 3, 2015

### vela

Staff Emeritus
That's why I'm suggesting you apply the definition of the z-transform and derive the result.

5. May 3, 2015

### zoom1

If u is equal to 1 for every k values, it is a step function and then z/(z-1) should be the z-transform. Am I correct ?

6. May 3, 2015

### vela

Staff Emeritus
By "u", do you mean u(k) or u(k+2)?

7. May 3, 2015

### zoom1

Actually that's the point confusing me. u(k+2) is there in the equation. However, When I start plugging values for k, starting from 0, I will always get 1. So, I would treat u(k+2) as step function and take its inverse z transform as z/(z-1)

8. May 3, 2015

### vela

Staff Emeritus
That's right. You have
$$\sum_{k=0}^\infty u(k+2)z^{-k} = \sum_{k=0}^\infty z^{-k}.$$ Because you're using the unilateral z-transform, the shift ends up having no effect on the righthand side.

9. May 7, 2015

### rude man

You may or may not be aware that there is also a "classical" way to solve finite-difference equations, analogous to the classical (non-transform) way to solve ODE's.
However, I would stick with the z transform.