I asked Using Extended Euclidean Algorithm to find multiplicative inverse earlier, and understand how to use EEA for two integers. Now I'd like to do it with polynomials, but I'm getting some very large fractions following the same procedure as I did w/ the integers. The problem I'm working on is:
$(x^5 + x^2 + 1)^{-1} \cdot mod (x^{10} + x^3 + 1)$
\begin{align}
x^{10} + x^3 + 1&=(x^5-x^2-1)\cdot(x^5+x^2+1)+(x^4+x^3+2x^2+2)\\
(x^5+x^2+1)&=(x-1)\cdot(x^4+x^3+2x^2+2)+(-x^3+3x^2-2x+3)\\
(x^4+x^3+2x^2+2)&=(-x-4)\cdot(-x^3+3x^2-2x+3)+(12x^2-5x+14)\\
(-x^3+3x^2-2x+3)&=(\frac{31}{144}-\frac{x}{12})\cdot(12x^2-5x+14)+(\frac{35x}{144}-\frac{1}{72})\\
12x^2-5x+14&=(\frac{1728x}{35}-\frac{21744}{1225})\cdot(\frac{35x}{144}-\frac{1}{72})+\frac{16848}{1225}
\end{align}
Continuing from there, I start to get some big fractions, which doesn't seem correct. I know the GCD is 1, but it doesn't look like I'm going to get that following the above procedure. What is the issue here?
Answer
The GCD of two polynomials is only unique up to multiplication by an (invertible) element of the base field. You can freely renormalise to work with smaller coefficients.
$$\begin{align}
x^{10} + x^3 + 1&=(x^5-x^2-1)\cdot(x^5+x^2+1)+(x^4+x^3+2x^2+2)\\
(x^5+x^2+1)&=(x-1)\cdot(x^4+x^3+2x^2+2)+(-x^3+3x^2-2x+3)\\
(x^4+x^3+2x^2+2)&=(-x-4)\cdot(-x^3+3x^2-2x+3)+(12x^2-5x+14)\\
(-x^3+3x^2-2x+3)&=\frac{1}{144}\left((31-12x)\cdot(12x^2-5x+14)+(35x-2) \right)\\
12x^2-5x+14&=\frac{1}{1225}\left((420x - 151)(35x - 2) + 16848 \right)
\end{align}$$
The numbers aren't much smaller in this case, but the point is that the GCD is a constant, so the two polynomials are coprime.