# Difference Equation - Time Response analysis of Discrete Systems

We know that that the difference equation formula for computing an output sample at time $n$ is based upon its past/present input samples and past output samples in time domain:

$\displaystyle y(n)$ $\displaystyle =$ $\displaystyle b_0 \,x(n) + b_1 \,x(n - 1) + \cdots + b_M \,x(n - M)$
$\displaystyle \qquad\quad\; - a_1 \,y(n - 1) - \cdots - a_N \,y(n - N)$
$\displaystyle =$ $\displaystyle \sum_{i=0}^M b_i \,x(n-i) - \sum_{j=1}^N a_j \,y(n-j)$

My question is why 'j' begins from 1 rather than from value 0 like for 'i' and also how can we write the below output equation in difference equation form:

$\displaystyle y(n) = 0.01\, x(n - 5) + 0.002\, x(n - 1) + 0.99\, y(n - 1)$
$\displaystyle y(n) = 0.01\, x(n) + 0.002\, x(n - 1)$
$\displaystyle y(5) = 0.01\, x(3) + x(1)$

Secondly why y(n) sequence values are calculated as a sum of a series of input / output, cause I have been studying that $y(n) = \{2,4,6,8\}$ when $x(n) = \{1,2,3,4\}$ and $n =\{1,2,3,4\}$ (example per say) i.e. $y(n) = 2\cdot x(n)$. There was no mention that for $y(n)$ ($y(2)$ say) value we need to add values of $x(n)$ and $y(n)$ i.e. (take values of $x(1)$ or $y(1)$) or $y(n-1)$)?

• If $j$ began at 0 there could exist a term $a_0y(n)$ on the r.h.s of the difference equation. Bringing this term to the l.h.s yields $(1-a_0)y(n) = \ldots$ and you could rewrite this difference equation by dividing both sides by $1-a_0$. This would just mean that all coefficients $b_i$ and $a_j$ are changed. So without a loss of generality, $j$ starts at 1. – Deve Aug 21 '14 at 8:26
• Thanks @Deve for your comment but sorry I could not understand as you mentioned - "... This would just mean that all coefficients bi and aj are changed. So without a loss of generality, j starts at 1." – Programmer Aug 21 '14 at 8:54
• Any difference equation with coefficents $b_0$ to $b_M$ and $a_0$ to $a_N$ can be rearranged yielding a new difference equation with coefficients $b'_0$ to $b'_M$ and $a'_1$ to $a'_N$. Both equations are equivalent and describe the same system. Thus, in the general definition $j$ starts at 1. – Deve Aug 21 '14 at 9:09

The answer to your first question (why $j$ starts at $1$) is contained in your first sentence: the output is computed from the current input value ($i=0$), from past input values ($i\ge 1$), and from past output values (i.e. $j\ge 1$). Imagine that you had the following difference equation with $j$ starting at $0$:

$$y(n)=\sum_{i=0}^Mb_ix(n-i)-\sum_{j=0}^Na_jy(n-j)\tag{1}$$

Then you could rewrite (1) as

$$y(n)=\sum_{i=0}^Mb_ix(n-i)-\sum_{j=1}^Na_jy(n-j)-a_0y(n)\tag{2}$$

and consequently

$$y(n)(1+a_0)=\sum_{i=0}^Mb_ix(n-i)-\sum_{j=1}^Na_jy(n-j)\tag{3}$$

Now you can divide (3) by $1+a_0$ to arrive at an equation like the one given in your question (with $j$ starting at $1$) (and with all coefficients scaled by the constant $1+a_0$). So you can always use the difference equation with $j$ starting at $1$ without loss of generality.

Concerning the 3 examples of difference equations you gave I'll just discuss the first one, the others are totally analogous. Here you have $M=5$ and $N=1$ with coefficients $b_1=0.002$, $b_5=0.01$, and $b_0=b_2=b_3=b_4=0$, and $a_1=-0.99$.

Finally, concerning your last question about the system $y(n)=2x(n)$. That's again a special case of your general difference equation with all $a_i=0$ (i.e. no recursion) and with $b_0=1$ (and all other $b_i=0$, $i\ge 1$). So all your examples are special cases of the general difference equation.