I'm working on an assignment dealing with $\gcd$'s between 2 polynomials in some $\mathbb{Z}_n[x]$. Now I've solved most of it and it's all straight forward, except for this particular problem: $$A(x) = 2x^3 + x^2 + 1 \quad\mbox{ and }\quad B(x) = x^5 + x^4 + 2x^2 + 1\quad \mbox{ in $\mathbb{Z}_3[x]$}.$$
Now, when you start the procedure by long division, from the first step (dividing $x^5$ by $2x^3$) you get $1/2x^2$, $1/2$ is not an integer and we're in $\mathbb{Z}_3$ so there's something wrong, and it is not an integer that I can convert back to an element in $\mathbb{Z}_3$ using modulo.
Am I doing something wrong or is there a way to get around this?