Characteristic polynomial of a matrix

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.


linalg::charpoly(A, x)


linalg::charpoly(A, x) computes the characteristic polynomial of the matrix A. The characteristic polynomial of a n×n matrix is defined by , where In denotes the n×n identity matrix.

The component ring of A must be a commutative ring, i.e., a domain of category Cat::CommutativeRing.


Example 1

We define a matrix over the rational numbers:

A := Dom::Matrix(Dom::Rational)([[1, 2], [3, 4]])

Then the characteristic polynomial pA(x) is given by:

linalg::charpoly(A, x)

It is of the domain type:


Example 2

We define a matrix over 7:

B := Dom::Matrix(Dom::IntegerMod(7))([[1, 2], [3, 0]])

The characteristic polynomial pB(x) of B is given by:

p := linalg::charpoly(B, x)

We compute the zeros of pB(x), i.e., the eigenvalues of the matrix B:




A square matrix of a domain of category Cat::Matrix


An identifier

Return Values

Polynomial of the domain Dom::DistributedPolynomial([x],R), where R is the component ring of A.


linalg::charpoly implements Hessenberg's algorithm to compute the characteristic polynomial of a square matrix A. See: Henri Cohen: A Course in Computational Algebraic Number Theory, GTM 138, Springer Verlag.

This algorithm works for any field and requires only O(n3) field operations, in contrast to O(n4) when computing the determinant of the characteristic matrix of A.

Since the size of the components of A in intermediate computations of Hessenberg's algorithm can swell extremely, it is only applied for matrices over Dom::Float and Dom::IntegerMod.

For any other component ring, the characteristic polynomial is computed using the Berkowitz algorithm.


Reference: Jounaidi Abdeljaoued, The Berkowitz Algorithm, Maple and Computing the Characteristic Polynomial in an Arbitrary Commutative Ring, MapleTech Vol 4 No 3, pp 21-32, Birkhäuser, 1997.

See Also

MuPAD Functions

Was this topic helpful?