Characteristic Polynomial Calculator
Enter the entries of your square matrix and choose its size (2x2, 3x3, or 4x4). This calculator finds the characteristic polynomial p(lambda) = det(A - lambdaI), the trace, the determinant, and the real eigenvalues of the matrix. You also get a full step-by-step breakdown showing exactly how the determinant is expanded. The default example is the 2x2 matrix [[2,3],[4,3]] from the literature, giving lambda^2 - 5*lambda - 6.
Formula
Worked example
For A = [[2,3],[4,3]]: tr = 2+3 = 5, det = 2*3 - 3*4 = 6 - 12 = -6. So p(lambda) = lambda^2 - 5*lambda - 6. Factoring: (lambda - 6)(lambda + 1) = 0, giving eigenvalues lambda1 = 6 and lambda2 = -1.
What is the characteristic polynomial?
The characteristic polynomial of an n x n matrix A is the polynomial p(lambda) = det(A - lambdaI), where I is the n x n identity matrix and lambda is an indeterminate variable. This polynomial has degree n and its roots are exactly the eigenvalues of A. It encodes fundamental invariants of the matrix, including the trace (sum of diagonal entries) and the determinant (constant term), as well as all the intermediate principal-minor sums that appear as coefficients. Two matrices with the same characteristic polynomial share the same eigenvalues, the same trace, and the same determinant, which makes it a powerful similarity invariant in linear algebra.
How to compute the characteristic polynomial step by step
Start by subtracting lambda times the identity matrix from A to form A - lambdaI. This replaces each diagonal entry a_ii with (a_ii - lambda) while leaving off-diagonal entries unchanged. Then expand the determinant of A - lambdaI as a polynomial in lambda. For a 2x2 matrix the result is always lambda^2 - tr(A)*lambda + det(A). For a 3x3 matrix the general form is -lambda^3 + tr(A)*lambda^2 - S2*lambda + det(A), where S2 is the sum of the three 2x2 principal minors (the determinants of the three submatrices formed by deleting one row and the same-numbered column). For larger matrices the pattern continues with alternating signs and sums of principal minors of increasing order, a pattern formalised by the Newton-Girard identities and the Faddeev-LeVerrier algorithm.
Eigenvalues, diagonalizability, and the Cayley-Hamilton theorem
The eigenvalues of A are the solutions to p(lambda) = 0. If the characteristic polynomial has n distinct real roots, the matrix is diagonalizable over the reals and can be written as A = P*D*P^{-1}, where D is diagonal with the eigenvalues on its diagonal. Repeated roots (roots of higher multiplicity) may or may not be diagonalizable depending on whether the geometric multiplicity (dimension of the corresponding eigenspace) matches the algebraic multiplicity (the root multiplicity in p). The Cayley-Hamilton theorem states that every square matrix satisfies its own characteristic polynomial: substituting A for lambda in p(lambda) always gives the zero matrix. This remarkable fact allows you to express high powers of A as linear combinations of lower powers, and provides a fast way to compute matrix inverses when the constant term of p is non-zero.
Trace, determinant, and invertibility from the polynomial
Two key properties of A can be read off directly from the characteristic polynomial without solving for eigenvalues. The trace equals (up to a sign) the coefficient of the second-highest power of lambda. For a 2x2 matrix p(lambda) = lambda^2 - tr*lambda + det, so the linear coefficient is -tr and the constant term is det. The matrix is invertible if and only if the constant term det(A) is non-zero, which is the same as saying lambda = 0 is not an eigenvalue. For a 3x3 matrix the coefficient of lambda^2 is the trace, and the pattern of signs alternates for larger sizes following (-1)^k for the coefficient of lambda^(n-k).
Characteristic polynomial by matrix size
| Size | p(lambda) | Degree | Notes |
|---|---|---|---|
| 2x2 | lambda^2 - tr(A)*lambda + det(A) | 2 | Solved by quadratic formula |
| 3x3 | -lambda^3 + tr(A)*lambda^2 - S2*lambda + det(A) | 3 | S2 = sum of 2x2 principal minors |
| 4x4 | lambda^4 - S1*lambda^3 + S2*lambda^2 - S3*lambda + det(A) | 4 | S2, S3 = sums of 2x2 and 3x3 principal minors |
| nxn | (-1)^n * lambda^n + ... + det(A) | n | General Newton-Girard / Faddeev-LeVerrier |
Standard forms of p(lambda) = det(A - lambdaI) for small square matrices, using trace (tr), determinant (det), and principal minors (S2, S3).
Frequently asked questions
What is the characteristic polynomial of a matrix?
The characteristic polynomial of an n x n matrix A is p(lambda) = det(A - lambdaI), where I is the identity matrix and lambda is a variable. It is a degree-n polynomial whose roots are the eigenvalues of A. The coefficients encode invariants of the matrix such as the trace and determinant.
How do I find eigenvalues from the characteristic polynomial?
Set p(lambda) = 0 and solve for lambda. For a 2x2 matrix this is a quadratic you can solve with the quadratic formula. For a 3x3 matrix you solve a cubic, and for 4x4 a quartic. Numerical methods or factoring are often used for degree 3 and above. Each distinct root is an eigenvalue, and if a root repeats k times it has algebraic multiplicity k.
What does the Cayley-Hamilton theorem say?
The Cayley-Hamilton theorem states that every square matrix satisfies its own characteristic polynomial. If p(lambda) = lambda^2 - 5*lambda - 6, for example, then p(A) = A^2 - 5A - 6I = 0 (the zero matrix). This is not obvious, but it is always true. One practical application is computing A^{-1} without row reduction when det(A) is non-zero: rearranging p(A) = 0 gives an expression for A^{-1} as a polynomial in A.
What is the difference between det(A - lambdaI) and det(lambdaI - A)?
These two conventions differ by a factor of (-1)^n, where n is the matrix size. For a 2x2 matrix they are identical because (-1)^2 = 1. For a 3x3 matrix det(lambdaI - A) has a positive leading coefficient (+lambda^3), while det(A - lambdaI) has a negative leading coefficient (-lambda^3). Both definitions have the same roots (eigenvalues), so the choice is a matter of convention. Many textbooks prefer det(lambdaI - A) to get a monic polynomial (leading coefficient 1). This calculator uses det(A - lambdaI), the more common convention in applied settings.
Can a matrix have complex eigenvalues?
Yes. Even for a real-entry matrix, the characteristic polynomial may have complex roots. For example, the rotation matrix [[0,-1],[1,0]] has p(lambda) = lambda^2 + 1, whose roots are +i and -i. Complex eigenvalues always come in conjugate pairs when the matrix entries are real. This calculator detects when the 2x2 discriminant is negative and reports complex eigenvalues; for 3x3 and 4x4 it reports the count of real roots.
What are principal minors and why do they appear as coefficients?
A k x k principal minor of A is the determinant of the k x k submatrix formed by selecting k rows and the same k columns (keeping the same index set). For example, the 2x2 principal minors of a 3x3 matrix are the determinants of the three 2x2 submatrices along the diagonal. These sums of principal minors appear as the coefficients of the characteristic polynomial because of how the determinant of A - lambdaI expands: each term carrying lambda^(n-k) arises exactly from choosing k diagonal entries to subtract lambda from.