I have a difference equation

$$y[n] = y[n-1] + 0.5x[n] - 0.5x[n-2] \text{.}$$

According to this answer, the filter should have finite impulse response. I just can't figure out how to get the FIR filter coefficients. I tried to use the transfer function.

$$Y(z) - Y(z)z^{-1} = 0.5X(z) - 0.5X(z)z^{-2}$$

$$H(z) = \frac{Y(z)}{X(z)} = \frac{0.5 - 0.5z^{-2}}{1-z^{-1}}$$

But here I got stuck. Can anyone tell me how to make this a non-recursive implementation?


2 Answers 2


You can simplify the z-transform further,

$ H(z) = \frac{Y(z)}{X(z)}= \frac{0.5-0.5z^{-2}}{1-z^{-1}}$

$ H(z) = \frac{(1-z^{-1})(1+z^{-1})}{2(1-z^{-1})} $

canceling the common pole and zero

$ H(z) = \frac {1+z^{-1}}{2}$

take inverse z-transform

$ Y(n) = \frac{x(n)+x(n-1)}{2} $

  • $\begingroup$ How simple. I wouldn't figure out that the polynomial could be factorized. $\endgroup$
    – DaBler
    Commented Jun 6, 2021 at 12:10

There is already a good answer, but here is some extra explanation.

This is called "pole/zero cancellation". That means you have a pole, say, $z_p$ but you also have a zero at $z_p$ so the zero cancels the pole.

One particular example where this can be useful is a moving average filter of length $N$, The transfer function is

$$H(z) = \frac{1}{N} \sum_{n=0}^{N-1} z^{-n} = \frac{1}{N} \cdot \frac{1-z^{-N}}{1-z^{-1}}$$

That makes the difference equation

$$y[n] = \frac{1}{N}\sum_{k=0}^{N-1} x[n-k] = y[n-1] + \frac{1}{N} (x[n]-x[n-N])$$

The FIR form of the difference equation has $N$ coefficients, but the IIR form with pole cancelation has only three non-zero coefficients, so it's often more efficient to implement it that way.

  • $\begingroup$ That was interesting but did you mean minus rather than equals in the last equals ? $\endgroup$
    – mark leeds
    Commented Jun 6, 2021 at 13:48
  • $\begingroup$ Yes, or course. Thanks for pointing it out. Fixed. $\endgroup$
    – Hilmar
    Commented Jun 6, 2021 at 14:55
  • $\begingroup$ i think it's called "pole-zero cancellation", ain't it, Hil? $\endgroup$ Commented Jun 6, 2021 at 16:36
  • $\begingroup$ Fixed. I've seen both terms used. $\endgroup$
    – Hilmar
    Commented Jun 6, 2021 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.