Find all irreducible monic polynomials in $\mathbb{Z}/(2)[x]$ with degree equal or less than 5

Extrapolated Comments converted to answer:

First, we note that there are $2^n$ polynomials in $\mathbb{Z}_2[x]$ of degree $n$.

A polynomial $p(x)$ of degree $2$ or $3$ is irreducible if and only if it does not have linear factors. Therefore, it suffices to show that $p(0) = p(1) = 1$. This quickly tells us that $x^2 + x + 1$ is the only irreducible polynomial of degree $2$. This also tells us that $x^3 + x^2 + 1$ and $x^3 + x + 1$ are the only irreducible polynomials of degree $3$.

As hardmath points out, for a polynomial $p(x)$ of degree $4$ or $5$ to be irreducible, it suffices to show that $p(x)$ has no linear or quadratic factors. To rule out the linear factors, we can again throw out any polynomial not satisfying $p(0) = p(1) = 1$. That is, we can throw out any polynomial with constant term $0$, and we can throw out any polynomial with an even number of terms. This rules out $3/4$ of the polynomials. For example, the $4^{th}$ degree polynomials which do not have linear factors are:

  • $ x^4 + x^3 + x^2 + x + 1 $
  • $ x^4 + x^3 + 1 $
  • $ x^4 + x^2 + 1 $
  • $ x^4 + x + 1 $

The $5^{th}$ degree polynomials which do not contain linear factors are:

  • $x^5 + x^4 + x^3 + x^2 + 1$
  • $x^5 + x^4 + x^3 + x + 1$
  • $x^5 + x^4 + x^2 + x + 1$
  • $x^5 + x^3 + x^2 + x + 1$
  • $x^5 + x^4 + 1$
  • $x^5 + x^3 + 1$
  • $x^5 + x^2 + 1$
  • $x^5 + x + 1$

It still remains to check whether $x^2 + x + 1$ (which is the only quadratic irreducible polynomial in $\mathbb{Z}_2[x]$) divides any of these polynomials. This can be done by hand for sufficiently small degrees. Again, as hardmath points out, since $x^2 + x + 1$ is the only irreducible polynomial of degree $2$, it follows that $(x^2 + x + 1)^2 = x^4 + x^2 + 1$ is the only polynomial of degree $4$ which does not have linear factors and yet is not irreducible. Therefore, the other $3$ polynomials listed must be irreducible. Similarly, for degree $5$ polynomials, we can rule out

$$ (x^2 + x + 1)(x^3 + x^2 + 1) = x^5 + x + 1 $$

and

$$ (x^2 + x + 1)(x^3 + x + 1) = x^5 + x^4 + 1. $$

The other $6$ listed polynomials must therefore be irreducible.

Notice that this trick of throwing out polynomials with linear factors, then quadratic factors, etc. (which hardmath called akin to the Sieve of Eratosthenes) is not efficient for large degree polynomials (even degree $6$ starts to be a problem, as a polynomial of degree $6$ can factor as a product of to polynomials of degree $3$). This method, therefore only works for sufficiently small degree polynomials.

To recap, the irreducible polynomials in $\mathbb{Z}_2[x]$ of degree $\leq 5$ are:

  • $x$
  • $x+1$
  • $x^2 + x + 1$
  • $x^3 + x^2 + 1$
  • $x^3 + x + 1$
  • $ x^4 + x^3 + x^2 + x + 1 $
  • $ x^4 + x^3 + 1 $
  • $ x^4 + x + 1 $
  • $x^5 + x^4 + x^3 + x^2 + 1$
  • $x^5 + x^4 + x^3 + x + 1$
  • $x^5 + x^4 + x^2 + x + 1$
  • $x^5 + x^3 + x^2 + x + 1$
  • $x^5 + x^3 + 1$
  • $x^5 + x^2 + 1$

The tricky way to do this is to realize that if $p(x)$ is prime polynomial of degree $n$, then ${\mathbb{Z}_2[z]}/{p(z)}$ is a field of order $2^n$ and hence for every element $a$ of the field, $\ a^{2^n}-a = 0$. In particular, then, $z^{2^n}-z$ must be divisible by $p(z)$. Now, $z^{2^n}-z$ is also divisible by any prime polynomial of degree $d|n$, so we first have to factor those out, and then you get the product of the primes of degree $n$.

In particular, $x^8-x$ must be a product of the primes of degree one and the primes of degree $3$. We can easily factor out $x(x+1),$ and we see that the primes of degree $3$ must multiply together to get $x^6+x^5+x^4+x^3+x^2+x+1$. So you can test for primeness of a polynomial of degree $3$ by seeing if it divides into this polynomial.

Similarly, for $n=4$, you have $x^{16}-x$ must be the product of the primes of degrees $1,2$ and $4$. The only prime of degree $2$ is $x^2+x+1,$ so the product of the primes of degree $4$ must be $\dfrac{x^{16}-x}{(x^2+x+1)x(x+1)}\ =\ 1 + x^3 + x^6 + x^9 + x^{12}\:.\ $ So we know that there are $3$ primes of order $4$.

Finally, the products of the primes of degree $5$ must be $\ \dfrac{x^{32}-x}{x(x+1)}\ =\ 1 + x + x^2 +\:\cdots\: + x^{30}$.

Note that the primes of degree $3$ have to be $x^3+x+1$ and $x^3+x^2+1$. That's because if $p(x)$ is prime, then $p(1)=1$ and $p(0)=1$. So we have to have $x^3$ and $1$ as terms f $p(x)$, and we have to have an odd number of non-zero terms in $p(x)$.


As DJC points out, much of the spade work is noticing which polynomials have linear factors, or equivalently which have roots at 0 or 1. This is sufficient to check quadratic and cubic polynomials (mod 2).

The only other thing to rule out (in finding irreducible polynomials of degree 5 or less) is a quadratic factor! So by analogy with the Sieve of Eratosthenes, let's use the evaluation at 0 and 1 (constant term not 0 and number of nonzero coefficients odd) to quickly list all the irreducible polynomials (mod 2) of degree 2:

$x^2 + x + 1$

Then a polynomial (mod 2) of degree 4 or 5 is irreducible if and only if in addition to not having a root at x = 0 or x = 1, the polynomial does not have the one irreducible quadratic above as a factor. For degree 4 it is only possible to have the quadratic factor but no linear one if the polynomial is the quadratic irreducible squared, so that's just one case to check.

$(x^2 + x + 1)^2 = x^4 + x^2 + 1$
[reducible]

For degree 5 the analogous test would be to rule out the irreducible quadratic times one of the (two) irreducible cubic polynomials.