Skip to content

IrreduciblePolynomialQ

Status: Stable

documented, exercised by the test suite and/or worked examples, with no known limitations recorded.

Description

IrreduciblePolynomialQ[poly]
    gives True if poly is an irreducible polynomial over the rationals.
Option Extension -> alpha | {alpha_i} tests irreducibility over the field extension generated by the algebraic numbers alpha_i.
Option Extension -> Automatic extends Q by every algebraic-number coefficient in poly; Extension -> All tests absolute irreducibility over the complex numbers.
Option GaussianIntegers -> True tests irreducibility over the Gaussian rationals.

Examples

All examples below are verified against the current Mathilda build.

In[1]:= IrreduciblePolynomialQ[{x^2 - 1, x^2 - 2}]
Out[1]= {False, True}

In[2]:= IrreduciblePolynomialQ[{x^2 + 1, x^3 - 8}]
Out[2]= {True, False}

In[3]:= IrreduciblePolynomialQ[{x^4 - 4 y^2, x^4 - 2 y^2}]
Out[3]= {False, True}

In[4]:= IrreduciblePolynomialQ[x^2 + 2 I x - 1]
Out[4]= False

In[5]:= IrreduciblePolynomialQ[x^2 + 1, GaussianIntegers -> True]
Out[5]= False

In[6]:= IrreduciblePolynomialQ[x^2 + 2 Sqrt[2] x + 2]
Out[6]= True

In[7]:= IrreduciblePolynomialQ[x^2 + 2 Sqrt[2] x + 2, Extension -> Automatic]
Out[7]= False

In[8]:= IrreduciblePolynomialQ[{x^3 - 2, x^3 - 3}, Extension -> 2^(1/3)]
Out[8]= {False, True}

Implementation notes

Algorithm. builtin_irreduciblepolynomialq always returns True/False on a structurally valid call. It parses the GaussianIntegers and Extension options, resolves the factoring field by precedence (Extension -> All = absolute irreducibility; explicit α/{α_i} = Q(α)/compositum; Automatic = extension_autodetect; GaussianIntegers -> True or a complex coefficient = Q(i); else Q), then Factors the polynomial over that field and counts non-constant factors with multiplicity (irr_dispatch): 0 → False (constant), 1 → True, >= 2 → False. Extension -> All treats degree-1 univariate as absolutely irreducible and approximates the multivariate case by factoring over Q(i). For multivariate inputs that name an extension, a Hilbert-style specialisation probe (irr_multivariate_specialize_probe) can flip a True verdict to False (covering cases the cheap univariate-only extension path misses).

Data structures. Delegates to the polynomial factoring subsystem (facpoly/qafactor); options are read off Rule heads in the argument list. Wrong arity emits IrreduciblePolynomialQ::argx; malformed options emit ::nonopt (both return NULL). Registered Listable, so list inputs thread before this handler runs.

Complexity / limits. Dominated by the underlying Factor. The Extension -> All multivariate approximation is incomplete — it detects Q(i)-conjugate splits like x^2+y^2 but not reducibility over a general real quadratic field.

  • Listable, Protected. The evaluator threads any List first argument

Attributes: Listable, Protected.

Implementation status

Stable — documented, exercised by the test suite and/or worked examples, with no known limitations recorded.

References

Notes & additional examples

Worked examples

In[1]:= IrreduciblePolynomialQ[x^2 + 1]
Out[1]= True

x^4 + 1 is irreducible over the rationals (the cyclotomic polynomial of the eighth roots of unity):

In[1]:= IrreduciblePolynomialQ[x^4 + 1]
Out[1]= True

But it splits over the complex numbers — Extension -> All tests absolute irreducibility:

In[1]:= IrreduciblePolynomialQ[x^4 + 1, Extension -> All]
Out[1]= False

Irreducibility is field-dependent. x^2 + 1 is irreducible over Q but factors over the Gaussian rationals:

In[1]:= IrreduciblePolynomialQ[x^2 + 1, GaussianIntegers -> True]
Out[1]= False

The minimal polynomial of Sqrt[2] + Sqrt[3] is irreducible over Q, yet becomes reducible once Sqrt[2] is adjoined:

In[1]:= IrreduciblePolynomialQ[x^4 - 10 x^2 + 1]
Out[1]= True

In[2]:= IrreduciblePolynomialQ[x^4 - 10 x^2 + 1, Extension -> Sqrt[2]]
Out[2]= False

Notes

IrreduciblePolynomialQ[poly] tests irreducibility over the rationals. Extension -> alpha (or a list) tests over the field extension generated by the given algebraic numbers; Extension -> Automatic adjoins every algebraic coefficient of poly; Extension -> All tests absolute irreducibility over the complex numbers; and GaussianIntegers -> True tests over the Gaussian rationals.