Companion Matrix

lean4-prooflinear-algebravisualization
χC(p)=p,p(x)=xn+an1xn1++a0\chi_{C(p)} = p,\quad p(x) = x^n + a_{n-1}x^{n-1} + \cdots + a_0

Statement

Given a monic polynomial p(x)=xn+an1xn1++a1x+a0p(x) = x^n + a_{n-1}x^{n-1} + \cdots + a_1 x + a_0 over a commutative ring RR, its companion matrix is the n×nn \times n matrix

C(p)=(000a0100a1010a2001an1).C(p) = \begin{pmatrix} 0 & 0 & \cdots & 0 & -a_0 \\ 1 & 0 & \cdots & 0 & -a_1 \\ 0 & 1 & \cdots & 0 & -a_2 \\ \vdots & & \ddots & & \vdots \\ 0 & 0 & \cdots & 1 & -a_{n-1} \end{pmatrix}.

The key property: χC(p)=p\chi_{C(p)} = p, i.e.\ the characteristic polynomial of C(p)C(p) equals pp. Furthermore, the minimal polynomial of C(p)C(p) also equals pp, so C(p)C(p) is a cyclic matrix (it has a cyclic vector e1e_1 spanning the whole space under repeated application of C(p)C(p)).

Visualization

For p(x)=x32x5p(x) = x^3 - 2x - 5 (as in the prompt), a0=5a_0 = -5, a1=2a_1 = -2, a2=0a_2 = 0:

C(p)=(005102010).C(p) = \begin{pmatrix} 0 & 0 & 5 \\ 1 & 0 & 2 \\ 0 & 1 & 0 \end{pmatrix}.

Characteristic polynomial check (expanding det(λIC(p))\det(\lambda I - C(p))):

det( λ   0  -5 )
   (-1   λ  -2 )
   ( 0  -1   λ )

= λ(λ² - 2) - (-1)(-5) · correction...
  expanding along first row:
= λ · det( λ  -2 ) - 0 + (-5) · det(-1  λ )
              (-1   λ)                ( 0 -1)
= λ(λ² - 2) - (-5)(1)
= λ³ - 2λ + 5 = p(λ). ✓

For the simpler 2×22 \times 2 case p(x)=x2+bx+cp(x) = x^2 + bx + c:

C(p)=(0c1b),χC(p)=det(λc1λ+b)=λ2+bλ+c=p(λ).C(p) = \begin{pmatrix} 0 & -c \\ 1 & -b \end{pmatrix}, \qquad \chi_{C(p)} = \det\begin{pmatrix} \lambda & c \\ -1 & \lambda+b \end{pmatrix} = \lambda^2 + b\lambda + c = p(\lambda).
p(x)p(x)C(p)C(p)χC(p)\chi_{C(p)}
x23x+2x^2 - 3x + 2(0213)\begin{pmatrix}0&-2\\1&3\end{pmatrix}x23x+2x^2 - 3x + 2
x2+1x^2 + 1(0110)\begin{pmatrix}0&-1\\1&0\end{pmatrix}x2+1x^2 + 1
x25x+6x^2 - 5x + 6(0615)\begin{pmatrix}0&-6\\1&5\end{pmatrix}x25x+6x^2 - 5x + 6

Proof Sketch

  1. Cofactor expansion. Compute det(λIC(p))\det(\lambda I - C(p)) by expanding along the last column or by induction on nn.
  2. Inductive step. For an n×nn \times n companion matrix, expand along the first row. The (1,1)(1,1) minor is an (n1)×(n1)(n-1) \times (n-1) companion matrix for p(x)/(x0)+p(x)/(x - 0) + \ldots; the last column contributes ±a0\pm a_0.
  3. Cayley–Hamilton. By the Cayley–Hamilton theorem, p(C(p))=χC(p)(C(p))=0p(C(p)) = \chi_{C(p)}(C(p)) = 0.
  4. Minimal polynomial. The vector e1=(1,0,,0)Te_1 = (1, 0, \ldots, 0)^T satisfies C(p)ke1=ek+1C(p)^k e_1 = e_{k+1} (standard basis vectors), so e1,C(p)e1,,C(p)n1e1e_1, C(p) e_1, \ldots, C(p)^{n-1} e_1 are linearly independent. Any annihilating polynomial must have degree n=degp\ge n = \deg p. Since p(C(p))=0p(C(p)) = 0, the minimal polynomial equals pp.

Connections

  • Cayley–Hamilton TheoremCayley–Hamilton TheorempA(A)=0  where  pA(λ)=det(λIA)p_A(A) = 0 \;\text{where}\; p_A(\lambda) = \det(\lambda I - A)Every square matrix satisfies its own characteristic polynomialRead more → — the companion matrix C(p)C(p) satisfies p(C(p))=0p(C(p)) = 0 by Cayley–Hamilton, as χC(p)=p\chi_{C(p)} = p
  • Minimal PolynomialMinimal PolynomialμAp    p(A)=0\mu_A \mid p \iff p(A) = 0The minimal polynomial of a matrix is the monic polynomial of least degree that annihilates it.Read more → — the minimal polynomial of C(p)C(p) equals its characteristic polynomial pp; companion matrices are maximally non-degenerate (cyclic)
  • Jordan Canonical FormJordan Canonical FormA=PJP1,J=iJni(λi)A = P J P^{-1},\quad J = \bigoplus_i J_{n_i}(\lambda_i)Every square matrix over an algebraically closed field is similar to a direct sum of Jordan blocks.Read more → — every square matrix over an algebraically closed field is similar to a direct sum of companion matrices of its elementary divisors

Lean4 Proof

import Mathlib.LinearAlgebra.Matrix.Charpoly.Basic

/-- The companion matrix of the monic degree-2 polynomial x² + bx + c.
    We prove directly that its characteristic polynomial equals x² + bx + c
    by computing the determinant. -/
def companionMat (b c : ) : Matrix (Fin 2) (Fin 2)  :=
  !![0, -c; 1, -b]

/-- The characteristic polynomial of the 2×2 companion matrix is x² + bx + c.
    This is the n=2 instance of the general companion-matrix theorem:
    χ_{C(p)} = p. -/
theorem companion_charpoly (b c : ) :
    (companionMat b c).charpoly =
      Polynomial.X ^ 2 + Polynomial.C b * Polynomial.X + Polynomial.C c := by
  simp [companionMat, Matrix.charpoly, Matrix.charmatrix,
        Matrix.det_fin_two, Polynomial.ext_iff]
  ring