Companion matrix

We can write an nthn^\text{th} order linear ODE as an ODE system of nn variables. The matrix describing the system is called the companion matrix to the original nthn^\text{th} order ODE.

Consider the ODE

anx(n)+an1x(n1)++a0x=r. a_n x^{(n)} + a_{n-1}x^{(n-1)} + \cdots + a_0 x = r.

We define variables x0=xx_0=x, x1=x˙x_1=\dot x, xi=x(i)x_i = x^{(i)}. Then we can express the above ODE equivalently as

ddt(x0x1xn1)=(010000100001a0ana1ana2anan1an)(x0x1xn1). \begin{align*} \frac{\mathrm d}{\mathrm dt} \begin{pmatrix} x_0 \\ x_1 \\ \vdots \\ x_{n-1} \end{pmatrix} = \begin{pmatrix} 0 & 1 & 0 & \cdots & 0 \\ 0 & 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & 1 \\ \frac{a_0}{a_n} & \frac{a_1}{a_n} & \frac{a_2}{a_n} & \cdots & \frac{a_{n-1}}{a_n} \end{pmatrix} \begin{pmatrix} x_0 \\ x_1 \\ \vdots \\ x_{n-1} \end{pmatrix}. \end{align*}