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$.
 A: The usual approach to find the inverse of a polynomial $f$ when working modulo $g$ is to use the extended Euclidean algorithm to find polynomials $u$ and $v$ such that
$$ uf + vg = \gcd(f,g) = 1 $$
from which it immediately follows
$$ uf \equiv 1 \pmod g $$

If $\gcd(f,g)$ is not a unit, then $f$ does not have an inverse modulo $g$. The contrapositive is easy to see: if you have a polynomial $u$ such that
$$ uf \equiv 1 \pmod g $$
then there must exist a polynomial $v$ such that
$$ uf -1 = vg $$
and $uf - vg = 1$ implies $\gcd(f,g)$ divides $1$.
A: $\,f = x^3\!+\!3x\!+\!2\,$ $\Rightarrow$ $f \bmod x\!+\!2 = f(-2) =  -12,\ $ so $\,\ x\!+\!2\mid f\!+\!12,\ $
hence $\:\!  \color{#c00}f+12 = (x\!+\!2)(x^2\!+\!bx\!+\!7)\,\Rightarrow\,b=-2,\,$ so $\color{#c00}{\!\bmod f}\,$ this yields
$\begin{align}\color{#c00}
{f\equiv0}\,\Rightarrow\, \!12 \equiv (x\!+\!2)&(x^2\!-\!2x\!+\!7)^{\phantom{|^|}}\\[.2em]
\Rightarrow\ \ 1 \equiv (x\!+\!2)&(x^2\!-\!2x\!+\!7)/{12}\\[.2em]
\Rightarrow (x\!+\!2)^{-1}\!\equiv\ & (x^2\!-\!2x\!+\!7)/{\color{#0a0}{12}},\,\ {\rm and}\   \bmod 5\!:\ \smash[t]{\color{#0a0}{\frac{1}{12}}\equiv \frac{6}2}\equiv \color{#0a0}3
\end{align}$
Remark $ $ Exactly the same method inverts any linear polynomial $g$ coprime to $f.\,$ The method is essentially an optimization of the extended Euclidean algorithm (which in this case requires only a single step to obtain the Bezoout identity, since $\, f \bmod g\,$ is a constant $\neq 0).$
A: Hint: $$(x+2)(ax^2+bx+c) + I =ax^3+(2a+b)x^2+(2b+c)x+2c+I\\ = (2a+b)x^2 +(2b+c-3a)x+2(c-a) + I$$
Now solve
\begin{align}
2a+b &=0\\
2b+c-3a &= 0\\
2(c-a) &= 1 
\end{align}
in $\Bbb Z_5$
A: 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$.
