Companion Matrix

The companion matrix to a monic polynomial


is the n×n square matrix

 A=[0 0 ... 0 -a_0; 1 0 ... 0 -a_1; 0 1 ... 0 -a_2; | | ... ... |; 0 0 ... 1 -a_(n-1)]

with ones on the subdiagonal and the last column given by the coefficients of a(x). Note that in the literature, the companion matrix is sometimes defined with the rows and columns switched, i.e., the transpose of the above matrix.

When e_i is the standard basis, a companion matrix satisfies


for i<n, as well as




The matrix minimal polynomial of the companion matrix is therefore a(x), which is also its characteristic polynomial.

Companion matrices are used to write a matrix in rational canonical form. In fact, any n×n matrix whose matrix minimal polynomial p(x) has polynomial degree n is similar to the companion matrix for p(x). The rational canonical form is more interesting when the degree of p(x) is less than n.

The following Wolfram Language command gives the companion matrix for a polynomial p in the variable x.

  CompanionMatrix[p_, x_] := Module[
    {n, w = CoefficientList[p, x]},
    w = -w/Last[w];
    n = Length[w] - 1;
    SparseArray[{{i_, n} :> w[[i]], {i_, j_} /;
      i == j + 1 -> 1}, {n, n}]]

See also

Matrix, Matrix Minimal Polynomial, Rational Canonical Form

This entry contributed by Todd Rowland

Explore with Wolfram|Alpha

Cite this as:

Rowland, Todd. "Companion Matrix." From MathWorld--A Wolfram Web Resource, created by Eric W. Weisstein.

Subject classifications