This question originates from Pinter's Abstract Algebra, Chapter 31, Exercise B5:
Find the root field of $x^3+x^2+x+2$ over $\mathbb{Z}_3$.
Let $a(x)=x^3+x^2+x+2$. We can show $a(x)$ is irreducible over $\mathbb{Z}_3$ by direct substitution of 0,1 and 2. Let $u$ be a root of $a(x)$ over $\mathbb{Z}_3$. So $\mathbb{Z}_3(u)$ is a field extension of $\mathbb{Z}_3$ with a basis of $\{1, u, u^2\}$, and has exactly 27 elements. Dividing $a(x)$ by $(x-u)$, we get $a(x) = (x-u)(x^2 + (u+1)x + (u^2+u+1))$ over $\mathbb{Z}_3(u)$. Let $b(x) = x^2 + (u+1)x + (u^2+u+1)$. As $u^3+u^2+u+2=0$, we can show $b(x)$ is irreducible in $\mathbb{Z}_3(u)$ by direct substitution of each of the 27 elements of $\mathbb{Z}_3(u)$; and so on.
However, the 27 substitution is quite a tedious and time-consuming process. So I wonder if there is any symbolic math package that we can use to write up a polynomial function (over a finite field) with a simple loop to verify such substitutions. SageMath looks promising, but so far I haven't been able to figure out the exact way to do so.
Any idea?
If you define $$b(x)=\frac{a(x)}{x-u}$$ then $b(x)$ will not be irreducible over $K=\Bbb Z_3(u)$ (the finite field of $3^3$ elements). To see this, cubing $a(u)=0$ gives $a(u^3)=0$, so that $b(u^3)=0$. As $u^3=-u^2-u-2=2u^2+2u+1$ you might try substituting that into $b(x)$ to double-check that in fact $b(u^3)=0$, and so $b(x)$ is reducible over $K$.
In fact, if $f(x)$ is irreducible of degree $d$ over a finite field $F$ of order $q$, and $f(u)=0$ in some extension field, then $f$ splits into linear factors over $F(u)$: indeeed $$f(x)=(x-u)(x-u^q)(x-u^{q^2})\cdots(x-u^{q^{d-1}}).$$