<s>[INST] Find the inverse of a polynomial in a quotient ring Consider $\mathbb Z_5[x]/I$ with $I$ as ideal generated by $b=x^3+3x+2$. If $(x+2) + I$ is element of $\mathbb Z_5[x]/I$ that has an inverse. Find the inverse of $(x+2) + I$.
I stuck to get the inverse because the gcd of that is not $1$.
 [/INST] Perform the  Euclidean division by Horner's scheme (in $\mathbf F_5$):
$$\begin{matrix}\\ \\\times -2\quad\end{matrix}
\begin{matrix}
\hline
 1&0&-2&2\\
 \downarrow&-2&-1&1\\
\hline
\ 1&-2&2&-2
\end{matrix}
$$
Thus $0=x^3+3x+2\;(=x^3-2x+2)=(x+2)(x^2-2x+2)-2$, whence, multiplying both sides by $-2$,
$$(x+2)(x^2-2x+2)=2\implies(x+2)(-2x^2-x+1)=2\cdot (-2)=1$$
so that $\quad(x+2)^{-1}=-2x^2-x+1$.
</s>