charpoly (or pcar) takes one or two argument(s),
a square matrix A of size n and optionnally
the name of a symbolic variable.
charpoly returns the characteristic polynomial P of A written as the list of its coefficients if no variable name was provided or written as an expression with respect to the variable name provided as second argument.
The characteristic polynomial P of A is defined as
Hence, the characteristic polynomial of this matrix is
x3−6x2+12x−8 (input normal(poly2symb([1,-6,12,-8],x)) to get
its symbolic representation).