What is the characteristic polynomial?
Type a square matrix up to 6 × 6; cells may be fractions such as 1/3. The page gives the characteristic polynomial in exact fractions and factors out every rational root.
- p(λ) = det(λI − A)
- λ² + λ − 6
The characteristic polynomial is λ² + λ − 6.
- Factored
- (λ + 3)(λ − 2)
- det(A − λI)
- λ² + λ − 6
p(λ) = det(λI − A): λ² + λ − 6. The characteristic polynomial is λ² + λ − 6.
How to calculate
Finds the characteristic polynomial det(λI − A) of a square matrix in exact fractions, factored over the rationals.
Example with the default inputs (Matrix A [-5, 2; -7, 4]): The characteristic polynomial is λ² + λ − 6.
Method: The Faddeev-LeVerrier recurrence in exact fractions; rational roots found numerically and confirmed by exact division.
- Cells are exact: 0.1 is 1/10, 1/3 is 1/3.
- A factor with no rational root stays whole.
Worked examples
Each example is checked against the calculator on every build.
- Matrix A -5, 2; -7, 4 gives p(λ) = det(λI − A) λ² + λ − 6, Factored (λ + 3)(λ − 2).Source: Kuttler, A First Course in Linear Algebra, 7.1, Example 7.1.2. https://math.libretexts.org/Bookshelves/Linear_Algebra/A_First_Course_in_Linear_Algebra_(Kuttler)/07%3A_Spectral_Theory/7.01%3A_Eigenvalues_and_Eigenvectors_of_a_Matrix
- Matrix A 5, -10, -5; 2, 14, 2; -4, -8, 6 gives p(λ) = det(λI − A) λ³ − 25λ² + 200λ − 500, Factored (λ − 5)(λ − 10)².
How it works
For a square matrix A (1 × 1 to 6 × 6), the page computes p(λ) = det(λI − A) exactly.
Reading the cells. A cell typed as a decimal with up to 15 significant digits is that decimal exactly: 0.8 is 4/5. A cell typed as a fraction such as 1/3 reaches the page as a rounded number; it is read as the fraction with the smallest denominator (up to 1,000,000) that rounds to the same number, so 1/3 is exactly 1/3.
The polynomial. The Faddeev-LeVerrier recurrence runs in exact fractions: M₁ = I, and for k = 1 to n, cₙ₋ₖ = −trace(A·Mₖ)/k and Mₖ₊₁ = A·Mₖ + cₙ₋ₖ·I. Then p(λ) = λⁿ + cₙ₋₁λⁿ⁻¹ + … + c₀. det(A − λI) is (−1)ⁿ p(λ).
Factoring. To find the rational roots of p, the page takes the square-free part s = p ÷ gcd(p, p′) (exact), whose zeros are those of p, each once. While s has degree 2 or more, it finds the complex roots of s numerically (Durand-Kerner iteration, 800 rounds, starting on a circle whose radius is Fujiwara’s bound 2 × max |aₙ₋ₖ/aₙ|^(1/k), with a₀ halved). For each root whose imaginary part is within 10⁻⁷ × max(1, |real part|) of 0, it tries in turn the convergents of the continued fraction of the real part that lie within 10⁻³ × max(1, |root|) of it, with denominators up to 10¹²; a convergent r is a zero when s divided by (λ − r) leaves remainder exactly 0. Then s is divided by (λ − r) and the roots are found again. Before this, each diagonal entry of A is tried the same way, so a triangular matrix always gets its eigenvalues exactly. When s has degree 1, its zero −s₀/s₁ is a fraction. The multiplicity of each fraction root r is the number of times (λ − r) divides p exactly. The rest of p, after dividing out all these factors, stays whole.
How answers are written
- p(λ) and det(A − λI): powers of λ from the highest down, as superscripts (λ³), terms joined by + and −. A coefficient 1 is left out; a whole-number coefficient is written before λ (6λ²); a fraction is written in brackets before λ ((3/2)λ); the constant term is written as a fraction (1/2). A term with coefficient 0 is left out.
- Factored: each rational root r as (λ − r) or (λ + |r|), with λ alone for the root 0, in increasing order of r, a multiplicity above 1 as a superscript: (λ + 2)²(λ − 3). The part with no rational root follows in brackets, or alone when there is no rational root.
Assumptions
- Cells are exact: 0.1 is 1/10 and 1/3 is 1/3.
- A factor with no root found as a fraction is not split further. Its roots may be irrational, complex, or (rarely) fractions with denominators over about 10⁷ that are not diagonal entries.
Worked examples by hand
A = [−5, 2; −7, 4] (Kuttler, A First Course in Linear Algebra, section 7.1, Example 7.1.2). det(λI − A) = (λ + 5)(λ − 4) − (−2)(7) = λ² + λ − 20 + 14 = λ² + λ − 6 = (λ + 3)(λ − 2), so the eigenvalues are −3 and 2.
A = [5, −10, −5; 2, 14, 2; −4, −8, 6] (Example 7.1.3). The trace is 25, so c₂ = −25; det(A) = 500, so c₀ = −500; the sum of the 2 × 2 principal minors is 90 + 10 + 100 = 200, so c₁ = 200. p(λ) = λ³ − 25λ² + 200λ − 500 = (λ − 5)(λ² − 20λ + 100) = (λ − 5)(λ − 10)².
Other questions people ask
What is the characteristic polynomial?
For an n × n matrix A, the characteristic polynomial is p(λ) = det(λI − A), a polynomial of degree n in λ with leading coefficient 1. Its roots are the eigenvalues of A: λ is an eigenvalue exactly when λI − A is singular, so its determinant is 0.
det(λI − A) or det(A − λI)?
Both are used. det(A − λI) = (−1)ⁿ det(λI − A), so the two are the same polynomial for an even n and differ in sign for an odd n. Their roots, the eigenvalues, are the same. The page shows both.
What do the coefficients tell me?
In p(λ) = λⁿ + cₙ₋₁λⁿ⁻¹ + … + c₀, the coefficient cₙ₋₁ is −trace(A) (minus the sum of the diagonal) and c₀ is (−1)ⁿ det(A). For the 2 × 2 matrix [a, b; c, d], p(λ) = λ² − (a + d)λ + (ad − bc).
How is the polynomial factored?
Every root that is a fraction (a rational number) and that the method in How it works finds becomes a factor (λ − r), with its multiplicity as a power: (λ − 5)(λ − 10)². It finds them all except, rarely, a fraction root with a large denominator (over about 10⁷) that is not a diagonal entry, or two fraction roots with large denominators closer together than about 10⁻⁷. What is left stays as one factor, such as λ² − 5λ − 2 for [1, 2; 3, 4], whose roots (5 ± √33)/2 are irrational.
Why exact fractions?
The page never rounds: each cell is read as an exact fraction (0.8 is 4/5, 1/3 is 1/3) and every step is exact, so a coefficient such as −3/2 is exactly −3/2. A calculator working in decimals would show −1.5 or −1.4999999.
How is this different from the eigenvector calculator?
This page gives the polynomial itself, exactly, with its factors over the rationals. The eigenvector calculator gives each eigenvalue and a unit eigenvector as decimals, including complex ones; the matrix diagonalization calculator gives A = P D P⁻¹ in fractions.