---
title: "IrreduciblePolynomialQ"
language: "en"
type: "Symbol"
summary: "IrreduciblePolynomialQ[poly] tests whether poly is an irreducible polynomial over the rationals. IrreduciblePolynomialQ[poly, Modulus -> p] tests whether poly is irreducible modulo a prime p. IrreduciblePolynomialQ[poly, Extension -> {a1, a2, ...}] tests whether poly is irreducible over the field extension generated by the algebraic numbers ai. IrreduciblePolynomialQ[poly, Extension -> All] tests whether poly is absolutely irreducible over the complex numbers."
keywords: 
- irreducibility test
- irreducible polynomial
- unfactorable polynomial
- factoring polynomials
- prime polynomial
canonical_url: "https://reference.wolfram.com/language/ref/IrreduciblePolynomialQ.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Polynomial Factoring & Decomposition"
    link: "https://reference.wolfram.com/language/guide/PolynomialFactoring.en.md"
  - 
    title: "Polynomial Algebra"
    link: "https://reference.wolfram.com/language/guide/PolynomialAlgebra.en.md"
  - 
    title: "Finite Fields"
    link: "https://reference.wolfram.com/language/guide/FiniteFields.en.md"
related_functions: 
  - 
    title: "Factor"
    link: "https://reference.wolfram.com/language/ref/Factor.en.md"
  - 
    title: "SquareFreeQ"
    link: "https://reference.wolfram.com/language/ref/SquareFreeQ.en.md"
  - 
    title: "Decompose"
    link: "https://reference.wolfram.com/language/ref/Decompose.en.md"
  - 
    title: "PrimeQ"
    link: "https://reference.wolfram.com/language/ref/PrimeQ.en.md"
  - 
    title: "PolynomialQ"
    link: "https://reference.wolfram.com/language/ref/PolynomialQ.en.md"
  - 
    title: "PrimitivePolynomialQ"
    link: "https://reference.wolfram.com/language/ref/PrimitivePolynomialQ.en.md"
  - 
    title: "FiniteField"
    link: "https://reference.wolfram.com/language/ref/FiniteField.en.md"
---
# IrreduciblePolynomialQ

IrreduciblePolynomialQ[poly] tests whether poly is an irreducible polynomial over the rationals.

IrreduciblePolynomialQ[poly, Modulus -> p] tests whether poly is irreducible modulo a prime p.

IrreduciblePolynomialQ[poly, Extension -> {a1, a2, …}] tests whether poly is irreducible over the field extension generated by the algebraic numbers ai.

IrreduciblePolynomialQ[poly, Extension -> All] tests whether poly is absolutely irreducible over the complex numbers.

## Details and Options

* The polynomial ``poly`` can involve any number of variables.

* ``IrreduciblePolynomialQ`` takes the following options:

|                   |       |                                                                 |
| ----------------- | ----- | --------------------------------------------------------------- |
| Extension         | None  | generators for the algebraic number field to be used            |
| GaussianIntegers  | False | whether irreducibility should be tested over Gaussian rationals |
| Modulus           | 0     | prime modulus to use                                            |

* If any coefficients in ``poly`` are complex numbers, irreducibility testing is done over the Gaussian rationals.

* With the default setting ``Extension -> None``, ``IrreduciblePolynomialQ[poly]`` will treat algebraic number coefficients in ``poly`` like independent variables.

* ``IrreduciblePolynomialQ[poly, Extension -> Automatic]`` extends the domain of coefficients to include any algebraic numbers that appear in ``poly``.

* ``IrreduciblePolynomialQ`` automatically threads over lists.

---

## Examples (18)

### Basic Examples (1)

Test irreducibility of polynomials:

```wl
In[1]:= IrreduciblePolynomialQ[{x ^ 2 - 1, x ^ 2 - 2}]

Out[1]= {False, True}
```

### Scope (9)

Irreducibility of univariate polynomials over the rationals:

```wl
In[1]:= IrreduciblePolynomialQ[{x ^ 2 + 1, x ^ 3 - 8}]

Out[1]= {True, False}
```

