Given a linear map , in the form of a square matrix A, I can calculate the characteristic polynimial in x, which is det(A-xI).

How do I calculate the minimal polynomial ? The minimal polymonial is defined as the unique polynomial with

(i) leading coefficient is 1 (for uniqueness)

(ii) it is the polynomial of least degree with