# Distinguishing FIR and IIR from difference equation

Find the transfer function of the difference equation $$y_n = x_n + 1.2y_{n-1}$$

I fail to understand how one can distinguish between an FIR filter and an IIR filter by looking at the equation given above.

How to find if an IIR or a FIR filter is stable from the transfer function?

$$H(z) = \frac{y(z)}{x(z)}$$

$$x_n = y_n-1.2y_{n-1}$$

$$x(z) = y(z)-1.2z^{-1}y(z)$$

$$H(z) = \frac{y(z)}{y(z) -1.2z^{-1}y(z)}$$

$$H(z) = \frac{z}{z-1.2}$$

Thus we arrive at the transfer function.

I am a week into signal processing. Any suggestions and tips appreciated. Please forgive my mistakes.

• Similar question answered. In a nutshell, a filter which does not depend on past outputs will always be an FIR. However, a filter which depends on past outputs might be either FIR or IIR. The only way to tell is to calculate the Impulse response and see if it’s finite. – jojek Apr 20 '18 at 17:33

By looking only at the equation in '$n$' variable, the filter might be IIR if it depends on earlier outputs $y$. If it does not, it certainly is FIR.

The system output $y[n]$ might depend on earlier outputs but still be FIR, since FIR means that its impulse response $h[n]$ is finite. When calculating the $H(z)$, sometimes a pole (coming from earlier outputs '$y$') could get canceled out by a zero (coming from earlier inputs '$x$').

By looking at the $H(z)$, you can say that if it has poles only in $z=0$, then it is FIR. If it has poles somewhere else, it is IIR.

Regarding stability, if the filter is FIR, it will always be stable (all its poles are in $z=0$). If it is IIR, as VMMF has already pointed out, check the region of convergence (usually, if you are working with causal impulse responses, then you need to guarantee that all poles lay inside the unit circle)

• i think it is important what Axel is pointing out. there is a class of FIR filters called "Truncated IIR" filters which have an IIR inside of them, but the input-output relationship is FIR. and, as Axel says, it's because of pole-zero cancellation. the moving average (or moving sum) is a simple example of a TIIR. – robert bristow-johnson Apr 18 '18 at 11:43
• Oh yes! Thank you very much Axel and Robert for pointing this out! Even though I said in general in my answer, this specific example is very useful to have in mind – VMMF Apr 18 '18 at 13:31

Welcome to DSP! First of all I would recommend reading chapter 2, specially 2.2 to 2.5 of Discrete Time Signal Processing 3rd edition by Oppenheim and Schafer. Then 3.2 and 5.2 of that very same book.

About your question. Well, in general (see comments on Axel answer for an exception) if you see an equation which depends on past output terms, like $1.2*y [n−1]$ in your equation then it is an IIR system. If it only depends on current, past or future inputs, it is an FIR system.

If it is an FIR system, you may determine stability, causality, linearity and time invariance from the Linear Constant Coefficient Difference Equation. However, if it is an IIR system, unless initial conditions are given to you, there's no way you could prove any of these because you don't know the value of the past output the first time you are going to "use" the system and it could determine whether it behaves one way or another.

For a system for which the input and output satisfy a linear constant coefficient difference equation, if the initial condition is that the system is initially at rest, then the system will be linear, time invariant, and causal. For stability analyze the Region of Convergence of the $Z$ transform and make sure it includes the unit circle

To determine the stability of the specific transfer function of your example, and considering the contribution of VMMF above, I would add the following:

Initial conditions must be provided for this IIR system. Assuming that $y[n] = 0$ for $n < 0$, let's determine the region of convergence (ROC):

$H(z)$ has a zero at $z = 0$ and it has a pole at $z = 1.2$. Zeroes are not important when determining the ROC, but poles are. The pole pole at $z = 1.2$ defines two possible ROCs: $|z| < 1.2$ and $|z| > 1.2$.

The first one is not valid with initial rest conditions, due to causality.

The second one does not include the unit circle $(|z| = 1)$. Therefore, this system is unstable, i.e., bound inputs may produce unbound outputs.

You may easily verify that this system is unstable by exciting it with $x[n] = \delta[n]$. Under initial rest conditions, the output is always ascending with time.

• Both of the answers were clear. But Luis, could you explain your statement: "The first one is not valud with initial rest condutions due to causaility" in more detail. Thanks. – mark leeds Apr 18 '18 at 16:08
• @markleeds, this system has a pole at $z = 1.2$, outside the unit circle. Therefore, it is stable only if it is non-causal (and its impulse response $h[n]$ is left handed, we may say). That is, if its impulse response has non-zero samples for $n<0$ and zeros for $n>0$, for example: $h[n] = -1.2^{n}~u[-n-1]$. But with initial rest conditions we force the system to be causal (to have a right handed $h[n]$), and therefore the $Z$-transform converges only for $|z| > 1.2$, which does not include the unit circle. – Luis M Gato Apr 18 '18 at 19:22
• @markleeds, take into account that the transfer function of this example has two possible ROCs, depending on the causality or not of the system: (causal) $h[n] = 1.2^n~u[n]$ with the ROC $|z| > 1.2$ and (non-causal) $h[n] = -1.2^n~u[-n-1]$ with the ROC $|z| < 1.2$. The second one is not compatible with initial rest conditions (i.e., $h[n] = 0$ for $n < 0$). And the first one is compatible, but does not include the unit circle, making the system unstable. – Luis M Gato Apr 18 '18 at 19:27
• Thanks Luis. Will print out and read carefully. It's nuch appreciated. – mark leeds Apr 19 '18 at 20:13