Main Content

minpoly

Minimal polynomial of matrix

Description

example

minpoly(A) returns a vector of the coefficients of the minimal polynomial of A. If A is a symbolic matrix, minpoly returns a symbolic vector. Otherwise, it returns a vector with elements of type double.

example

minpoly(A,var) returns the minimal polynomial of A in terms of var.

Examples

Compute Minimal Polynomial of Matrix

Compute the minimal polynomial of the matrix A in terms of the variable x:

syms x
A = sym([1 1 0; 0 1 0; 0 0 1]);
minpoly(A, x)
ans =
x^2 - 2*x + 1

Compute Coefficients of Minimal Polynomial

To find the coefficients of the minimal polynomial of A, call minpoly with one argument. Since A is numeric, minpoly returns coefficients as double-precision values:

A = sym([1 1 0; 0 1 0; 0 0 1]);
minpoly(A)
ans =
[ 1, -2, 1]

Find the coefficients of the minimal polynomial of the symbolic matrix A. For this matrix, minpoly returns the symbolic vector of coefficients:

A = sym([0 2 0; 0 0 2; 2 0 0]);
P = minpoly(A)
P =
[ 1, 0, 0, -8]

Input Arguments

collapse all

Input, specified as a numeric or symbolic matrix.

Input, specified as a symbolic variable. If you do not specify var, minpoly returns a vector of coefficients of the minimal polynomial instead of returning the polynomial itself.

More About

collapse all

Minimal Polynomial of a Matrix

The minimal polynomial of a square matrix A is the monic polynomial p(x) of the least degree, such that p(A) = 0.

Version History

Introduced in R2012b