# Square of polynomial

I have a problem with the following task.

Let $W(n) := an^2 + bn + c$ where $a,b,c \in \mathbb{Z}$.
Assume that for all $n \in \mathbb Z$ we have that $W(n)$ is the square of an integer.

Show that there exists some $P$ such that $W(n) = P(n)^2$.

Thanks for any tips or help.

John

-
@JulianKuelshammer: Don't be too harsh. Obviously the "Show that" is part of a verbatim quotation introduced by the first introductory sentence. But I agree on the other points. – Hagen von Eitzen Oct 14 '12 at 13:04
Was that "harsh"? – DonAntonio Oct 14 '12 at 13:06
@DonAntonio: No, $4x^2+4x+1=(2x+1)^2$ is a square wnhenever $x$ is an integer, but has no integer root. Also (though that does not affect the problem), $W(x)=2x^2+4x+2$ has $\Delta=0$, but $W(0)=2$ is not a square. – Hagen von Eitzen Oct 14 '12 at 13:11
In fact, even more is true - the result turns out to be true for polynomials of arbitrary degree and in arbitrarily many variables (and there's even an effective version that 'forces' a nonsquare value less than a specific bound for non-square polynomials). See mast.queensu.ca/~murty/poly2.pdf for the details, and a relatively straightforward proof of the univariate case. – Steven Stadnicki Oct 15 '12 at 18:29

Without loss of generality, you can assume $a,b,c\geq 0$. Since

$$4a W(x) - (2ax+b)^2 = 4ac - b^2 = D,$$

we have that the Pell equation

$$4a u^2 - v^2 = D,$$

for any $N$ big enough, has at least $\left\lfloor\frac{N}{2a}\right\rfloor$ integer solutions $(u,v)$ with $|v|\leq N$. From the theory of Pell equation we know that, if $D\neq 0$, there are at most $O(\log N)$ solutions with $|v|\leq N$, so

$$D=0, \quad a=A^2, \quad c=W(0)=C^2, \quad W(x)=(Ax+C)^2$$

must hold.

-
Why can you exclude $D>0$? Two real roots does not imply that $W(x)$ becomes negative at an integer $x$. – Hagen von Eitzen Oct 14 '12 at 15:46
Why you wrote that W(x) = u^2 ? We must prove it. – John Smith Oct 14 '12 at 16:04
Ok, no need to exclude the case $D>0$. I wrote $W(x)=u^2$ using the fact that that $W(x)$ is a square (of an integer) for any integer value of $x$. – Jack D'Aurizio Oct 14 '12 at 16:08
Ok, not a square of polynomial but square of integer? – John Smith Oct 14 '12 at 16:27
Can you write something more about your ending of problem ? Sorry, but i cannot understand it. Why D is 0 ? Is it implicate that A is square etc. ? – John Smith Oct 14 '12 at 16:35

We have a (possibly nonpolynomial) function $w\colon\mathbb Z\to \mathbb N_0$ such that $W(x)=w(x)^2$ for all $x\in \mathbb Z$.

If $a<0$ then $W(x)<0$ for sufficiently big $x$. Hence $a\ge 0$. If $a=0$ and $b\ne 0$, then again $W(x)<0$ for suitable $x$. Hence $a=0$ implies $b=0$, but then $W(x)=W(0)=(w(0))^2$ as desired. Therefore we may assume for the rest of the argument that $a\ne 0$.

If $x$ is big, then $w(x)\approx x\sqrt a$. More precisely, if $\alpha,\beta$ are positive real numbers, then from $\alpha^2-\beta^2=(\alpha-\beta)(\alpha+\beta)$ we see that $|\alpha-\beta|\le\frac{|\alpha^2-\beta^2|}\alpha$. Therefore, from $(x\sqrt a+\frac{b}{2\sqrt a})^2-w(x)^2=\frac{b^2}{4a}-c$, we conclude $$\tag1w(x)=x\sqrt a +\frac b{2\sqrt a}+O(x^{-1}).$$

If $b=c=0$, then $a=w(1)^2$ and we have $W(x)=(w(1)x)^2$ as desired. Therefore we may assume that $b\ne0$ or $c\ne 0$, hence we can consider $d=\gcd(b,w(0))$ and write $b=du$, $c=d^2v^2$ with $u,v\in\mathbb Z$. Then if $p|v$, we have that $W(p)=ap^2+dup+c$ is a multiple of $p$, but not of $p^2$, contradicting squareness. Consequently, $v=1$, $d=w(0)$, $c=d^2$ and $d|b$.

As $W(\pm d)=ad^2\pm ud^2+d^2$ is divisible by $d^2$, we see that $w(\pm d)$ is divisible by $d$ and $2u=\left(\frac {w(d)}{d}\right)^2-\left(\frac{w(-d)}{d}\right)$ is the difference of two squares. But if a difference of squares is even, it is also a multiple of four. We conclude that $u$ is even. Therefore write $b=2dh$ with $h\in\mathbb Z$. Then $$\tag2W(x) = ax^2+2dhx+d^2=(hx+d)^2+(a-h^2)x^2.$$ Thus if $h^2=a$, we are done. Therefore assume that $h\ne \pm\sqrt a$. From $(2)$ we obtain $(a-h^2)x^2=(w(x)+hx+d)(w(x)-hx-d)$. Thus $(a-h^2)x^2$ has factors $w(x)+hx+d=(\sqrt a +h)x+O(1)$ and $w(x)-hx-d=(\sqrt a -h)x+O(1)$. As $x\to \infty$, both factors are unbounded, hence for a large enough prime $x$, each factor exceeds $a^2-h$ (in absolute value) and hence must be divisible by $x$ (but not $x^2$). After dividing out $x$, this implies that $a-h^2$ has integer factors $\sqrt a +h+O(x^{-1})$ and $\sqrt a -h+O(x^{-1})$. As $x$ can grow arbitrary large, $\sqrt a\pm h$ must be integer, especially $n:=\sqrt a$ is an integer. But then from $(1)$ we have $\frac{b}{2n}=w(x)-nx+O(x^{-1})$ and this implies that $m:=\frac{b}{2n}$ is an integer because $w(x)-nx$ is an integer and $O(x^{-1})$ arbitrarily small. We obtain $W(x)=(n x+m)^2+c-m^2$, hence $c-m^2 = (w(x)-nx-m)(w(x)+nx+m)$. The second factor is unbounded hence the first factor becomes arbitrarily small. But as it is an integer, this means that it becomes $0$ for large $x$. Therefore $c=m^2$ and $$W(x)=(n x+m)^2.$$

-

$W(x) = ax^2 + bx + c$ is analytic and positive over the positive reals so it's square root $F(x)$ is also. Set $C$ to be the integer $F(0)$ and note that $c = C^2$. The functions $F$ and $W$ have the same set of roots but a root of $F$ is a double root of $W$ thus $b^2 = 4aC^2$ this implies some integer $A$ such that $a^2 = A$ hence $W(x) = A^2 x^2 + 2AC x + C^2 = (Ax+C)^2$.

-
Actually I think I need to extend to an analytic function on $\mathbb C$ for the existence of a root but then I'd have to mention the branch cut not getting in the way. – sperners lemma Oct 14 '12 at 14:17
$W(x)=(x-1)^2$ need not be positive on the positive axis. But apparently $(x_0,\infty)$ should work just as well. – Hagen von Eitzen Oct 14 '12 at 14:32
Sorry, but we must prove that W is a square of P. (and we don't know P). I think that this solution is wrong. – John Smith Oct 14 '12 at 15:59
Yes there is a mistake with using the positive reals instead $\mathbb C$ which I hope someone else can correct. – sperners lemma Oct 14 '12 at 16:06
I changed from P to F hopefully that makes it clearer. – sperners lemma Oct 14 '12 at 16:27