I had to find the $\gcd$ of the following polynomials in $\mathbb{Q}[x]$ using the Euclidean algorithm, and I wanted to check that I had done so correctly, since my notes on the subject from class are a little questionable.
- $x^{3}-1$ and $x^{2}+x-2$
My attempt:
Using polynomial long division to divide $y:=x^{3}-1$ by $x:=x^{2}+x-2$, on the first step, I obtained $$ x^{3}-1 = (x-1)(x^{2}+x-2)+(3x-3) $$ where the remainder $r= 3x-3$
Now, on the second step, replace $y$ with $r$ to obtain $y:=3x-3$, $x:=x^{2}+x-2$, and swap $x$ and $y$ so that now $y:=x^{2}+x-2$ and $x:=3x-3$.
Using polynomial long division to divide $y$ by $x$, I obtain that $$\displaystyle x^{2}+x-2 = \left( \frac{1}{3}x+\frac{2}{3}\right)(3x-3) + 0 $$
And so now that $r=0$, $$\mathbf{\gcd(x^{2}+x-2,\, x^{3}-1) = \gcd(3x-3,\, x^{2}+x-2)} = 3x-3$$
- $x^{4}+1$ and $x+1$
My attempt:
Using polynomial long division to divide $y:=x^{4}+1$ by $x:=x+1$, on the first step, I obtained $$ x^{4}+1 = (x+1)(x^{3}-x^{2}+x-1)+2 $$ where the remainder $r= 2$
Now, on the second step, replace $y$ with $r$ to obtain $y:=2$, $x:=x+1$, and swap $x$ and $y$ so that now $y:=x+1$ and $x:=2$.
Using polynomial long division to divide $y$ by $x$, I obtain that $$\displaystyle x+1 = \left( \frac{1}{2}x+\frac{1}{2}\right)(2) + 0 $$
And so now that $r=0$, $$\mathbf{\gcd(x^{4}+1,\, x+1) = \gcd(2,\, x+1} )= 2$$
Since $2$ is a unit in $\mathbb{Q}$, this means that $x^{4}+1$ and $x+1$ are relatively prime in $\mathbb{Q}[x]$
Did I do these correctly?
For the second one, especially, I wasn't sure if that actually meant that the two polynomials were relatively prime in $\mathbb{Q}[x]$, because my notes didn't say anything about that, but it seemed to make sense.
Thank you ahead of time.