# Math Help - Z-transform to solve difference equation

1. ## Z-transform to solve difference equation

Hello all hopefully you can be of help
I have to solve the following difference equation using z transforms

Xq+2 - 5Xq+1 +6Xq = 2

conditions Xo=0 and X1=1

Not to sure how to do it

so far i have took the z transforms and got

(z^2-z) -5zx + 6x = 2z/z-1

I'm not sure if this is correct but even if it is i have no idea of what to do next
Any help would be greatly appreciated

2. Just to clarify:

You're trying to solve

$x_{q+2}-5x_{q+1}+6x_{q}=2$,

subject to $x_{0}=0$, and $x_{1}=1$.

Is this correct?

3. Yes thats correct using z-transforms

4. There are different definitions of the z-transform: bilateral, unilateral, and geophysical. Which one are you using? I'm guessing unilateral?

5. yeah i believe its unilateral

6. So, when I take the z-transform of the difference equation, $x_{q+2}-5x_{q+1}+6x_{q}=2$, I get the following:

$z^{2}X(z)-5zX(z)+6X(z)=2z/(z-1)$.

As with most transform techniques, the next step is to solve the problem in the new domain (i.e., solve for $X(z)$), and then perform the inverse z-transform. You might need partial fraction decomposition.

7. Okay im still not 100% sure

But so far i've got it to this form

2z/(z-1)(z-3)(z-2)

Then using partial fractions got it to,

-4/z-2 +1/z-1 +3/z-3

You mention inverse z-transform, have i missed a stage? or am i heading in the right direction?

(sorry being vague very new to z-transforms)

Many thanks figured it out.

8. Hmm. You can do it that way. Looking ahead, it's a bit easier to work with terms that look like $1/(1-az^{-1})$. Try a partial fraction decomposition using that form. In other words, take your

$\frac{2z}{(z-1)(z-2)(z-3)}=\frac{2z^{-2}}{(1-z^{-1})(1-2z^{-1})(1-3z^{-1})}$, and expand it out that way.

9. If you're having difficulty expanding it out with $z^{-1}$'s in there, just substitute $y=z^{-1}$, expand it out in partial fractions, and then substitute back in for $z^{-1}$.

10. think i may have solved it
ended up with

-4(2^t) + 1 + 3(-3^t)

11. Hmm. That doesn't jibe with what RSolve gives me in Mathematica. Also, you want to be careful with your parentheses. What's being exponentiated?

I got the partial fraction expansion of

$\frac{1}{1-z^{-1}}-\frac{2}{1-2z^{-1}}+\frac{1}{1-3z^{-1}}$.

The inverse z-transform of this is

$1-C_{1}2^{q+1}+C_{2}3^{q}$.

Plugging in the initial conditions yields two simultaneous equations:

$0=1-2C_{1}+C_{2}$
$1=1-4C_{1}+3C_{2}$.

Solving gives $C_{1}=\frac{3}{2}$, and $C_{2}=2$. Plugging this into the expression above yields

$x_{q}=1-3\cdot 2^{q}+2\cdot 3^{q}$, which is what RSolve also yields.