Computation of the minimal polynomial of a matrix in Mathematica

1.9k Views Asked by At

On the wolfram website, the following program is given for computing the minimal polynomial of a square matrix $a$ in the variable $x$:

MatrixMinimalPolynomial[a_List?MatrixQ,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}]

]

(It's given here: http://mathworld.wolfram.com/MatrixMinimalPolynomial.html also)

I'm having trouble following the algrothim it's using. How is Mathematica actually computing the matrix minimal polynomial?

1

There are 1 best solutions below

1
On BEST ANSWER

While I can't quite grok the code, it looks like M. is building in increasingly long list of powers of $a$, and searching (by NullSpace) for a relation of linear dependency. Once one is found, the coefficients of the dependency relation are turned into a polynomial through the Table method.