State Space representation I'm trying to change this filter transfer function to state space representation  

$  y_t=\frac{1+b_1 z^{-1}}{1+a_1 z^{-1} +a_2 z^{-2}}u_t  $

I tried writing it as time series

$  y_t+a_1 y_{t-1}+a_2 y_{t-2}=u_t+b_1 u_{t-1}  $

Here is where I am not sure how to continue, I wrote an expression 

$ x_t=\frac{1}{1+a_1 z^{-1}+a_2 z^{-2}}u_{t-1} $    

such that

$ y_t=(1+b_1z^{-1})x_{t+1}=x_{t+1}+b_1x_t  $  

and

$ (1+a_1 z^{-1} +a_2 z^{-2})x_t=u_{t-1}$

The idea was to get:

$ x_t=u_{t-1}-a_1x_{t-1}-a_2x_{t-2} $               $ (1)$

$ x_{t+1}=u_{t}-a_1x_{t}-a_2x_{t-1}  $              $(2)$

renaming

$ x_{t+1}=x_{a,t+1} $

$ x_{t}=x_{b,t+1}  $

and write my state equations as 

$ \begin{bmatrix} x_{a,t+1}\\ x_{b,t+1}\end{bmatrix}=\begin{bmatrix} -a_1 &amp;&amp; -a_2\\ 1&amp;&amp;0\end{bmatrix} \begin{bmatrix} x_{a,t}\\ x_{b,t}\end{bmatrix} +\begin{bmatrix} 1\\ 0\end{bmatrix}u_t$

from (2) my states are

$ x_{a,t}=x_t $

$ x_{b,t}=x_{t-1}  $

But my problem comes when I want to state my output equation, which is 

$ y_t=x_{t+1}+b_1x_t  $  

but   $ x_{t+1} $    is not one of my states so I'm not being able to express my output equation in terms of $x_{a,t}$ and $x_{b,t}$

I would appreciate any hint on where I am making the mistake, thanks for your help.
You can just write $(2)$ in $y_t$, so it becomes

$$y_t = \begin{bmatrix} b_1-a_1 &amp;&amp; -a_2\end{bmatrix} \begin{bmatrix} x_{a,t}\\ x_{b,t}\end{bmatrix} +\begin{bmatrix} 1 \end{bmatrix}u_t $$

Actually, this representation is called controllable canonical form. However, your system is not strictly proper, so you need to split it as

$$G(z)=\frac{z^2 + b_1 z}{z^2 + a_1 z + a_2} = 1 + \frac{(b_1 - a_1) z - a_2}{z^2 + a_1 z + a_2}$$

See how the coefficients appear?