---

Irreducibility of multivariate polynomials over the rationals:

```wl
In[1]:= IrreduciblePolynomialQ[{x ^ 4 - 4y ^ 2, x ^ 4 - 2y ^ 2}]

Out[1]= {False, True}
```

---

Irreducibility over the Gaussian rationals:

```wl
In[1]:= IrreduciblePolynomialQ[x ^ 2 + 2 I x  - 1]

Out[1]= False

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

Out[2]= False
```

---

Irreducibility of univariate polynomials over the integers modulo ``2`` :

```wl
In[1]:= IrreduciblePolynomialQ[{x ^ 3 + 1, x ^ 3 + x + 1}, Modulus -> 2]

Out[1]= {False, True}
```

---

Irreducibility of multivariate polynomials over the integers modulo ``3`` :

```wl
In[1]:= IrreduciblePolynomialQ[{x y + x + 1, 2 + 2 x + 2 x^2 + 2 y + x y}, Modulus -> 3]

Out[1]= {True, False}
```

---

Irreducibility over a finite field:

```wl
In[1]:= ℱ = FiniteField[17, 3];

In[2]:= IrreduciblePolynomialQ[{ℱ[3]x ^ 2 + ℱ[1771], ℱ[3]x ^ 2 + ℱ[1771]y ^ 3}]

Out[2]= {False, True}

In[3]:= IrreduciblePolynomialQ[{x ^ 3 + 5x + 19, x ^ 4 + 9x + 3}, Extension -> ℱ]

Out[3]= {False, True}
```

---

By default, algebraic number coefficients are treated as independent variables:

```wl
In[1]:= IrreduciblePolynomialQ[x ^ 2 + 2Sqrt[2]x + 2]

Out[1]= True
```

This tests irreducibility over the rationals extended by the algebraic number coefficients:

```wl
In[2]:= IrreduciblePolynomialQ[x ^ 2 + 2Sqrt[2]x + 2, Extension -> Automatic]

Out[2]= False
```

---

Irreducibility over a finite algebraic extension of rationals:

```wl
In[1]:= IrreduciblePolynomialQ[{x ^ 3 - 2, x ^ 3 - 3}, Extension -> 2 ^ (1 / 3)]

Out[1]= {False, True}

In[2]:= IrreduciblePolynomialQ[{x ^ 2 - 2y ^ 4, x ^ 4 - 3 y ^ 2}, Extension -> Sqrt[3]]

Out[2]= {True, False}
```

---

Absolute irreducibility over the complex numbers:

```wl
In[1]:= IrreduciblePolynomialQ[{x ^ 3 - 3, x ^ 2 + 2 x y - 7}, Extension -> All]

Out[1]= {False, True}
```

### Options (7)

#### Extension (5)

By default, algebraic number coefficients are treated as independent variables:

```wl
In[1]:= IrreduciblePolynomialQ[x ^ 2 + 2Sqrt[3]x y + 3y ^ 2]

Out[1]= True
```

``Extension -> Automatic`` automatically extends to a field that covers the coefficients :

```wl
In[2]:= IrreduciblePolynomialQ[x ^ 2 + 2Sqrt[3]x y + 3y ^ 2, Extension -> Automatic]

Out[2]= False
```

---

The polynomial $x^2+2$ is irreducible over the rationals:

```wl
In[1]:= IrreduciblePolynomialQ[x ^ 2 + 2]

Out[1]= True
```

The same polynomial is reducible over the rationals extended by ``I`` and ``Sqrt[2]`` :

```wl
In[2]:= IrreduciblePolynomialQ[x ^ 2 + 2, Extension -> {I, Sqrt[2]}]

Out[2]= False
```

---

Absolute irreducibility:

```wl
In[1]:= IrreduciblePolynomialQ[x ^ 7 + 12x y - 11, Extension -> All]

Out[1]= True
```

---

The polynomial $x^3+5 x+19$ is irreducible over $\mathbb{Z}_{17}$ :

