# How to find a transformation matrix which will make the system a chain of integrators?

Consider a system of the form $$\dot{x}(t)=Ax(t)+Bu(t)+\phi(t)+D(t)$$ I have $$\dot{x}(t)=\begin{bmatrix} -p_1 &G_b & 0 & 0 &0 \\ 0& -p_2 & p_3 & 0 & 0\\ 0& 0 & -p_4 & p_5 &0 \\ 0& 0 & 0 & -p_6 &p_6 \\ 0& 0& 0 & 0 & -p_6 \end{bmatrix}x(t)+\begin{bmatrix} 0\\ 0\\ 0\\ 0\\ 1\\ \end{bmatrix}u(t)+\begin{bmatrix} -x_1(t)x_2(t)\\ 0\\ 0\\ 0\\ 0\\ \end{bmatrix}+\begin{bmatrix} 1\\ 0\\ 0\\ 0\\ 0\\ \end{bmatrix}D(t)$$ Where $$\phi(t)$$ is a lumped nonlinearity of the system and $$D(t)$$ is a disturbance acting from outside. I want to convert the system of the form $$\dot{Z}_{i}=Z_{i+1}+\text{maybe nonlinearities and disturbances}, i=1,2,...,r-1 \\\dot{Z}_{r}=u+\text{maybe some function oif states}$$ i.e $$\dot{Z_1}=Z_2 \\ \dot{Z_2}=Z_3 \\ \cdots \\\dot{Z_r}=f(Z_1,...,Z_r,t,)+u$$ How to find a transformation matrix to do this?

For a single input system the similarity transformation which transforms the system into its controllable canonical form is given by

$$\vec{v}^\top = \begin{bmatrix}0 & \cdots & 0 & 1\end{bmatrix} \begin{bmatrix} B & B\, A & B\, A^2 & \cdots & B\, A^{n-1} \end{bmatrix}^{-1}, \tag{1}$$

$$T = \begin{bmatrix} \vec{v}^\top \\ \vec{v}^\top A \\ \vec{v}^\top A^2 \\ \vdots \\ \vec{v}^\top A^{n-1} \end{bmatrix}. \tag{2}$$

So using the transformation $$z(t) = T\,x(t)$$ gives

$$\dot{z} = T\,A\,T^{-1} z(t) + T\,B\,u(t) + T\,\phi(t) + T\,D(t), \tag{3}$$

where $$(T\,A\,T^{-1}, T\,B)$$ will be in the controllable canonical form.

If you would like to know more about how to derive this then you can look at this related question.