# Computing minimal polynomial in finite field F8

In a finite field $$F_q$$, I've read that one can get the minimum polynomial $$f(z)$$ of an element $$\beta \in F_q$$ using this formula:

$$f(z) = (z-\beta)(z-\beta^2)(z-\beta^4)(z-\beta^8)...$$

I'm trying to prove this to myself in the case of the finite field $$F_8 = F_2[x]/(x^3 + x + 1)$$

The elements of this field are:

$$0, 1, x, x^2, x^3\equiv (x+1), x^4\equiv (x^2+x), x^5\equiv (x^2+x+1), x^6\equiv (x^2 +1)$$

Let's say I want to find the minimal polynomial of $$x$$, which should also be the minimal polynomial for its conjugates $$x^2$$ and $$x^4 \equiv x^2+x$$. Since $$x^8\equiv x$$, I can ignore the higher powers.

Since coefficients are in $$F_2$$, $$+1$$ and $$-1$$ are considered equivalent:

$$f(z) = (z+x)(z+x^2)(z+x^4)$$

$$f(z) = z^3 + z^2(x^4 + x^2 + 1) + z(x^6 + x^5 + x^3) + x^7$$

Using the conversions I've listed above, I can replace all the powers of $$x^3$$ or higher with lower-degree polynomials:

$$f(z) = z^3 + z^2((x^2+x) + x^2 + 1) + z((x^2+1) + (x^2+x+1) + (x+1)) + 1$$

$$f(z) = z^3 + z^2(x + 1) + z + 1$$

This isn't what I'm expecting... I would have expected the $$z^2$$ term to go to zero. Am I making an algebra mistake here?

The $$z^2$$ term is $$x^4 + x^2 + x$$, not $$x^4+x^2+1$$ as you have written.