# How can I show that an LTI system can be expressed as a difference equation?

I'm in the process of re-learning DSP (not a subject I've visited since University) and in quite a few resources I see this general form of a DT-LTI difference equation:

$$y[n] + a_1y[n-1] + a_2y[n-2] + \cdots + a_Ny[n-N] = \\ \qquad \qquad b_0x[n] + b_1x[n-1] + b_2x[n-2] + \cdots b_Mx[n-M]$$

However I don't understand where this equation comes from.

This is my attempt so far at explaining it

DT-LTI system defined as:

$$y[n] = h[n] \circledast x[n]$$

Therefore:

$$y[n] = \sum_{k=0}^{\infty} h[k]x[n-k]$$

$$y[n-1] = \sum_{k=0}^{\infty} h[k[x[n-1-k]$$

$$y[n-2] = \sum_{k=0}^{\infty} h[k]x[n-2-k]$$

From this we can see that

$$\sum_{p=0}^{N}y[n-p]$$ will produce $$(p+1)$$ many $$x[n-p]$$ terms

Therefore

$$\sum_{p=0}^{N}y[n-p] = h*x[n] + (h + h)*x[n-1] + (h + h + h)*x[n-2] \cdots$$

Finally I can compare this to the stated equation to get

$$b_0 = h$$

$$b_1 = h + h$$

$$b_2 = h + h + h$$

$$b_m = h[m] + h[m-1] + \cdots + h$$

However I don't see how to calculate the $$a_k$$ coefficients for $$y[n]$$

How can I show that an LTI system can be expressed as a difference equation?

is: you generally can't.

It is only a specific class of discrete-time LTI systems that can be described by a linear difference equation with constant coefficients. However, it's an important class that is used a lot in practice: (recursive or non-recursive) filters that are implemented by just using additions, multiplications, and delays (i.e., memory).

Here is some more general background: the input-output behavior of a discrete-time linear time-invariant (LTI) system is completely determined by its impulse response $$h[n]$$. The output $$y[n]$$ can be computed from the input $$x[n]$$ and the impulse response $$h[n]$$ via the convolution sum:

$$y[n]=\sum_{k=-\infty}^{\infty}h[k]x[n-k]$$

It is clear that a system expressed by a linear difference equation with constant coefficients must be linear and time-invariant (assuming zero initial conditions). So if a system is described by such a difference equation, we can conclude that it must be an LTI system. However, in general it is not possible to describe an arbitrary discrete-time LTI system by a difference equation.

Take as an example an LTI system with impulse response $$h[n]=1/n^2$$ for $$n>0$$. There is no finite order difference equation describing this system. This is true for infinitely many discrete-time LTI systems. In practice, one could truncate that impulse response, using just the number of coefficients necessary to achieve some specified accuracy. In that case we obtain a system that can be implemented as a specific difference equation with all coefficients $$a_i=0$$. Such a system is called a finite impulse response (FIR) system (or filter).

If an LTI system can be described by a difference equation (with zero initial conditions), it is always possible to compute its impulse response. Simply apply an impulse at its input and compute the output, which equals the impulse response.

A very simple example is the difference equation

$$y[n]=ay[n-1]+bx[n],\qquad y[-1]=0$$

With an impulse at the input ($$x[n]=\delta[n]$$), we obtain the following output sequence: \begin{align*} y & = b\\ y & = ab\\ y & = a^2b\\ y & = a^3b\\ \ldots \end{align*}

Because we used an impulse at the input, the output equals the impulse response, and we obtain the general expression $$h[n]=a^nb\cdot u[n]$$ where $$u[n]$$ denotes the unit step sequence, which equals $$1$$ for $$n\ge 0$$ and zero otherwise.

A general way to arrive at an analytic expression for the impulse response from a given difference equation is to compute the transfer function and apply the inverse $$\mathcal{Z}$$-transform.