The minimal polynomial of a square matrix A is the polynomial P having minimal degree such that P(A)=0. The pmin command finds the minimal polynomial of a matrix.
| pmin([[1,0],[0,1]]) | 
| 
 | 
| pmin([[1,0],[0,1]],x) | 
| 
 | 
Hence the minimal polynomial of [
| 1 | 0 | 
| 0 | 1 | 
] is x−1.
| pmin([[2,1,0],[0,2,0],[0,0,2]]) | 
| 
 | 
| pmin([[2,1,0],[0,2,0],[0,0,2]],x) | 
| 
 | 
Hence, the minimal polynomial of [
| 2 | 1 | 0 | 
| 0 | 2 | 0 | 
| 0 | 0 | 2 | 
] is x2−4x+4.