Find the gcd of $x^4-2x^3-x+3$ and $x^2-1.$
Note: I am using $a=bq+r$
First approach:
$$ \begin{align*} x^4-2x^3-x+3&=(x^2-1)(x^2-2x+1)+(4x+4)\\ x^2-1&=(4x+4)(2x-2)+0 \end{align*} $$ Therefore, $\text{gcd}(x^4-2x^3-x+3,\:x^2-1)=x+1.$
Second approach:
$$ \begin{align*} x^4+5x^3+6x+3&=(x^2+6)(x^2-5x-6)+(4x+4)\\ x^2+6&=(4x+4)(2x+5)+0 \end{align*} $$ Therefore, $\text{gcd}(x^4+5x^3+6x+3,\:x^2+6)=x+1.$
In the first approach I used the given polynomials while in the second approach I first used $\text{mod}\:7$ to change the negatives to positives and then proceeded with the calculation.
For both approaches, the remainders shown are in $\text{mod}\:7$ i.e. in the first approach the remainder is actually $-3x+4$ and in the second its $-24x+39.$
Which approach is the correct way of solving such problems? If it matters, why? Also, suppose I used the first approach, would the final answer be $-3x+4$, $4x+4$, or $x+1$?