[Math] Finding a common factor of two coprime polynomials

abstract-algebragcd-and-lcmnumber theorypolynomials

I have two coprime univariate integer polynomials. Although they have no common factor as polynomials, they may have common factors at some (integer) values. How can I find such a value?

For example, suppose the polynomials are $x^3-x^2+3x-1$ and $x^3+2$. They are coprime in $\mathbb{Z}[x]$, but $\gcd(27^3-27^2+3\cdot27-1, 27^3+2)=\gcd(19034,19685)=31.$

Best Answer

Here is an explanation.

Let $f=x^3-x^2+3x-1$ and $g=x^3+2$.

Even though $\gcd(f,g)=1$ in $\mathbb{Z}[x]$, we cannot write $1=uf+vg$ with $u,v \in \mathbb{Z}[x]$ (because $\mathbb{Z}[x]$ is not a PID). But we can, if we allow $u,v \in \mathbb{Q}[x]$. Indeed, WA tells us that $$ 1 = \dfrac1{31} (-6 x^2-7 x-3)f(x)+\dfrac1{31}(6 x^2+x+14)g(x) $$ Therefore $$ 31 = (-6 x^2-7 x-3)f(x)+(6 x^2+x+14)g(x) $$ for all $x \in \mathbb Z$.

This only proves that $\gcd(f(x),g(x))=1$ or $31$ (because $31$ is prime), but it points to $31$.

So we try to solve $f(x)\equiv g(x) \equiv 0 \bmod 31$ and find that $x=27$ is a solution.

Therefore, $\gcd(f(x),g(x))=31$ for all $x=27+31k$. For all other values, $\gcd(f(x),g(x))=1$.

Related Question