# Deriving difference equation from a rational system function $H(z)$

If I have the system function $H(z)$ of a linear time-invariant system, how do I derive the difference equation relating its input $x(n)$ and output $y(n)$? The system function is given by

$$H(z) = \frac{1-\frac{1}{2}z^{-1}}{(1-\frac{1}{4}z^{-1})(1-\frac{1}{2}e^{i\frac{\pi}{4}}{4}z^{-1})(1-\frac{1}{2}e^{-i\frac{\pi}{4}}{4}z^{-1})}$$

Edit: All I know is that $\displaystyle H(z) = \frac{Y(z)}{X(z)}$

I think there must be a shortcut to solving this, because plugging the denominator into the inverse $z$-transform and solving directly is not something I have the required math background for.

• By the way, when I tried to tag this as 'difference equations' it suggested recurrence-relations, although I'm not familiar with that term to be honest – Austin Dec 9 '15 at 23:01
• Do you know what is the relationship between $X(z)$, $Y(z)$ and $H(z)$? – Carlos Mendoza Dec 10 '15 at 4:44
• Yeah, that's the only thing I know. H = Y/X – Austin Dec 10 '15 at 4:45
• Have you tried to use it? – Carlos Mendoza Dec 10 '15 at 4:47
• I dont know enough math to just plug that denominator into the inverse z transform so I figured there had to be a shortcut I wasn't seeing – Austin Dec 10 '15 at 12:04

$$H(z) = \frac{Y(z)}{X(z)} = \frac{1-\frac{1}{2}z^{-1}}{(1-\frac{1}{4}z^{-1})(1-\frac{1}{2}e^{i\frac{\pi}{4}}{4}z^{-1})(1-\frac{1}{2}e^{-i\frac{\pi}{4}}{4}z^{-1})}$$

If you expand the denominator, you will get something like this:

$$\begin{gather} \left(1-\frac{1}{4}z^{-1}\right)\left(1-\frac{1}{2}e^{i\frac{\pi}{4}}{4}z^{-1}\right)\left(1-\frac{1}{2}e^{-i\frac{\pi}{4}}{4}z^{-1}\right)\\ \left(1-\frac{1}{4}z^{-1}\right)\left(1-\frac{1}{2}e^{i\frac{\pi}{4}}{4}z^{-1}-\frac{1}{2}e^{-i\frac{\pi}{4}}{4}z^{-1}+4z^{-2}\right)\\ \left(1-\frac{1}{4}z^{-1}\right)\left(1-4\left(\frac{e^{i\frac{\pi}{4}}+e^{-i\frac{\pi}{4}}}{2}\right)z^{-1}+4z^{-2}\right)\\ \left(1-\frac{1}{4}z^{-1}\right)\left(1-4\cos(\pi/4)z^{-1}+4z^{-2}\right)\\ 1-4\cos(\pi/4)z^{-1}+4z^{-2}-\frac{1}{4}z^{-1}+\cos(\pi/4)z^{-2}-z^{3} \end{gather}$$

Which finally results in:

$$1-\frac{(1+8\sqrt{2})}{4}z^{-1}+\frac{(8+\sqrt{2})}{2}z^{-2}-z^{-3}$$

So, you have the Z-transformed Difference Equation:

$$Y(z)\left[1-\frac{(1+8\sqrt{2})}{4}z^{-1}+\frac{(8+\sqrt{2})}{2}z^{-2}-z^{-3}\right]=X(z)\left[1-\frac{1}{2}z^{-1}\right]$$

And its inverse:

$$y[n]-3.0784y[n-1]+4.7071y[n-2]-y[n-3]=x[n]-0.5x[n-1]$$