Matrix Minimal Polynomial

Author

Eric W. Weisstein
November 29, 2005

This notebook downloaded from http://mathworld.wolfram.com/notebooks/LinearAlgebra/MatrixMinimalPolynomial.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/MatrixMinimalPolynomial.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Code

MatrixMinimalPolynomial[a_List,x_]:=
    Module[{i,n=1,qu={},mnm={Flatten[IdentityMatrix[Length[a]]]}},
    While[Length[qu]==0,
      AppendTo[mnm,Flatten[MatrixPower[a,n]]];
      qu=NullSpace[Transpose[mnm]];
      n++
    ];
    First[qu].Table[x^i,{i,0,n-1}]
  ]

Examples

<<LinearAlgebra`MatrixManipulation`

Through[{CharacteristicPolynomial,MatrixMinimalPolynomial}[ZeroMatrix[3],x]]

Through[{CharacteristicPolynomial,MatrixMinimalPolynomial}[{{0,1},{0,0}},x]]