# Companion matrix

In linear algebra, the Frobenius companion matrix of the monic polynomial ${\displaystyle p(x)=c_{0}+c_{1}x+\cdots +c_{n-1}x^{n-1}+x^{n}}$ is the square matrix defined as

${\displaystyle C(p)={\begin{bmatrix}0&0&\dots &0&-c_{0}\\1&0&\dots &0&-c_{1}\\0&1&\dots &0&-c_{2}\\\vdots &\vdots &\ddots &\vdots &\vdots \\0&0&\dots &1&-c_{n-1}\end{bmatrix}}.}$

Some authors use the transpose of this matrix, ${\displaystyle C(p)^{T}}$, which is more convenient for some purposes such as linear recurrence relations (see below).

${\displaystyle C(p)}$ is defined from the coefficients of ${\displaystyle p(x)}$, while the characteristic polynomial as well as the minimal polynomial of ${\displaystyle C(p)}$ are equal to ${\displaystyle p(x)}$.[1] In this sense, the matrix ${\displaystyle C(p)}$ and the polynomial ${\displaystyle p(x)}$ are "companions".

## Similarity to companion matrix

Any matrix A with entries in a field F has characteristic polynomial ${\displaystyle p(x)=\det(xI-A)}$, which in turn has companion matrix ${\displaystyle C(p)}$. These matrices are related as follows.

The following statements are equivalent:

• A is similar over F to ${\displaystyle C(p)}$, i.e. A can be conjugated to its companion matrix by matrices in GLn(F);
• the characteristic polynomial ${\displaystyle p(x)}$ coincides with the minimal polynomial of A , i.e. the minimal polynomial has degree n;
• the linear mapping ${\displaystyle A:F^{n}\to F^{n}}$ makes ${\displaystyle F^{n}}$ a cyclic ${\displaystyle F[A]}$-module, having a basis of the form ${\displaystyle \{v,Av,\ldots ,A^{n-1}v\}}$; or equivalently ${\displaystyle F^{n}\cong F[X]/(p(x))}$ as ${\displaystyle F[A]}$-modules.

If the above hold, one says that A is non-derogatory.

Not every square matrix is similar to a companion matrix, but every square matrix is similar to a block diagonal matrix made of companion matrices. If we also demand that the polynomial of each diagonal block divides the next one, they are uniquely determined by A, and this gives the rational canonical form of A.

## Diagonalizability

The roots of the characteristic polynomial ${\displaystyle p(x)}$ are the eigenvalues of ${\displaystyle C(p)}$. If there are n distinct eigenvalues ${\displaystyle \lambda _{1},\ldots ,\lambda _{n}}$, then ${\displaystyle C(p)}$ is diagonalizable as ${\displaystyle C(p)=V^{-1}\!DV}$, where D is the diagonal matrix and V is the Vandermonde matrix corresponding to the λ's: ${\displaystyle D={\begin{bmatrix}\lambda _{1}&0&\!\!\!\cdots \!\!\!&0\\0&\lambda _{2}&\!\!\!\cdots \!\!\!&0\\0&0&\!\!\!\cdots \!\!\!&\lambda _{n}\end{bmatrix}},\qquad V={\begin{bmatrix}1&\lambda _{1}&\lambda _{1}^{2}&\!\!\!\cdots \!\!\!&\lambda _{1}^{n}\\1&\lambda _{2}&\lambda _{2}^{2}&\!\!\!\cdots \!\!\!&\lambda _{2}^{n}\\[-1em]\vdots &\vdots &\vdots &\!\!\!\ddots \!\!\!&\vdots \\1&\lambda _{n}&\lambda _{n}^{2}&\!\!\!\cdots \!\!\!&\lambda _{n}^{n}\end{bmatrix}}.}$ Indeed, an easy computation shows that the transpose ${\displaystyle C(p)^{T}}$ has eigenvectors ${\displaystyle v_{i}=(1,\lambda _{i},\ldots ,\lambda _{i}^{n-1})}$ with ${\displaystyle C(p)^{T}\!(v_{i})=\lambda _{i}v_{i}}$, which follows from ${\displaystyle p(\lambda _{i})=c_{0}+c_{1}\lambda _{i}+\cdots +c_{n-1}\lambda _{i}^{n-1}+\lambda _{i}^{n}=0}$. Thus, its diagonalizing change of basis matrix is ${\displaystyle V^{T}=[v_{1}^{T}\ldots v_{n}^{T}]}$, meaning ${\displaystyle C(p)^{T}=V^{T}D\,(V^{T})^{-1}}$, and taking the transpose of both sides gives ${\displaystyle C(p)=V^{-1}\!DV}$.

