0

I'm preparing for an exam and, looking at older exams I stumbled across this question:

Compute $gcd(a(x), b(x))$ where $a(x) = x^3+x+2$ and $b(x)=x^2+x+1$ And the solution is $x+3$

So, I know that the procedure of this, using Euclid's algorithm is: $\gcd(a,b)$ becomes $\gcd(R_{x^2+x+1}(x^3+x+2))$ But how would I compute $x^3+x+2 \equiv x+3 $ (mod $x^2+x+1$)?

Bill Dubuque
  • 272,048

2 Answers2

2

Polynomial long division yields $(x^3+x+2)=(x^2+x+1)(x-1)+x+3$:

$$\begin{align}& \underline{x-1}\\ x^2+x+1&)x^3+x+2\\ &\underline{x^3+x^2+x} \\ &&-x^2+2\\ &&\underline{-x^2-x-1}\\ &&x+3 \end{align}$$

J. W. Tanner
  • 60,406
1

To compute $\,a\bmod b\,$ we can use the (Euclidean) polynomial division algorithm to divide $a$ by $b,\,$ which yields the remainder $ =a\bmod b,\,$ same as for integers.

However here there is a nice optimization that is available. Namely we have $\,b\mid x^3-1\,$ therefore $\,a\bmod b = (a\bmod x^3\!-1)\bmod b.\,$ But computing $\bmod \color{#c00}{x^3\!-1}\,$ is easy since we can use the rewrite rule $\,\color{#c00}{x^3\equiv 1}\,\Rightarrow\, \color{#c00}x^{\color{#c00}3n}\equiv \color{#c00}1^n\equiv 1\,$ to quickly reduce every polynomial to one of degree $\le 2,\,$ e.g. your $\,a = \color{#c00}{x^3}\!+\!x\!+\!2$ $\equiv \color{#c00}1\!+\!x\!+\!2$ $\equiv x\!+\!3.\,$ This is a special case of the method of simpler multiples.

Bill Dubuque
  • 272,048