<s>[INST] Diophantine equation in a polynomial ring 
I have to calculate the inverse of the polynomial $(2x^2+x+1)$ in the quotient ring $\frac{Z_3[x]}{<x^3+2x+2>}$. 

My idea was that I could solve the following equation, but I have no idea where to begin:$$(x^3+2x+2)u+(2x^2+x+1)v = 1.$$
 [/INST] For the given ring we have $x^3+2x+2 \equiv 0$ (same as $x^3 \equiv x+1$), so in general all you need is to find $ax^2+bx+c$ in the ring such that 
\begin{align*}
(ax^2+bx+c)(2x^2+x+1) & \equiv 1
\end{align*}
Multiplying these polynomials and using the congruence condition $x^3 \equiv x+1$ and $x^4 \equiv x^2+x$ should yield the result.
If all goes well, then you should have $a=1,b=0,c=0$. Thus the inverse is $x^2$.
</s>