# How to get a transfer function from this block diagram?

Pardon my paint skills, I did my best

My attempt is short and seems to fail, I have no idea why:

\begin{align} \alpha &= in - a_{1}\beta - a_{2}\gamma \\ \beta &= \alpha z^{-1} \\ \gamma &= \beta z^{-1} = \alpha z^{-2} \end{align}

inputting 2nd and 3rd equation into the first one I get:

\begin{align} \alpha &= in - a_{1}\alpha z^{-1} - a_{2}\alpha z^{-2} \\ in &= \alpha + a_{1}\alpha z^{-1} + a_{2}\alpha z^{-2} \end{align}

I can write the output as:

\begin{align} out &= b_{2}\gamma + b_{1}\beta + b_{0}\alpha \\ out &= b_{2}\alpha z^{-2} + b_{1}\alpha z^{-1} + b_{0}\alpha \end{align}

I have output and input in terms of alpha, but I can't figure what to do from here.

You are going in the right direction! Lets take these two equations: $$(1) \quad in = \alpha+a_1\alpha z^{-1}+a_2\alpha z^{-2}$$ $$(2) \quad out = b_0\alpha+b_1\alpha z^{-1}+b_2\alpha z^{-2}$$ now rewrite (1) such that it becomes a function of $$\alpha$$: $$in = \alpha\left(1+a_1z^{-1}+a_2z^{-2}\right)$$ $$\alpha = \frac{in}{1+a_1z^{-1}+a_2z^{-2}}$$ Substitute $$\alpha$$ in equation (2): $$out = in\frac{b_0+b_1 z^{-1}+b_2 z^{-2}}{1+a_1z^{-1}+a_2z^{-2}}$$ And derive proper discrete transfer function from it: $$H(z) = \frac{out}{in} = \frac{b_0+b_1 z^{-1}+b_2 z^{-2}}{1+a_1z^{-1}+a_2z^{-2}}$$