gives the characteristic polynomial for the matrix m.
CharacteristicPolynomial[{m,a},x]
gives the generalized characteristic polynomial with respect to a.
CharacteristicPolynomial
gives the characteristic polynomial for the matrix m.
CharacteristicPolynomial[{m,a},x]
gives the generalized characteristic polynomial with respect to a.
Details
- m must be a square matrix.
- It can contain numeric or symbolic entries.
- CharacteristicPolynomial[m,x] is essentially equivalent to Det[m-id x] where id is the identity matrix of appropriate size. »
- CharacteristicPolynomial[{m,a},x] is essentially Det[m-a x]. »
Examples
open all close allBasic Examples (3)
Find the characteristic polynomial of a matrix with integer entries:
CharacteristicPolynomial[{{1, 2}, {3, 4}}, x]Plot[%, {x, -5, 10}]Find the characteristic polynomial in
of the symbolic matrix
:
m = (| | |
| - | - |
| a | b |
| c | d |);CharacteristicPolynomial[m, x]Compare with a direct computation:
Det[m - x IdentityMatrix[2]]Compute the characteristic polynomials of the identity matrix and zero matrix:
CharacteristicPolynomial[IdentityMatrix[3], λ]CharacteristicPolynomial[ConstantArray[0, {10, 10}], λ]Scope (17)
Basic Uses (7)
Find the characteristic polynomial of a machine-precision matrix:
CharacteristicPolynomial[{{1.1, 2.2, 3.25}, {0.76, 4.6, 5}, {0.1, 0.1, 6.1}}, x]CharacteristicPolynomial[Table[N[1 / (i + j + 1), 20], {i, 3}, {j, 3}], x]Characteristic polynomial of a complex matrix:
CharacteristicPolynomial[{{1.2 + I, 3 - 2 I, 3 π}, {-0.2, 5I, 2}, {1, 2.3, E}}, x]Characteristic polynomial of an exact matrix:
CharacteristicPolynomial[{{(1/3), (1/2), (3/5)}, {(1/2), (4/5), 1}, {(3/5), 1, (9/7)}}, x]Plot[%, {x, -1.5, 2.5}]The characteristic polynomials of large numerical matrices are computed efficiently:
m = RandomReal[{1, 9}, {100, 100}];CharacteristicPolynomial[m, x];//TimingCharacteristic polynomial of a matrix with finite field elements:
ℱ = FiniteField[43, 2];
CharacteristicPolynomial[{{ℱ[12], ℱ[23], ℱ[34]}, {ℱ[45], ℱ[56], ℱ[67]}, {ℱ[78], ℱ[89], ℱ[90]}}, x]Characteristic polynomial of a matrix containing CenteredInterval objects:
(m = Map[CenteredInterval, RandomReal[{-10, 10}, {3, 3}, WorkingPrecision -> 10], {2}])//MatrixFormp = CharacteristicPolynomial[m, x]Find a random representative mrep of m:
ranrep[e_CenteredInterval] := e["Center"] + RandomInteger[{-1000, 1000}] / 1000 e["Radius"]
(mrep = Map[ranrep, m, {2}])//MatrixFormVerify that the coefficients of p contain the coefficients of the characteristic polynomial of mrep:
MapThread[IntervalMemberQ, {CoefficientList[p, x], CoefficientList[CharacteristicPolynomial[mrep, x], x]}]Generalized Eigenvalues (4)
The generalized characteristic polynomial of two matrices:
m1 = {{1, 2}, {5, 4}};m2 = {{4, 3}, {6, 4}};CharacteristicPolynomial[{m1, m2}, x]Det[m1 - x m2]A generalized characteristic polynomial of machine-precision matrices:
a = {{1., 1.5, 2.}, {3.1, 2., 2.9}, {3., 2., 1.}};b = {{1.3, .5, 1.1}, {0., 1.5, 2.3}, {1., 0., 1.}};CharacteristicPolynomial[{a, b}, x]Find a generalized exact characteristic polynomial:
a = {{1, 1, 1}, {1, 0, 1}, {0, 0, 1}};b = {{0, 1, 1}, {0, 1, 1}, {1, 0, 0}};CharacteristicPolynomial[{a, b}, x]The absence of an
term indicates an infinite generalized eigenvalue:
Eigenvalues[{a, b}]Compute the result at finite precision:
CharacteristicPolynomial[N[{a, b}, 20], y]Find the generalized characteristic polynomial of symbolic matrices:
a = {{x, 1 + x}, {1 - x, x}};b = {{1, 1}, {1, 2x}};
CharacteristicPolynomial[{a, b}, y]Special Matrices (6)
Characteristic polynomials of sparse matrices:
SparseArray[{{1, 3} -> 2, {2, 2} -> 3, {3, 1} -> 1, {4, 2} -> 5}, {4, 4}]CharacteristicPolynomial[%, x]SparseArray[{{x_, y_} /; Abs[x - y] < 3 -> 1}, {10, 10}]CharacteristicPolynomial[%, x]Characteristic polynomials of structured matrices:
SymmetrizedArray[{{1, 1} -> 2, {1, 2} -> 1}, {2, 2}, Symmetric[All]]CharacteristicPolynomial[%, x]QuantityArray[{{1, 2}, {3, 4}}, {"Meters", "Meters"}]CharacteristicPolynomial[%, x]The characteristic polynomial of an identity matrix is a binomial expansion:
CharacteristicPolynomial[IdentityMatrix[12], λ]Factor[%]Characteristic polynomial of HilbertMatrix[n]:
CharacteristicPolynomial[HilbertMatrix[5], λ]The characteristic polynomial of JordanMatrix[λ,n] is
:
CharacteristicPolynomial[JordanMatrix[λ, 4], x] == (λ - x)^4//SimplifyCharacteristicPolynomial[JordanMatrix[λ, 5], x] == (λ - x)^5//SimplifyThe minimal polynomial of CompanionMatrix[{c0,c1,…,cn}]:
CompanionMatrix[{c0, c1, c2, c3}]//MatrixFormCharacteristicPolynomial[%, x]Applications (6)
Find the characteristic polynomial of the matrix
and compare the behavior for
,
and
:
m = (| | | |
| -- | --- | --- |
| -6 | 28 | 21 |
| 4 | -15 | -12 |
| -8 | a | 25 |)cp = CharacteristicPolynomial[m, x]Examining the roots, there is a root at
independent of
:
roots = SolveValues[cp == 0, x]roots /. a -> 32For
there are three distinct real roots:
roots /. a -> 31And for
,
is the only real root, with the other two roots a complex conjugate pair:
roots /. a -> 33Visualize the three polynomials, zooming in on the "bounce" of the plot at the double root
:
{Plot[Table[cp, {a, {32, 31, 33}}]//Evaluate, {x, -3, 6}, PlotLegends -> LineLegend[{a == 32, a == 31, a == 33}], ImageSize -> Small],
Plot[cp /. a -> 32, {x, 0.5, 2.5}, PlotLegends -> LineLegend[{a == 32}], ImageSize -> Small]}//RowCompute the determinant of a matrix as the constant term in its characteristic polynomial:
m = {{6, 5, 8, 1, 4}, {8, 0, 2, 7, 1}, {7, 4, 0, 8, 3}, {2, 3, 1, 1, 6}, {0, 4, 8, 2, 3}};cp = CharacteristicPolynomial[m, x]cp /. x -> 0This result is also the product of the roots of the characteristic polynomial:
Times @@ SolveValues[cp == 0, x] // FullSimplifyCompare with a direct computation using Det:
Det[m]Compute the trace of a matrix as the coefficient of the subleading power term in the characteristic polynomial:
m = {{4, 3, 8, 9}, {8, 1, 0, 7}, {1, 2, 6, 7}, {2, 5, 1, 2}};cp = CharacteristicPolynomial[m, x]Extract the coefficient of
, where
is the height or width of the matrix:
(-1)^Length[m] - 1Coefficient[cp, x^Length[m] - 1]This result is also the sum of the roots of the characteristic polynomial:
Total[SolveValues[cp == 0, x]]//FullSimplifyCompare with a direct computation using Tr:
Tr[m]Find the eigenvalues of a matrix as the roots of the characteristic polynomial:
m = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};SolveValues[CharacteristicPolynomial[m, x] == 0, x]Compare with a direct computation using Eigenvalues:
Eigenvalues[m]Use the characteristic polynomial to find the eigenvalues and eigenvectors of the matrices
and
:
a = {{3, 9, 4}, {3, 7, 1}, {8, 1, 8}};cp = CharacteristicPolynomial[a, x]The two matrices have the same characteristic polynomial:
CharacteristicPolynomial[Transpose[a], x] == cpThus, they will both have the same eigenvalues, which are the roots of the polynomial:
λ = SolveValues[cp == 0, x]The eigenvectors are given by the null space of
:
Subscript[v, λ] = Join[NullSpace[a - λ[[1]]IdentityMatrix[3]], NullSpace[a - λ[[2]]IdentityMatrix[3]], NullSpace[a - λ[[3]]IdentityMatrix[3]]]//FullSimplifyEigensystem gives the same result, though it sorts eigenvalues by absolute value:
Eigensystem[a]While
has the same eigenvalues as
, it has different eigenvectors:
Subsuperscript[v, λ, * ] = Join[NullSpace[a - λ[[1]]IdentityMatrix[3]], NullSpace[a - λ[[2]]IdentityMatrix[3]], NullSpace[a - λ[[3]]IdentityMatrix[3]]]//FullSimplifyVisualize the two sets of eigenvectors:
{MatrixPlot[Subscript[v, λ]], MatrixPlot[Subsuperscript[v, λ, * ]]}Find the generalized eigensystem of
with respect to
as the roots of the characteristic polynomial:
a = {{1., 1.5, 2.}, {3.1, 2., 2.9}, {3., 2., 1.}};b = {{1.3, .5, 1.1}, {0., 1.5, 2.3}, {1., 0., 1.}};CharacteristicPolynomial[{a, b}, x]The roots of the generalized characteristic polynomial are the generalized eigenvalues:
λ = SolveValues[% == 0, x]The generalized eigenvectors are given by the null space of
:
Subscript[v, λ] = Join[NullSpace[a - λ[[1]]b], NullSpace[a - λ[[2]]b], NullSpace[a - λ[[3]]b]]//FullSimplifyCompare with a direct computation using Eigensystem:
Eigensystem[{a, b}]Properties & Relations (10)
The characteristic polynomial is equivalent to Det[m-id x]:
m = RandomInteger[9, {10, 10}];cp = CharacteristicPolynomial[m, x]% == Det[m - IdentityMatrix[Length[m]] x]The generalized characteristic polynomial is equivalent to Det[m-a x]:
{m, a} = RandomInteger[9, {2, 5, 5}];CharacteristicPolynomial[{m, a}, x]% == Det[m - a x]A matrix is a root of its characteristic polynomial (Cayley–Hamilton theorem [more...]):
m = RandomInteger[10, {10, 10}];
cp = CharacteristicPolynomial[m, x];
MatrixPolynomialValue[cp, m, x] == ConstantArray[0, {10, 10}]MatrixPolynomialValue[cp, m, x]//AbsoluteTiming
where
are the eigenvalues is equivalent to the characteristic polynomial:
m = RandomReal[1, {10, 10}];Product[(v - x), {v, Eigenvalues[m]}] - CharacteristicPolynomial[m, x]//Simplify//ChopThe sum of the roots of the characteristic polynomial is the trace (Tr) of the matrix:
m = RandomReal[1, {10, 10}];roots = SolveValues[CharacteristicPolynomial[m, x] == 0, x];Total[roots] == Tr[m]Similarly, the product of the roots is the determinant (Det):
Times @@ roots == Det[m]A matrix and its transpose have the same characteristic polynomial:
m = RandomReal[1, {10, 10}];CharacteristicPolynomial[m, x] == CharacteristicPolynomial[Transpose[m], x]All triangular matrices with a common diagonal have the same characteristic polynomial:
t1 = (| | | |
| - | - | - |
| 1 | 0 | 0 |
| 0 | 1 | 0 |
| 0 | 0 | 1 |);t2 = (| | | |
| - | - | - |
| 1 | 4 | 0 |
| 0 | 1 | 3 |
| 0 | 0 | 1 |);t3 = (| | | |
| - | - | - |
| 1 | 0 | 0 |
| 5 | 1 | 0 |
| 6 | 7 | 1 |);CharacteristicPolynomial[t1, x] == CharacteristicPolynomial[t2, x] == CharacteristicPolynomial[t3, x]If
is a monic polynomial, then the characteristic polynomial of its companion matrix is
:
cl = RandomInteger[9, 10];
p = cl.x ^ Range[0, 9] + x ^ 10CharacteristicPolynomial[CompanionMatrix[cl], x] == pMatrixMinimalPolynomial[m,λ] divides CharacteristicPolynomial[m,λ] with a (possibly constant) polynomial quotient:
mat = (| | | |
| - | -- | -- |
| 0 | -1 | 1 |
| 1 | 2 | -1 |
| 1 | 1 | 0 |);
PolynomialQuotientRemainder[CharacteristicPolynomial[mat, t], MatrixMinimalPolynomial[mat, t], t]The minimal polynomial and the characteristic polynomial have the same distinct roots:
a = (| | | | |
| -- | -- | - | - |
| -6 | 4 | 0 | 9 |
| -3 | 0 | 1 | 6 |
| -1 | -2 | 1 | 0 |
| -4 | 4 | 0 | 7 |);
χ = CharacteristicPolynomial[a, λ];
μ = MatrixMinimalPolynomial[a, λ];
Roots[μ == 0, λ] == DeleteDuplicates[Roots[χ == 0, λ]]In particular, this means
divides
raised to the
power:
PolynomialRemainder[μ ^ LCM@@(Max@Cases[#, λ ^ k_ :> k, -1]& /@ {μ, χ}), χ, λ]Tech Notes
Related Guides
History
Introduced in 2003 (5.0) | Updated in 2007 (6.0) ▪ 2024 (14.0)
Text
Wolfram Research (2003), CharacteristicPolynomial, Wolfram Language function, https://reference.wolfram.com/language/ref/CharacteristicPolynomial.html (updated 2024).
CMS
Wolfram Language. 2003. "CharacteristicPolynomial." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/CharacteristicPolynomial.html.
APA
Wolfram Language. (2003). CharacteristicPolynomial. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CharacteristicPolynomial.html
BibTeX
@misc{reference.wolfram_2026_characteristicpolynomial, author="Wolfram Research", title="{CharacteristicPolynomial}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/CharacteristicPolynomial.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_characteristicpolynomial, organization={Wolfram Research}, title={CharacteristicPolynomial}, year={2024}, url={https://reference.wolfram.com/language/ref/CharacteristicPolynomial.html}, note=[Accessed: 12-June-2026]}