Quantcast

Documentation Center

  • Trial Software
  • Product Updates

charpoly

Characteristic polynomial of matrix

Syntax

charpoly(A)
charpoly(A,var)

Description

charpoly(A) returns a vector of the coefficients of the characteristic polynomial of A. If A is a symbolic matrix, charpoly returns a symbolic vector. Otherwise, it returns a vector of double-precision values.

charpoly(A,var) returns the characteristic polynomial of A in terms of var.

Input Arguments

A

Matrix.

var

Free symbolic variable.

Default: If you do not specify var, charpoly returns a vector of coefficients of the characteristic polynomial instead of returning the polynomial itself.

Examples

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

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

To find the coefficients of the characteristic polynomial of A, call charpoly with one argument:

A = sym([1 1 0; 0 1 0; 0 0 1]);
charpoly(A)
ans =
[ 1, -3, 3, -1]
 

Find the coefficients of the characteristic polynomial of the symbolic matrix A. For this matrix, charpoly returns the symbolic vector of coefficients:

A = sym([1 2; 3 4]);
P = charpoly(A)
P =
[ 1, -5, -2]

Now find the coefficients of the characteristic polynomial of the matrix B, all elements of which are double-precision values. Note that in this case charpoly returns coefficients as double-precision values:

B = ([1 2; 3 4]);
P = charpoly(B)
P =
     1    -5    -2

More About

expand all

Characteristic Polynomial of a Matrix

The characteristic polynomial of an n-by-n matrix A is the polynomial pA(x), such that

Here In is the n-by-n identity matrix.

References

[1] Cohen, H. "A Course in Computational Algebraic Number Theory." Graduate Texts in Mathematics (Axler, Sheldon and Ribet, Kenneth A., eds.). Vol. 138, Springer, 1993.

[2] Abdeljaoued, J. "The Berkowitz Algorithm, Maple and Computing the Characteristic Polynomial in an Arbitrary Commutative Ring." MapleTech, Vol. 4, Number 3, pp 21–32, Birkhauser, 1997.

See Also

| | | | |

Was this topic helpful?