# Companion Matrix

The companion matrix of the monic polynomial $p(t)=c_0 + c_1 t + \dots + c_{n-1}t^{n-1} + t^n$ is the square matrix defined as:

$C(p)=\begin{bmatrix} 0 & 0 & \dots & 0 & -c_0 \\ 1 & 0 & \dots & 0 & -c_1 \\ 0 & 1 & \dots & 0 & -c_2 \\ \vdots & \vdots & \vdots & \vdots & \vdots \\ 0 & 0 & \dots & 1 & -c_{n-1} \\ \end{bmatrix}.$

$p(t)$ is also the characteristic polynomial for the matrix. The eigenvalues for the above matrix are the roots of $p(t)$.

I found this to be quite an interesting way to find the roots of any equation, with a great deal of ease! The corresponding MATLAB function is compan.

$\mathbf{F} = \textrm{compan}([1 -1 -1]) = \begin{pmatrix} 1 & 1\\ 1 & 0 \\\end{pmatrix}$

$\begin{pmatrix} F_{k+2} \\ F_{k+1} \\ \end{pmatrix} = \begin{pmatrix} 1 & 1\\ 1 & 0 \\\end{pmatrix} \begin{pmatrix} F_{k+1} \\ F_{k} \\ \end{pmatrix}$

Here, $F_k$ is the kth; Fibonacci number.