Minimal Polynomial Calculator: How It Works
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
This calculator computes the minimal polynomial of a square matrix over the rational numbers. You enter the matrix size and its entries, and it returns the unique monic polynomial of lowest degree that annihilates the matrix. The result is shown as a polynomial in x, with integer coefficients when possible.
Formula
The minimal polynomial of a square matrix A is the monic polynomial m(x) of smallest degree such that m(A) = 0 (the zero matrix). It always divides the characteristic polynomial p(x) = det(xI − A). For an n×n matrix, the minimal polynomial has degree at most n.
For the default 3×3 matrix:
- A = [[0,1,0],[0,0,1],[1,0,0]]
- Characteristic polynomial: p(x) = x³ − 1 = (x−1)(x²+x+1)
- Check A³ = I, so A³ − I = 0. The polynomial x³−1 annihilates A.
- No lower-degree monic polynomial annihilates A (since A is not a scalar matrix and A² ≠ I).
- Thus the minimal polynomial is x³ − 1, written as x^3 – 1.
In the calculator output, the polynomial is displayed with x as the variable, and coefficients are integers. The default matrix is a permutation matrix of order 3, so its minimal polynomial is x³ − 1.
How the Calculator Works
The calculator uses a standard algorithm based on the Cayley–Hamilton theorem and linear algebra over the rationals. It constructs the sequence of vectors v, Av, A²v, … for a generic vector v (usually the first standard basis vector) and finds the first linear dependence. That dependence gives the coefficients of the minimal polynomial.
More precisely, for a matrix A of size n, the algorithm:
- Starts with a random vector b (or a basis vector).
- Computes the Krylov sequence b, Ab, A²b, … until the vectors become linearly dependent.
- Finds the coefficients c₀, c₁, …, cₖ₋₁ such that Aᵏb + cₖ₋₁Aᵏ⁻¹b + … + c₀b = 0.
- Forms the polynomial xᵏ + cₖ₋₁xᵏ⁻¹ + … + c₀.
- Divides by the leading coefficient to make it monic.
For most matrices, a single random vector gives the full minimal polynomial. For some matrices (e.g., those with repeated eigenvalues and nontrivial Jordan blocks), the algorithm may need to combine results from several vectors to get the true minimal polynomial. The calculator handles this by checking that the computed polynomial annihilates the matrix.
When to Use the Minimal Polynomial
The minimal polynomial is a fundamental tool in linear algebra. It appears in:
- Determining whether a matrix is diagonalizable (the minimal polynomial has no repeated roots).
- Computing matrix functions like e⁽A⁾ or Aᵏ using polynomial interpolation.
- Finding the Jordan canonical form and understanding the structure of a matrix.
- Solving linear recurrences and differential equations.
- Cryptography and coding theory, where matrices over finite fields are used.
You would typically use this calculator when you need the minimal polynomial for a homework problem, a research calculation, or a quick check of your own work. It is especially useful for matrices larger than 3×3, where hand computation becomes tedious.
Common Mistakes and Misconceptions
A frequent error is confusing the minimal polynomial with the characteristic polynomial. The characteristic polynomial always has degree n, while the minimal polynomial can have a lower degree. For example, the identity matrix of size 3 has characteristic polynomial (x−1)³ but minimal polynomial x−1.
Another mistake is forgetting that the minimal polynomial must be monic (leading coefficient 1). Some textbooks define it without that requirement, but the standard definition includes it. Always check that the leading coefficient is 1.
When computing by hand, students often try to factor the characteristic polynomial and then test each factor. That works, but you must test all divisors of the characteristic polynomial, not just the irreducible factors. For instance, a matrix with characteristic polynomial (x−1)²(x−2) could have minimal polynomial (x−1)(x−2) or (x−1)²(x−2).
Also, the minimal polynomial depends on the field you are working over. This calculator works over the rationals, so it will not factor x²+1 into (x+i)(x−i). If you need the minimal polynomial over the complex numbers, you would need to factor further.
How to Choose the Matrix Size
The calculator accepts matrix sizes from 2 to 6. For larger matrices, the computation becomes heavy, and the result may have large coefficients. If you have a matrix larger than 6×6, consider breaking it into blocks or using a computer algebra system.
When entering the matrix, use integers or fractions (as decimals). The calculator will convert decimals to fractions exactly if possible. For example, 0.5 becomes 1/2. If you enter a decimal that is not exactly representable as a fraction (like 0.3333333333), the calculator may produce a rational approximation, which can lead to a wrong minimal polynomial. For exact results, enter fractions as decimals only if they are exact (e.g., 0.25, 0.5, 0.75) or use a tool that accepts fractions.
For matrices with symbolic entries (like variables), this calculator does not work. It only handles numeric matrices.
Limitations of the Algorithm
The algorithm assumes exact arithmetic over the rationals. If you enter a matrix with floating-point numbers that are not exact fractions, the result may be incorrect. For example, entering 0.3333333333 for 1/3 will cause the algorithm to treat it as a rational number with a huge denominator, potentially producing a minimal polynomial that is not the true one.
Also, the algorithm uses a random vector to start the Krylov sequence. For most matrices, any vector works, but for some pathological matrices (e.g., those with a single Jordan block), a random vector might not generate the full minimal polynomial. The calculator mitigates this by checking the result and, if necessary, using additional vectors.
Finally, the calculator only works for square matrices. Minimal polynomials are defined only for square matrices.
Comparison with Characteristic Polynomial
The characteristic polynomial is easier to compute (it’s just det(xI−A)) but contains more information than needed for many applications. The minimal polynomial is the “essential” polynomial that captures the algebraic properties of the matrix. For diagonalizable matrices, the minimal polynomial is the product of distinct linear factors, while the characteristic polynomial includes multiplicities.
For example, the matrix [[1,1],[0,1]] has characteristic polynomial (x−1)² and minimal polynomial (x−1)². The matrix [[1,0],[0,1]] has characteristic polynomial (x−1)² but minimal polynomial (x−1). The minimal polynomial tells you that the first matrix is not diagonalizable, while the second is.
When you need to compute powers of a matrix, the minimal polynomial allows you to reduce Aᵏ to a polynomial in A of degree less than the degree of the minimal polynomial. This is a key advantage in applications.
Frequently Asked Questions
What is the minimal polynomial of a matrix?
The minimal polynomial is the monic polynomial of smallest degree that, when evaluated at the matrix, gives the zero matrix. It always divides the characteristic polynomial and has the same irreducible factors, but may have lower exponents.
How do I find the minimal polynomial by hand?
One method is to compute the characteristic polynomial, factor it, and then test each divisor by plugging the matrix into the polynomial. Another method is to use the Krylov sequence: pick a vector, compute v, Av, A²v, … until they become linearly dependent, and the coefficients of the dependence give the polynomial.
Why does my minimal polynomial have fractional coefficients?
If the matrix has rational entries, the minimal polynomial will have rational coefficients. Sometimes these are fractions. For example, the matrix [[0,1],[2,0]] has minimal polynomial x² − 2, which has integer coefficients. But [[0,1],[1/2,0]] has minimal polynomial x² − 1/2, which has a fractional coefficient. The calculator shows the coefficients as decimals (e.g., 0.5) but you can convert them to fractions.
Can the minimal polynomial have degree less than the matrix size?
Yes. For example, the identity matrix of size n has minimal polynomial x−1, degree 1, regardless of n. The degree of the minimal polynomial is at most n, but can be smaller.
What is the difference between minimal polynomial and characteristic polynomial?
The characteristic polynomial has degree n and is defined as det(xI−A). The minimal polynomial is the monic polynomial of smallest degree that annihilates the matrix. They share the same irreducible factors, but the minimal polynomial may have lower exponents.
Does the minimal polynomial depend on the field?
Yes. Over the rationals, x²+1 is irreducible, but over the complex numbers it factors as (x+i)(x−i). So a matrix with characteristic polynomial x²+1 has minimal polynomial x²+1 over the rationals, but over the complex numbers it could be x−i or x+i if the matrix is scalar. This calculator works over the rationals.
Related
Formula used
in n | Matrix size | - | 3 | 2 in a11 | a11 | - | 0 | 0 in a12 | a12 | - | 1 | 0 in a13 | a13 | - | 0 | 0 in a21 | a21 | - | 0 | 0 in a22 | a22 | - | 0 | 0 in a23 | a23 | - | 1 | 0 in a31 | a31 | - | 1 | 0 in a32 | a32 | - | 0 | 0 in a33 | a33 | - | 0 | 0 out minpoly | Minimal polynomial | - | x^3 - x | 0
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.