<s>[INST] How to proceed with Euclidean algorithm for finding greatest common divisor of two polynomials. I am trying to find 
\begin{equation*}
gcd(x^4-x^3-4x^2-x+5,x^2+x-2). 
\end{equation*}
I have done the first step of long division and found.
\begin{equation*}
x^4-x^3-4x^2-x+5=(x^2-2x)(x^2+x-2)-5x+5
\end{equation*}
so we have 
\begin{equation*}
gcd(x^4-x^3-4x^2-x+5,x^2+x-2)=gcd(x^2+x-2,-5x+5)
\end{equation*}
now is where I am stuck. For the next step do we need to divide $x^2+x-2$ by $-5x+5$ or can we simply divide $x^2+x-2$ by $-x+1$ since the $gcd$ needs to a monomial?
Also if I did divide by $-x+1$ instead of $-5x+5$ would this change my procedure at all when reversing the algorithm to find the polynomials that multiply  $(x^4-x^3-4x^2-x+5,x^2+x-2)$ to give  $gcd(x^4-x^3-4x^2-x+5,x^2+x-2)$. (Bezout's lemma)
 [/INST] There is a theorem which states that if $f $ is a polynomial and $ f(a) =0 $ then $x-a$ is a factor of $f$, another theorem states that if $f$ is a polynomial the possible zeros of $ f$ are factors of $c/l$ where $l $is the leading coefficient and $ c$ is the constant. The two polynomials suppose $f(x)= x^4 - x^3 -4x^2-x +5 , g(x)=x^2+x-2$ you can see that $f(1)=0, g(1)=0$ hence $x-1$ is a factor for both. And no other factors remains between both the gcd is $x-1$
</s>