How to convert a rational transfer function from the Z-domain to the time domain and back? I'm in the process of studying z-transform for a project involving audio processing. I already asked a related of question on dsp.stackexchange.com, but I'm having a somewhat hard time understanding the answers especially when it comes to filtering due to my lack of familiarities with this field of mathematics.
For example, on the Matlab filter documentation, I can read:

The input-output description of the filter operation on a vector in the Z-transform domain is a rational transfer function. A rational transfer function is of the form
$$Y(z)={b(1)+b(2)z^{−1}+...+b(n_b+1)z^{−n_b} \over{}
 1+a(2)z^{−1}+...+a(n_a+1)z^{−n_a}}X(z) \tag{1} $$ [...]
You also can express the rational transfer function as the difference
  equation
$$a(1)y(n)=b(1)x(n)+b(2)x(n−1)+...+b(n_b+1)x(n−n_b)\\
 −a(2)y(n−1)−...−a(n_a+1)y(n−n_a). \tag{2} $$

Could someone explain to me how to convert from $(1)$ to $(2)$ and back?
I suspect this has to do with the direct application of the z-transform formula: $$X(z) = \sum_{n=-\infty}^{\infty} x[n] z^{-n}$$
But I can't manage to it by myself.
 A: Yes, you are right on your suspicions. It is done in a similar fashion as it is done for continuous time dynamical systems, where you can apply the Laplace transform to both sides of your differential equation and rearrange the terms in order to obtain a transfer function form.
You may do it by simply applying the Z-transform table properties, as the equation in the example is composed only by time delays (which in the continuous-time/Laplace-Transform analogy would correspond to derivatives).
So, if you have the transfer function:
$$Y(z)=\frac{b(1)+b(2)z^{−1}+...+b(n_b+1)z^{−n_b}}
 {1+a(2)z^{−1}+...+a(n_a+1)z^{−n_a}}X(z)$$
It corresponds to the following frequency-domain equation:
$$Y(z)+Y(z)a(2)z^{−1}+...+Y(z)a(n_a+1)z^{−n_a}=X(z)b(1)+X(z)b(2)z^{−1}+...+X(z)b(n_b+1)z^{−n_b}$$
Applying the inverse Z-transform (properties table) to both sides of the equation yields:
$$y(n)+a(2)y(n-1)+...+a(n_a+1)y(n-n_a)=b(1)x(n)+b(2)x(n-1)+...+b(n_b+1)x(n-n_b)$$
Which gives what you presented on your question.
