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$.
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$.
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$
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$.
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$.
$\,f = x^3\!+\!3x\!+\!2\,$ $\Rightarrow$ $f \bmod x\!+\!2 = f(-2) = -12,\ $ so $\,\ x\!+\!2\mid f\!+\!12,\ $ hence
$f\!+\!12 = (x\!+\!2)(x^2\!+\!bx\!+\!7)\,\Rightarrow\,b=-2,\,$ so $\,(x\!+\!2)^{-1}\! = \frac{1}{12}(x^2\!-\!2x\!+\!7),\, $ $\frac{1}{12}= \frac{6}2= 3\,$ by $5=0$
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).$