If $f(x)$ is a polynomial with rational coefficients such that for every rational number $r$, $f(r)$ is the square of a rational number, can we conclude that $f(x) = g(x)^2$ for some other polynomial $g(x)$ with rational coefficients?

I proved the quadratic case in my answer to this question, and am guessing that the general case is true, but don't know how to proceed.

Does this extend to polynomials in several variables? What about in different fields of fractions? Note: this is not true for complex numbers, since every complex value is the square of a complex number, but linear polynomials are not perfect squares

It seems like the proper formulation of this question is that if $f(x_1, x_2, \ldots x_n)$ is a polynomial with integer coefficients such that every integer specialization of $x_1, x_2, \ldots, x_n$ is a perfect $p$th power, then $f$ is a perfect $p$th power polynomial.

A proof is available here, which further shows that it only needs to hold for some $|x_i| < C$ (though it's a humongous $C$). Theorem 4 answers the question above and is similar to that presented by Franklin. The multi-variable case is dealt with via induction.

  • $\begingroup$ I remember I seen something similar in a math competition, I think it was called the UNESCO Math Olympiad. I am pretty sure it took place in Romania in 1995, but cannot find anything on internet.... $\endgroup$
    – N. S.
    Jul 4, 2013 at 0:22
  • 1
    $\begingroup$ @N.S. I found this thread which seems to have some nice solutions with monic restriction. $\endgroup$
    – Calvin Lin
    Jul 4, 2013 at 0:27
  • 1
    $\begingroup$ Found that contest, check problem B1: poncelet.math.nthu.edu.tw/usr2/imo_98/files/past-exams/romania/… $\endgroup$
    – N. S.
    Jul 4, 2013 at 0:40

2 Answers 2


First, we don't need to consider rational coefficients. We can clear denominators multiplying by a square integer. For the polynomial with integer coefficients it is enough to know that it is a square for integer input.

Now you need to prove that infinitely many primes are going to be divisors of the output of any non-constant polynomial $h$ in the integers. Assume that $p_1,\ldots, p_r$ are the only primes that divide every value $h(n)=a_nx^n+\cdots+a_1x+a_0$. Then take $h(a_0p_1\cdots p_r)=a_0\left(a_0^{n-1}a_n(p_1\cdots p_r)^n+\cdots+1\right)$. A la Euclid's proof the last factor should be divisible by a new prime (we probably need to take $r$ large to avoid that that last factor is $1$).

If $a_0=0$ then $h(x)=xg(x)$, so just put $x=p$ any prime you want to divide $h(p)$.

Write $f=g^2h$ with $h$ squarefree. Take a prime $p$ that doesn't divide the resultant $R(h,h')$ but such that divides $h(n)$ for some $n$. Such a $p$ and $n$ exists because of what we proved above. Since $f(n)$ is a square $p^2|h(n)$. Now $h(n+p)$ is also divisible by $p$ and therefore also divisible by $p^2$. But $h(n+p)=h(n)+ph'(n)$ mod $p^2$. This implies $p$ divides $h'(n)$ and therefore divides $R(h,h')$. Contradiction. Therefore $h$ is constant. Finally this constant $h$ must be a square since $f$ is always giving you square values.

  • $\begingroup$ Very nice, I didn't think of the resultant. $\endgroup$
    – Calvin Lin
    Jul 3, 2013 at 23:57

This is a baby application of Hilbert's irreducibility Theorem.

  • $\begingroup$ Thanks! Could you add more details to make this answer complete? I do see it under applications in the Wiki article. $\endgroup$
    – Calvin Lin
    Jul 4, 2013 at 14:47
  • 3
    $\begingroup$ Yes and therefore I won't repeat it here. $\endgroup$ Jul 5, 2013 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.