Let $f=x^3+x+1$, I want to find a inverse of $g=x^4 +3x^3+x^2+1$ in $A=\mathbb{Z}_5[x]/(f)$.
I do the division between $f$ and $g$ is $q=x+3$ and $r=2x+3$, then I continued with the division between $x^3+x+1$ and $r$ and then I have rest $=1$.
Now I don't know how to move in order to find the inverse.
Thanks for the attention.
Represent the gcd of the two polynomials as a linear combination of these polynomials using the extended euclidean algorithm (Bezout's thm):
$1 = a\cdot f + b\cdot g$ for some polynomials $a,b$.
Then $b\cdot g\equiv 1 \mod f$ and so $b\cdot g =1$ in $\Bbb Z_5[x]/\langle f\rangle$.