I'm trying to find the $\gcd$ of $a(x) = x^4 + 2x^3+x^2+4x+2$ and $b(x)=x^2+3x+1$ over $\mathbb{F_5}$. I've already tried Euclid's algorithm:
$x^4 + 2x^3+x^2+4x+2 = x^2(x^2+3x+1) - x^3+4x+2$. Now I should express $b(x)$ in terms of the remainder $-x^3+4x+2$, but I'm not sure how to do this since $\deg(b(x)) < 3$. Did I do something incorrectly? How do I find the $\gcd$?