# Minimal polynomial: pmin

### 5.48.9 Minimal polynomial: pmin

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 takes one mandatory argument and one optional argument:
  - A, a square matrix.
  - Optionally, x, a variable name.
- pmin(A ⟨ x⟩) returns the minimal polynomial A. It is written as the list of its coefficients if no variable name was provided or written as an expression with respect to x if there is a second argument.

#### Examples.

- Input:
  pmin([[1,0],[0,1]])
  Output:

  ⎡ ⎣ | 1,−1 | ⎤ ⎦

- Input:
  pmin([[1,0],[0,1]],x)
  Output:

  x−1

  Hence the minimal polynomial of [[1,0],[0,1]] is x−1.
- Input:
  pmin([[2,1,0],[0,2,0],[0,0,2]])
  Output:

  ⎡ ⎣ | 1,−4,4 | ⎤ ⎦

- Input:
  pmin([[2,1,0],[0,2,0],[0,0,2]],x)
  Output:

  x2−4 x+4

  Hence, the minimal polynomial of [[2,1,0],[0,2,0],[0,0,2]] is x2−4x+4.