Finding the triple (A,B,C) from the transfer function 
Question: Find matrices $A,B,C$ such that the transfer function of the triple $(A,B,C)$ equals
$$\frac{s^3+2s^2+3s+4}{s^5+5s^4+6s^3+7s^2+8s+9}$$

No explanation is given in the solution, just the final matrix. I know how to find the transfer function given $A,B,C$ but I'm unsure how to go the other way! The transfer function is given by $G(s)=C(sI-A)^{-1}B$ but I'm not sure how to use this to find the matrices. 
 A: The transfer function by definition yields
$$\frac{Y(s)}{U(s)}=\frac{s^3+2s^2+3s+4}{s^5+5s^4+6s^3+7s^2+8s+9}$$
which can equivalently be written as
$$Y(s)=(s^3+2s^2+3s+4)\frac{U(s)}{s^5+5s^4+6s^3+7s^2+8s+9}$$
This means that   we can define the states
$$X_1(s)=\frac{U(s)}{s^5+5s^4+6s^3+7s^2+8s+9}\\
X_2(s)=s\frac{U(s)}{s^5+5s^4+6s^3+7s^2+8s+9}\\
X_3(s)=s^2\frac{U(s)}{s^5+5s^4+6s^3+7s^2+8s+9}\\
X_4(s)=s^3\frac{U(s)}{s^5+5s^4+6s^3+7s^2+8s+9}\\
X_5(s)=s^4\frac{U(s)}{s^5+5s^4+6s^3+7s^2+8s+9}$$
such that
$$Y(s)=X_4(s)+2X_3(s)+3X_2(s)+4X_1(s)$$
and
$$sX_5(s)=\frac{s^5U(s)}{s^5+5s^4+6s^3+7s^2+8s+9}=U(s)-\frac{(5s^4+6s^3+7s^2+8s+9)U(s)}{s^5+5s^4+6s^3+7s^2+8s+9}\\
=U(s)-5X_5(s)-6X_4(s)-7X_3(s)-8X_2(s)-9X_1(s)$$
Returning to the time domain we obtain the state-space representation
$$\dot{x}=\left[\matrix{\dot{x}_1\\\dot{x}_2\\\dot{x}_3\\\dot{x}_4\\\dot{x}_5}\right]=\left[\matrix{{x}_2\\{x}_3\\{x}_4\\{x}_5\\-9x_1-8x_2-7x_3-6x_4-5x_5+u}\right]\\
=\left[\matrix{0 & 1& 0& 0& 0\\0 & 0 & 1& 0 & 0\\0 & 0& 0& 1& 0\\0 & 0& 0& 0& 1\\-9 & -8& -7&-6&-5}\right]\left[\matrix{x_1\\x_2\\x_3\\x_4\\x_5}\right]+\left[\matrix{0\\0\\0\\0\\1}\right]u$$
and 
$$y=x_4+2x_3+3x_2+4x_1=\left[\matrix{4 & 3 & 2& 1& 0}\right]\left[\matrix{x_1\\x_2\\x_3\\x_4\\x_5}\right]$$