We can read the eigenvectors of ${\displaystyle C(p)}$ with ${\displaystyle C(p)(w_{i})=\lambda _{i}w_{i}}$ from the equation ${\displaystyle C(p)=V^{-1}\!DV}$: they are the column vectors of the inverse Vandermonde matrix ${\displaystyle V^{-1}=[w_{1}^{T}\cdots w_{n}^{T}]}$. This matrix is known explicitly, giving the eignevectors ${\displaystyle w_{i}=(L_{0i},\ldots ,L_{(n-1)i})}$, with coordinates equal to the coefficients of the Lagrange polynomials ${\displaystyle L_{i}(x)=L_{0i}+L_{1i}x+\cdots +L_{(n-1)i}x^{n-1}=\prod _{j\neq i}{\frac {x-\lambda _{j}}{\lambda _{j}-\lambda _{i}}}={\frac {p(x)}{(x-\lambda _{i})\,p'(\lambda _{i})}}.}$ Alternatively, the scaled eigenvectors ${\displaystyle {\tilde {w}}_{i}=p'\!(\lambda _{i})\,w_{i}}$ have simpler coefficients.

If ${\displaystyle p(x)}$ has multiple roots, then ${\displaystyle C(p)}$ is not diagonalizable. Rather, the Jordan canonical form of ${\displaystyle C(p)}$ contains one diagonal block for each distinct root, an m × m block with ${\displaystyle \lambda }$ on the diagonal if the root ${\displaystyle \lambda }$ has multiplicity m.

## Linear recursive sequences

A linear recursive sequence defined by ${\displaystyle a_{k+n}=-c_{0}a_{k}-c_{1}a_{k+1}\cdots -c_{n-1}a_{k+n-1}}$ for ${\displaystyle k\geq 0}$ has the characteristic polynomial ${\displaystyle p(x)=c_{0}+c_{1}x+\cdots +c_{n-1}x^{n-1}+x^{n}}$, whose transpose companion matrix ${\displaystyle C(p)^{T}}$ generates the sequence: ${\displaystyle {\begin{bmatrix}a_{k+1}\\a_{k+2}\\\vdots \\a_{k+n-1}\\a_{k+n}\end{bmatrix}}={\begin{bmatrix}0&1&0&\cdots &0\\0&0&1&\cdots &0\\\vdots &\vdots &\vdots &\ddots &\vdots \\0&0&0&\cdots &1\\-c_{0}&-c_{1}&-c_{2}&\cdots &-c_{n-1}\end{bmatrix}}{\begin{bmatrix}a_{k}\\a_{k+1}\\\vdots \\a_{k+n-2}\\a_{k+n-1}\end{bmatrix}}.}$ The vector ${\displaystyle v=(1,\lambda ,\lambda ^{2},\ldots ,\lambda ^{n-1})}$ is an eigenvector of this matrix, where the eigenvalue ${\displaystyle \lambda }$ is a root of ${\displaystyle p(x)}$. Setting the initial values of the sequence equal to this vector produces a geometric sequence ${\displaystyle a_{k}=\lambda ^{k}}$ which satisfies the recurrence. In the case of n distinct eigenvalues, an arbitrary solution ${\displaystyle a_{k}}$ can be written as a linear combination of such geometric solutions, and the eigenvalues of largest complex norm give an asymptotic approximation.

## From linear ODE to first-order linear ODE system

Similarly to the above case of linear recursions, consider a homogeneous linear ODE of order n for the scalar function ${\displaystyle y=y(t)}$: ${\displaystyle y^{(n)}+c_{n-1}y^{(n-1)}+\dots +c_{1}y^{(1)}+c_{0}y=0.}$ This can be equivalently described as a coupled system of homogeneous linear ODE of order 1 for the vector function ${\displaystyle z(t)=(y(t),y'(t),\ldots ,y^{(n-1)}(t))}$: ${\displaystyle z'=C(p)^{T}z}$ where ${\displaystyle C(p)^{T}}$ is the transpose companion matrix for the characteristic polynomial ${\displaystyle p(x)=x^{n}+c_{n-1}x^{n-1}+\cdots +c_{1}x+c_{0}.}$ Here the coefficients ${\displaystyle c_{i}=c_{i}(t)}$ may be also functions, not just constants.

If ${\displaystyle C(p)^{T}}$ is diagonalizable, then a diagonalizing change of basis will transform this into a decoupled system equivalent to one scalar homogeneous first-order linear ODE in each coordinate.

An inhomogeneous equation ${\displaystyle y^{(n)}+c_{n-1}y^{(n-1)}+\dots +c_{1}y^{(1)}+c_{0}y=f(t)}$ is equivalent to the system: ${\displaystyle z'=C(p)^{T}z+F(t)}$ with the inhomogeneity term ${\displaystyle F(t)=(0,\ldots ,0,f(t))}$.

Again, a diagonalizing change of basis will transform this into a decoupled system of scalar inhomogeneous first-order linear ODEs.

## Cyclic shift matrix

In the case of ${\displaystyle p(x)=x^{n}-1}$, when the eigenvalues are the complex roots of unity, the companion matrix and its transpose both reduce to Sylvester's cyclic shift matrix, a circulant matrix.

## Multiplication map on a simple field extension

Consider a polynomial ${\displaystyle p(x)=x^{n}+c_{n-1}x^{n-1}+\cdots +c_{1}x+c_{0}}$ with coefficients in a field ${\displaystyle F}$, and suppose ${\displaystyle p(x)}$ is irreducible in the polynomial ring ${\displaystyle F[x]}$. Then adjoining a root ${\displaystyle \lambda }$ of ${\displaystyle p(x)}$ produces a field extension ${\displaystyle K=F(\lambda )\cong F[x]/(p(x))}$, which is also a vector space over ${\displaystyle F}$ with standard basis ${\displaystyle \{1,\lambda ,\lambda ^{2},\ldots ,\lambda ^{n-1}\}}$. Then the ${\displaystyle F}$-linear multiplication mapping

${\displaystyle m_{\lambda }:K\to K}$ defined by ${\displaystyle m_{\lambda }(\alpha )=\lambda \alpha }$

has an n × n matrix ${\displaystyle [m_{\lambda }]}$ with respect to the standard basis. Since ${\displaystyle m_{\lambda }(\lambda ^{i})=\lambda ^{i+1}}$ and ${\displaystyle m_{\lambda }(\lambda ^{n-1})=\lambda ^{n}=-c_{0}-\cdots -c_{n-1}\lambda ^{n-1}}$, this is the companion matrix of ${\displaystyle p(x)}$: ${\displaystyle [m_{\lambda }]=C(p).}$ Assuming this extension is separable (for example if ${\displaystyle F}$ has characteristic zero or is a finite field), ${\displaystyle p(x)}$ has distinct roots ${\displaystyle \lambda _{1},\ldots ,\lambda _{n}}$ with ${\displaystyle \lambda _{1}=\lambda }$, so that ${\displaystyle p(x)=(x-\lambda _{1})\cdots (x-\lambda _{n}),}$ and it has splitting field ${\displaystyle L=F(\lambda _{1},\ldots ,\lambda _{n})}$. Now ${\displaystyle m_{\lambda }}$ is not diagonalizable over ${\displaystyle F}$; rather, we must extend it to an ${\displaystyle L}$-linear map on ${\displaystyle L^{n}\cong L\otimes _{F}K}$, a vector space over ${\displaystyle L}$ with standard basis ${\displaystyle \{1{\otimes }1,\,1{\otimes }\lambda ,\,1{\otimes }\lambda ^{2},\ldots ,1{\otimes }\lambda ^{n-1}\}}$, containing vectors ${\displaystyle w=(\beta _{1},\ldots ,\beta _{n})=\beta _{1}{\otimes }1+\cdots +\beta _{n}{\otimes }\lambda ^{n-1}}$. The extended mapping is defined by ${\displaystyle m_{\lambda }(\beta \otimes \alpha )=\beta \otimes (\lambda \alpha )}$.

The matrix ${\displaystyle [m_{\lambda }]=C(p)}$ is unchanged, but as above, it can be diagonalized by matrices with entries in ${\displaystyle L}$: ${\displaystyle [m_{\lambda }]=C(p)=V^{-1}\!DV,}$ for the diagonal matrix ${\displaystyle D=\operatorname {diag} (\lambda _{1},\ldots ,\lambda _{n})}$ and the Vandermonde matrix V corresponding to ${\displaystyle \lambda _{1},\ldots ,\lambda _{n}\in L}$. The explicit formula for the eigenvectors (the scaled column vectors of the inverse Vandermonde matrix ${\displaystyle V^{-1}}$) can be written as: ${\displaystyle {\tilde {w}}_{i}=\beta _{0i}{\otimes }1+\beta _{1i}{\otimes }\lambda +\cdots +\beta _{(n-1)i}{\otimes }\lambda ^{n-1}=\prod _{j\neq i}(1{\otimes }\lambda -\lambda _{j}{\otimes }1)}$ where ${\displaystyle \beta _{ij}\in L}$ are the coefficients of the scaled Lagrange polynomial ${\displaystyle {\frac {p(x)}{x-\lambda _{i}}}=\prod _{j\neq i}(x-\lambda _{j})=\beta _{0i}+\beta _{1i}x+\cdots +\beta _{(n-1)i}x^{n-1}.}$