 TOPICS  # Companion Matrix

The companion matrix to a monic polynomial (1)

is the square matrix (2)

with ones on the subdiagonal and the last column given by the coefficients of . 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 is the standard basis, a companion matrix satisfies (3)

for , as well as (4)

including (5)

The matrix minimal polynomial of the companion matrix is therefore , which is also its characteristic polynomial.

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

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

```  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}]]```

Matrix, Matrix Minimal Polynomial, Rational Canonical Form

This entry contributed by Todd Rowland

## Explore with Wolfram|Alpha More things to try:

## Cite this as:

Rowland, Todd. "Companion Matrix." From MathWorld--A Wolfram Web Resource, created by Eric W. Weisstein. https://mathworld.wolfram.com/CompanionMatrix.html