# Is there a univariate rational polynomial which represents only squares in $\mathbb{R}$ and $\mathbb{Q}_2$, but not all other $\mathbb{Q}_p$?

Let $K$ be a field; I will say a polynomial $f \in K[X]$ represents an element $a \in K$ if there exists a $b \in K$ such that $f(b) = a$.

Denote by $\mathbb{Q}$, $\mathbb{R}$ and $\mathbb{Q}_p$ the fields of rational, real and $p$-adic numbers respectively. Does there exist a polynomial $f \in \mathbb{Q}[X]$ such that

1. $f$ represents only squares over $\mathbb{R}$ (but not all squares need to be represented),
2. $f$ represents only squares over $\mathbb{Q}_2$ (but not all squares need to be represented),
3. for every prime number $p > 2$, $f$ does not represent only squares over $\mathbb{Q}_p$?

If so, what is the minimal degree such a polynomial must have?

What I have found so far:

1. A polynomial satisfying $1$ and $3$, but not $2$: $$1 + X^2$$
2. A polynomial satisfying $1$ and $2$ and which I think might also satisfy $3$, but I do not know how to prove it: $$(1 + X^2)(17 + X^2)$$ Here, $17$ may be replaced with any positive integer with residue $1$ modulo $16$.
• I would think $8x^2+1$ represents only squares in the reals and the 2-adics. Apr 11, 2018 at 9:48
• both $8X^2+1$ and $(1+X^2)(17+X^2)$ do not satisfy property $2$. plug in $X=1/2$ and $X=3$ respectively.
– ArtW
Apr 11, 2018 at 12:48
• @ArtW I do not see how plugging $3$ into $(1 + X^2)(17 + X^2)$ would yield a contradiction; $(1 + 3^2)(17 + 3^2) = 260 = 4 \cdot 65$ and $65 = 8^2 + 1$ is a $2$-adic square. If that is helpful, I will write out what I am confident is a valid proof that the polynomial satisfies property 2. Apr 11, 2018 at 16:11
– ArtW
Apr 11, 2018 at 16:39
• If $f(X)$ is as demanded, then the family of quaternion algebras $(f(a), b)_{a, b \in \mathbb{Q}}$ has the property that none of the algebras is split at $\mathbb{R}$ or $\mathbb{Q}_2$, but for any odd prime $p$, some of the algebras are split at $\mathbb{Q}_p$. This could perhaps be used to simplify Jochen Koenigsmann's universal definition of $\mathbb{Z}$ in $\mathbb{Q}$ (archive version). Apr 12, 2018 at 8:40

Clearly degree 1 and 3 polynomials do not satisfy property 1.

The only degree 2 polynomials in $\mathbb{Q}[X]$ with property 2 are squares. To verify this, after a possible change of variables assume that $aX^2+b$ is a polynomial generating only squares over $\mathbb{Q}_2$ with $b\ne 0$. By setting $X=0$ we know $b$ is a square in $\mathbb{Q}_2$, so multiplying by $b^{-1}$ we can assume $b=1$. Next, write $a=2^nc$ with $n=v_2(a)$ its $2$-adic valuation, so that $c\in \mathbb{Z}_2^{\times}$.

• If $n$ is even, say $n=2m$, set $X=c2^{1-m}$ to find that $4c^2+1$ is a square in $\mathbb{Q}_2$, but we reach a contradiction as $5$ is not a square modulo $8$.
• If $n$ is odd, say $n=2m-1$, set $x=2^{-m}$ to yield that $c/2+1$ is a square in $\mathbb{Q}_2$, which is impossible because its valuation is $-1$.

Finally, there do exist polynomials of degree 4 satisfying all three properties. In particular $f(X)=(8X^2+1)(8X^2+9)$ does the job. Property 1 is clear, so let us check property 2.

The (extended) Hensel's lemma tells you that if a polynomial in $\mathbb{Q}_2[X]$ has a root modulo 8 whose derivative at that root is not divisible by 4, then the polynomial has a root in $\mathbb{Q}_2$. Let $a\in\mathbb{Q}_2$ be arbitrary, and write $a=2^nb$ with $b\in \mathbb{Z}_2^{\times}$. When $n\ge -1$, we can apply the above to $X^2-(8a^2+1)(8a^2+9)$. When $n<-1$, we can see that $$f(a)=2^{2(2n+3)}(b^2+2^{-2n-3})(b^2+9\cdot 2^{-2n-3})$$ and thus apply Hensel's to $X^2-2^{-2(2n+3)}f(a)$.