```wl
In[1]:= IrreduciblePolynomialQ[x ^ 3 + 5x + 19, Modulus -> 17]

Out[1]= True
```

The same polynomial is reducible over a degree-$3$ extension of $\mathbb{Z}_{17}$ :

```wl
In[2]:= IrreduciblePolynomialQ[x ^ 3 + 5x + 19, Extension -> FiniteField[17, 3]]

Out[2]= False
```

---

The polynomial $f$ is irreducible over the finite field $\mathcal{F}$ with $29^3$ elements:

```wl
In[1]:=
ℱ = FiniteField[29, 3];
f = ℱ[12]x ^ 2 + ℱ[34]x + ℱ[56]

Out[1]= [image]

In[2]:= IrreduciblePolynomialQ[f]

Out[2]= True
```

$f$ becomes reducible after embedding $\mathcal{F}$ in a finite field $\mathcal{G}$ with $29^6$ elements:

```wl
In[3]:=
\[ScriptCapitalG] = FiniteField[29, 6];
ℰ = FiniteFieldEmbedding[ℱ, \[ScriptCapitalG]]

Out[3]=
FiniteFieldEmbedding[FiniteFieldElement[FiniteField[29, 27 + 2*#1 + #1^3 & , "Polynomial"], {0, 1}] -> FiniteFieldElement[FiniteField[29, 2 + 13*#1 + 17*#1^2 + 25*#1^3 + #1^4 + #1^6 & , "Polynomial"], 
 {3, 2, 21, 7, 16, 5}]]

In[4]:= IrreduciblePolynomialQ[f, Extension -> ℰ]

Out[4]= False
```

#### GaussianIntegers (1)

The polynomial $x^2+1$ is irreducible over the rationals:

```wl
In[1]:= IrreduciblePolynomialQ[x ^ 2 + 1]

Out[1]= True
```

The same polynomial is reducible over the Gaussian rationals:

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

Out[2]= False
```

#### Modulus (1)

Irreducibility modulo a prime:

```wl
In[1]:= IrreduciblePolynomialQ[{x ^ 2 + 2, x ^ 2 + 3}, Modulus -> 17]

Out[1]= {False, True}
```

### Properties & Relations (1)

A polynomial is irreducible if ``FactorList`` gives one nonconstant factor with exponent 1:

```wl
In[1]:= {IrreduciblePolynomialQ[x ^ 2 + 4], FactorList[x ^ 2 + 4]}

Out[1]= {True, {{1, 1}, {4 + x^2, 1}}}

In[2]:= {IrreduciblePolynomialQ[x ^ 2 - 4], FactorList[x ^ 2 - 4]}

Out[2]= {False, {{1, 1}, {-2 + x, 1}, {2 + x, 1}}}
```

## See Also

* [`Factor`](https://reference.wolfram.com/language/ref/Factor.en.md)
* [`SquareFreeQ`](https://reference.wolfram.com/language/ref/SquareFreeQ.en.md)
* [`Decompose`](https://reference.wolfram.com/language/ref/Decompose.en.md)
* [`PrimeQ`](https://reference.wolfram.com/language/ref/PrimeQ.en.md)
* [`PolynomialQ`](https://reference.wolfram.com/language/ref/PolynomialQ.en.md)
* [`PrimitivePolynomialQ`](https://reference.wolfram.com/language/ref/PrimitivePolynomialQ.en.md)
* [`FiniteField`](https://reference.wolfram.com/language/ref/FiniteField.en.md)

## Related Guides

* [Polynomial Factoring & Decomposition](https://reference.wolfram.com/language/guide/PolynomialFactoring.en.md)
* [Polynomial Algebra](https://reference.wolfram.com/language/guide/PolynomialAlgebra.en.md)
* [Finite Fields](https://reference.wolfram.com/language/guide/FiniteFields.en.md)

## History

* [Introduced in 2008 (7.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn70.en.md) \| [Updated in 2023 (13.3)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn133.en.md)