# Find the greatest common divisor of the following pair of polynomials

Find the greatest common divisor of the following pair of polynomials: $p(x)=x^4+2x^3-2x-1$ and $q(x)=x^3-1$, in $\Bbb Q[x]$.

Similar questions have been asked many times but I am still struggling quite a bit.

Using long division, I get that $x^4+2x^3-2x-1=(x^3-1)(x+2)+(-x+1)$.

Then using the Euclidean algorithm,
$(x^3-1)=(-x+1)(-x^2-x-1)+0$
$(-x+1)=0(-x+1)$

Wolfram alpha says that the gcd should be 1, but I keep getting 0. I have checked everything multiple times.

Any help is greatly appreciated.

Check your Wolfram calculations, because your calculations are correct. Notice that $p(x)$ and $q(x)$ both have a root at $x = 1$, therefore $1 - x$ is a common factor (the Euclidean algorithm tells you that the last nonzero remainder is the gcd, so your calculations imply $1 - x$ is the gcd).

.I think you are confused. The gcd of the two polynomials is $$\mathit {-x+1}$$. The point is , when the remainder is zero, the divisor in that case is the gcd. You need not perform further divisions.

Hence, the $$\gcd$$ is $$-x+1$$.