As for property 3 (inspired by user mercio's comment below), Let $p$ be an odd prime and suppose $f(X)$ only generates squares over $\mathbb{Q}_p$. As $f(1)\equiv 3\pmod{9}$, we can assume $p\ne 3$. Then the elliptic curve $$E:y^2=(8x^2+1)(8x^2+9)$$ has good reduction at $p$ (Wolphram tells me the discriminant is $2^{34}\cdot 9$). Under the assumption $f(x)$ is a square mod $p$ for any $x$, the number of points on $E$ must be at least $2p-4$. The Hasse bound yields at most $2\sqrt{p}+p$ points (note we ignore the point at infinity). Thus, $$2p-4\le 2\sqrt{p}+p$$ which is false for $p\ge 5$. In particular there is an $x$ with $(8x^2+1)(8x^2+9)$ not a square mod $p$, thus $f(X)$ cannot generate only squares in $\mathbb{Q}(X)$. (Numerical data suggests in fact that more or less half of the numbers $(8x^2+1)(8x^2+9)$ for $x\in\mathbb{F}_p$ are quadratic residues).

The polynomial suggested by the OP works as well, the proof for property three works equally well except additionally one has to exhibit a nonsquare for the prime $17$ ($x=2$ works).

• Here's an idea that didn't work, but maybe you can do something with it: suppose by contradiction that $\left(\frac np\right)=\left(\frac{n+8}p\right)$ for at least about half of the $n \in \mathbb F_p$, then $\zeta_p^8-1$ times the Gauss sum $\sum \left(\frac np\right)\zeta_p^n$ is relatively small because of cancellation. Its absolute value is $|\zeta_p^8-1|\sqrt p$ so I was hoping to get a contradiction from $|\zeta_p^8-1|\sqrt p \leq p-1$ (the upper bound), but this is way too weak. Apr 11, 2018 at 14:21
• I think the polynomial $X^2$ satisfies property 2 Apr 11, 2018 at 14:29
• @barto I indeed expect something analytically like that, nice approach though ;)
– ArtW
Apr 11, 2018 at 14:34
• I am not certain that counting solutions of $y^2 = (x^2+1)(x^2+9)$ in $\Bbb F_p$ is enough to conclude that you can find nonresidues in $\Bbb Q_p$, but you can probably show that not every $x$ is part of a point in $\Bbb F_p$ by counting points on that curve. (here it's an elliptic curve so its number of points is in the range $p+1 \pm 2\sqrt p$, which is a lot less than the $2p-4$ points you need) Apr 11, 2018 at 14:49
• @mercio, if $f\in \mathbb{Z}[X]$ generates only squares over $\mathbb{Q}_p$ then necesarily $f(x)$ is a quadratic residues mod $p$...
– ArtW
Apr 11, 2018 at 15:49

Not an answer, but some ideas for an approach. If $(1+x^2)(17+x^2)=n^2$ for some p-adic number $n$, then we also know that $n^{-2}$ is also a square. So we can look for examples/counterexamples by inverting it as we will necessarily have a power series that satisfies the same criteria.

I begin by using partial fraction decomposition,

$$n^{-2} = \frac{1}{1+x^2}\frac{1}{17+x^2} = \frac{1}{16}\left( \frac{1}{1+x^2} - \frac{1}{17+x^2}\right)$$

As it turns out, $4^{-2}$ factors out. Since a square divided by a square is still a square, we can just focus on this difference,

$$\frac{1}{1+x^2} - \frac{1}{17+x^2}$$

Then rewrite it as a pair of power series (with the exception of $\mathbb{Q}_{17}$), as:

$$\sum_{n=0}^\infty (-1)^n x^{2n} - 17^{-1}\sum_{n=0}^\infty (-17)^{-n} x^{2n}$$

$$=\sum_{n=0}^\infty (-1)^n [1-17^{-n-1}] x^{2n}$$

I decide to think of what values it converges for, just as wild grasping for some kind of insight to try to figure this out and recognize that part of the coefficients can be rearranged as,

$$1-17^{-n-1} = \frac{17^{n+1}-1}{17^{n+1}} = \frac{(2^4+1)^{n+1}-1}{(2^4+1)^{n+1}}$$

If I look a this limit in $\mathbb{Q}_2$ I recognize clearly,

$$\lim_{n\to \infty} \frac{(2^4+1)^{n+1}-1}{(2^4+1)^{n+1}} = 0$$

I've spent enough time blindly flailing around, but maybe this gives something useful to think about.