Exercise: Determine a gcd of the polynomials $x^2+1$ and $x^3+1$ in $\Bbb Q[X]$.. Write the gcd as a combination of the given polynomials.
Is it correct that I keep using long division until the result is $0$, and then the previous result would be a gcd?
x^2+1 / x^3 + 1 \ x
x^3 + x
________-
1 - x
1 - x / x^2 + 1 \ -x-1
x^2 - x
________-
x + 1
x - 1
________-
2
2 / 1 - x \ -1/2x + 1/2
- x
______-
1
1
______-
0
Conclusion: A gcd is $2$?
I'm not sure what's meant with "Write the gcd as a combination of the given polynomials.", so it would be great if someone could point me in the right direction.
The Euclidean algorithm steps are \begin{align*} x^3+1&=x (x^2+1) + (-x+1)\\ x^2+1&=-x (-x+1)+ (x+1)\\ -x+1&=-(x+1)+2 \end{align*}
So the GCD is $1$.
We can go back up \begin{align*} 2 &= (-x+1) +(x+1)\\ &= (-x+1) + (x^2+1)+x (-x+1)\\ &= (-x+1) (x+1)+(x^2+1)\\ &= (x^3+1 - x(x^2+1))(x+1)+(x^2+1)\\ &= (x+1) (x^3+1) + (-x^2-x+1) (x^2+1) \end{align*}
and so $1 = \frac{1}{2} [(x+1) (x^3+1) + (-x^2-x+1) (x^2+1)]$