# A question on greatest common divisor

I had this question in the Maths Olympiad today. I couldn't solve the part of the greatest common divisor. Please help me understand how to solve it. The question was this:

Let $P(x)=x^3+ax^2+b$ and $Q(x)=x^3+bx+a$, where $a$ and $b$ are non-zero real numbers. If the roots of $P(x)=0$ are the reciprocals of the roots of $Q(x)=0$, then prove that $a$ and $b$ are integers. Also find the greatest common divisor of $P(2013!+1)$ and $Q(2013!+1)$.

Let the roots of $P(x)=0$ be $\alpha,\; \beta, \;and\;\gamma$. Then we have the following four relations. $$\alpha+\beta+\gamma=-a$$ $$\alpha\beta\gamma=-b$$$$\frac{1}{\alpha\beta}+\frac{1}{\beta\gamma}+\frac{1}{\alpha\gamma}=b$$$$\frac{1}{\alpha\beta\gamma}=-a$$

From these, we get $a=b=1$ So, $P(x)=x^3+x^2+1$ and $Q(x)=x^3+x+1$. Now, how to proceed further?

If $d$ divides $P(x),Q(x)$

$d$ will divide $P(x)-Q(x)=x^2-x=x(x-1)$

But $d$ can not divide $x$ as $(P(x),x)=1\implies d$ will divide $x-1$

Again, $d$ will divide $x^2+x+1-(x^2-x)=2x+1$

Again, $d$ will divide $2x+1-2(x-1)=3$

Observe that $3$ divides $P(2013!+1),Q(2013!+1)$

as $2013!+1\equiv1\pmod3, (2013!+1)^n\equiv1$ for any integer $n\ge0$

It was not clear to me how the given four relations of the roots gave that $a=b=1$, so here is a different approach.

We have that $$Q(x)=x^3+bx+a=0\tag{1}$$ and $$P\left(\frac1x\right)=\frac1{x^3}+a\frac1{x^2}+b=0\tag{2}$$ have the same roots. Multiplying $(2)$ by $\dfrac{x^3}{b}$ yields $$R(x)=x^3+\frac abx+\frac1b=0\tag{3}$$ Since $Q$ and $R$ have the same roots, so must their difference, $$L(x)=\left(a-\frac ab\right)x+\left(a-\frac1b\right)=0\tag{4}$$ If $a-\frac ab\ne0$, $L$ has one root, and so must $Q$. If $Q$ has only one root, then because the coefficient of $x^2$ is $0$, that root must be $0$. However, since the roots of $P$ and $Q$ are reciprocals, $0$ can't be a root of either. Contradiction.

Therefore, $a-\frac ab=0$ and $a-\frac1b=0$, which means $a=b=1$.

Thus, \begin{align} P(x)&=x^3+x^2+1\\ Q(x)&=x^3+x+1 \end{align}\tag{5} Furthermore, $$\gcd(P(x),Q(x))\mid (2x^2-x+1)P(x)-(2x^2+x-2)Q(x)=3\tag{6}$$ So, considering $\text{mod }3$:

If $x\equiv0\pmod{3}$, then $P(x)\equiv1\pmod{3}$
If $x\equiv1\pmod{3}$, then $P(x)\equiv Q(x)\equiv0\pmod{3}$
If $x\equiv2\pmod{3}$, then $P(x)\equiv1\pmod{3}$

Therefore, $$\gcd(P(x),Q(x))=\left\{\begin{array}{l} 3&\text{if }x\equiv1\pmod{3}\\ 1&\text{if }x\not\equiv1\pmod{3} \end{array}\right.\tag{7}$$ Since $2013!+1\equiv1\pmod{3}$, $$\gcd(P(2013!+1),Q(2013!+1))=3\tag{8}$$
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 1, "equation": 0, "x-ck12": 0, "texerror": 0}