I am trying to compute $x^3$ in the Galois field $\text{GF}(3^3)$ using the irreducible polynomial $f(x) = x^3 + 2x^2 + 1$.
From the expression $x^3 = f(x) + (2x^2 +1)$ I proceed to take the modulus of $f(x)$ which gives me the wrong result $x^3 \equiv 2 x^2 + 1 \bmod f(x)$.
Sage gives me the correct answer:
F.<y> = GF(3)[]
K.<z> = GF(3**3, name='z', modulus=y^3 + 2*y^2 + 1)
z^3
z^2 + 2
What am I doing wrong?
$x^3 + 2x^2 + 1 \equiv 0$, so $x^3 \equiv -(2x^2 + 1) = -2x^2 - 1 \equiv x^2 + 2$, as coefficients are mod 3.
So your sign was off, as stated in the comments.