Characteristic Polynomial Calculator: Three Numbers That Write det(xI − A)
About the Author

A characteristic polynomial calculator compresses an entire square matrix into one polynomial, det(xI − A), whose roots are the matrix’s eigenvalues. Here’s the part most students find out late: you almost never need to expand that determinant. For a 2×2 matrix the polynomial is always x² − tr(A)x + det(A) — two numbers you can read straight off the matrix — and the 3×3 case needs just one more ingredient.
The tool above accepts a 2×2 or 3×3 matrix and shows the whole chain: the symbolic matrix xI − A, the trace-and-minors recipe for each coefficient, the finished polynomial in your choice of convention and variable, the eigenvalue roots with multiplicities, and a live Cayley–Hamilton check that feeds A back into its own polynomial. Below, the same ideas by hand: the 2×2 and 3×3 shortcuts, the sign-convention split between textbooks, a table of polynomials you can write on sight, and what the roots and coefficients tell you before you solve anything.
Trace and Determinant Write the Whole 2×2 Polynomial
Take A = [[4, 2], [1, 3]]. The trace is the diagonal sum, 4 + 3 = 7. The determinant is 4·3 − 2·1 = 10. That’s everything:
Why does this work? Expand the determinant honestly once: det(xI − A) = (x − 4)(x − 3) − (2)(1) = x² − 7x + 12 − 2 = x² − 7x + 10. The x-coefficient collects −4 and −3 — the negated diagonal, which is −tr(A) — and the constant term is what’s left when x = 0, which is det(−A) = det(A) for a 2×2. The formula isn’t a trick; it’s the expansion with the bookkeeping done once, forever.
The 3×3 Shortcut Every Characteristic Polynomial Calculator Uses
Expanding det(xI − A) symbolically for a 3×3 matrix means multiplying binomials inside six triple products — a swamp of sign errors. The coefficient route replaces all of it with three plain-number computations:
Here M₁₁, M₂₂, M₃₃ are the principal minors: delete row 1 and column 1 (then 2, then 3) and take the 2×2 determinant of what remains. For A = [[2, 1, 0], [1, 2, 0], [0, 0, 3]]:
- tr(A) = 2 + 2 + 3 = 7
- M₁₁ = det[[2, 0], [0, 3]] = 6, M₂₂ = det[[2, 0], [0, 3]] = 6, M₃₃ = det[[2, 1], [1, 2]] = 3 → sum 15
- det(A) = 3·(2·2 − 1·1) = 9
So p(x) = x³ − 7x² + 15x − 9, which factors as (x − 1)(x − 3)². Three small determinants of actual numbers, no symbolic algebra anywhere. Notice the sign rhythm too: the coefficients alternate −, +, − after the leading x³. That alternation is structural — the coefficient of xⁿ⁻ᵏ is (−1)ᵏ times the sum of the k×k principal minors — so a wrong sign pattern in your answer is an instant red flag.
det(xI − A) vs det(A − xI): Same Roots, Different Sign
Open two linear algebra books and you’ll likely meet two different definitions of the characteristic polynomial. They differ by exactly the factor (−1)ⁿ, so for even sizes they agree and for odd sizes every sign flips:
| det(xI − A) | det(A − xI) | |
|---|---|---|
| Leading coefficient | always +1 (monic) | (−1)ⁿ |
| 2×2 example above | x² − 7x + 10 | x² − 7x + 10 (identical) |
| 3×3 example above | x³ − 7x² + 15x − 9 | −x³ + 7x² − 15x + 9 |
| Roots (eigenvalues) | 1, 3, 3 | 1, 3, 3 (identical) |
| Typically used in | abstract algebra texts; anywhere monic matters | intro courses — subtracting x down the diagonal feels natural |
Neither is wrong, and eigenvalues can’t tell the difference — multiplying a polynomial by −1 moves no root. It only bites when an answer key expects one form and you hand in the other, which is why the calculator has a convention toggle instead of an opinion. If your homework says −λ³ + 7λ² − 15λ + 9 and the tool says λ³ − 7λ² + 15λ − 9, you’re both right.
Characteristic Polynomials You Can Read On Sight
Some matrix shapes give up their polynomial without any computation. Recognizing them saves real time on exams, because a triangular matrix hides its eigenvalues in plain view:
| Matrix | Characteristic polynomial | Why |
|---|---|---|
| Triangular or diagonal, entries d₁ … dₙ on the diagonal | (x − d₁)···(x − dₙ) | xI − A stays triangular; its determinant is the diagonal product |
| Identity Iₙ | (x − 1)ⁿ | diagonal case with every dᵢ = 1 |
| Zero matrix, or any nilpotent Jordan block | xⁿ | all eigenvalues are 0 |
| 2×2 rotation by angle θ | x² − 2cos(θ)·x + 1 | trace 2cos(θ), determinant 1; complex roots unless θ = 0 or π |
| Companion matrix of a monic polynomial q | q(x) itself | built so that its characteristic polynomial is q — every monic polynomial arises this way |
The companion-matrix row answers a question worth pausing on: which polynomials can show up as characteristic polynomials? All of them (monic ones, anyway). The map from matrices to polynomials is onto — but it’s far from one-to-one. The 2×2 zero matrix and [[0, 1], [0, 0]] both have p(x) = x², yet one is as tame as matrices get and the other isn’t even diagonalizable. A characteristic polynomial pins down the eigenvalues, never the whole matrix.
From Roots to Eigenvalues — and Two Instant Checks
Setting p(x) = 0 gives the characteristic equation, and its solutions are precisely the eigenvalues of A. For x³ − 7x² + 15x − 9 = (x − 1)(x − 3)² the eigenvalues are 1 and 3, with 3 counted twice — its algebraic multiplicity is 2. Whether that repeated eigenvalue also carries two independent eigenvectors is a separate question, and it decides whether you can diagonalize the matrix.
Before solving anything, Vieta’s formulas hand you two free checks. The sum of all roots equals tr(A), and the product equals det(A). Our example: 1 + 3 + 3 = 7 = tr(A), and 1·3·3 = 9 = det(A). Both hold — and they’re sensitive enough that a single sign error in a coefficient almost always breaks one of them. This also explains a fact you may have met elsewhere: a matrix is singular exactly when 0 is an eigenvalue, because a zero root forces the product of roots, det(A), to be 0.
One more thing the polynomial quietly encodes: similarity. For any invertible P, det(xI − P⁻¹AP) = det(P⁻¹(xI − A)P) = det(xI − A), so similar matrices — same transformation, different basis — share one characteristic polynomial. That’s why trace and determinant survive every change of basis: they’re coefficients of an invariant.
Cayley–Hamilton: Feed the Matrix Its Own Polynomial
The Cayley–Hamilton theorem says every matrix satisfies its own characteristic equation: substitute A for x (and multiply the constant term by I) and the result is the zero matrix. With A = [[4, 2], [1, 3]] and p(x) = x² − 7x + 10:
A² = [[18, 14], [7, 11]]
A² − 7A + 10I = [[18 − 28 + 10, 14 − 14], [7 − 7, 11 − 21 + 10]] = [[0, 0], [0, 0]] ✓
This isn’t a party trick — it’s a workhorse. Rearranging A² − 7A + 10I = 0 gives A⁻¹ = (7I − A)/10, an inverse with no row reduction: [[0.3, −0.2], [−0.1, 0.4]], which you can verify multiplies back to I. It also tames high matrix powers: since A² = 7A − 10I, every higher power collapses to a combination of A and I. A³ = 7A² − 10A = 7(7A − 10I) − 10A = 39A − 70I — computed with two scalar multiplications instead of two matrix products. The calculator’s bottom panel runs exactly this substitution on your matrix and shows the zero matrix it lands on, entry by entry.



