# About integer polynomials which are sums of squares of rational polynomials…

I have the following question for which I haven't been able to find any reference or proof.

Suppose we know that a univariate polynomial $P(X)$ with integer coefficients is the sum of squares of two polynomials with rational coefficients.

Is it true that $P(X)$ must also be the sum of squares of two polynomials with integer coefficients?

For example, take $P(X)=50X^2+14X+1$, then we see that $P(X)=(5X+3/5)^2+(5X+4/5)^2$, but it is also $X^2+(7X+1)^2$.

I would greatly appreciate any help pointing me into the right direction.

Thanks in advance, and regards, Guillermo

-
I wonder if it helps to interpret "sum of two squares of rational polynomials" as the equivalent "norm of an element of ${\mathbb Q}[i][x]$". – Greg Martin Nov 28 '11 at 5:40
I think this is false. Consider (5x^2+3x/5+4)^2+(5x^2+4x/5-3)^2. – Peter McNamara Nov 28 '11 at 7:20
@Hsueh-Yung Lin: 3 is not a sum of two squares of rational numbers. – Marc van Leeuwen Nov 28 '11 at 7:49
@Peter: (7x^2+x)^2 + (x^2+5)^2 – Andrés E. Caicedo Nov 28 '11 at 8:01

Yes. Suppose $n\in \mathbb N$ is minimal so that $P(x)=f_1^2+f_2^2$, where $nf_1$ and $nf_2$ are in $\mathbb Z[x]$.

Let $p$ be a prime with $p^\alpha||n$. Since $P\in \mathbb Z[x]$ we have $p^{2\alpha}| (p^\alpha f_1)^2+(p^\alpha f_2)^2$. Denoting $p^\alpha f_i$ by $g_i$, and letting $\beta$ be square root of $-1\pmod{p^{2\alpha}}$ (it is not hard to show that this must exist by looking at the coefficients of $g_i$ with lowest $p$-valuation).

We have $g_1^2+g_2^2\equiv 0\pmod{p^{2\alpha}}$ so $g_2^2\equiv (\beta g_1)^2\pmod{p^{2\alpha}}$ so that $p^{2\alpha}| ag_1+bg_2$ for some integers $a,b$ with $a^2+b^2=p^{2\alpha}$ and $(ab,p)=1$.

Now we can take $P(x)^2=\left(\frac{af_1+bf_2}{p^{\alpha}}\right)^2+\left(\frac{af_2-bf_1}{p^\alpha}\right)^2$ and both polynomials have coefficients with $\nu_p\geq 0$. Now repeat the procedure with other prime divisors of $n$ until you have polynomials with integer coefficients.

-

In fact, if $P(x)$ is a polynomial with integer coefficients and if every arithmetic progression contains an integer $n$ for which $P(n)$ is a sum of two rational squares, then $P(x) = u_1(x)^2 + u_2(x)^2$ identically, where $u_1(x)$ and $u_2(x)$ are polynomials with integral coefficients. This follows from a theorem of Davenport, Lewis, and Schinzel; see the Corollary to Theorem 2 in Polynomials of certain special types (Acta Arith. IX, 1964, 107--116).

(In my restatement of their result, I use that being a sum of two rational squares is equivalent to being a sum of two integer squares. This is easy to prove directly from the characterization; alternatively, it follows from a lemma in Serre's book, attributed to Davenport--Cassels, used to prove the three squares theorem. Also, Davenport, Lewis, and Schinzel seem to have an argument similar to Gjergji's implicitly in mind in their proof of the Corollary above. So Gjergji's answer is the "real" one; but maybe this paper will interest others.)

-