Skip to main content
4 of 4
added 63 characters in body
Will Sawin
  • 148.4k
  • 9
  • 324
  • 563

EDIT: Following a clever observation of user44191 in the comments:

If $f(x)$ is a monic polynomial, and $c$ a number, then the polynomial $xf(x)^2+c$ has a similar property to your example (the case $f(x)=x+1/2$). Indeed, we have $x = \frac{-c}{f(x)^2}$ so

  • If $-c$ is a nonzero square then all rational roots are squares.
  • if $-c$ is a nonsquare then all rational roots are not square, but their ratios are square.
  • If $-c$ is zero then one root is zero and the rest are double (this doesn't really fit the pattern).

This produces polynomials of odd degree. For even degree examples, we can do $f(x)^2+cx$. This gives $x =\frac{ f(x)^2}{-c}$ so we have the same thing except if $-c$ is zero than all roots are double, and there is a special case if $f(0)=0$.

So we have many examples of polynomials of this type.

(See the edit history for an earlier argument, special to the case of degree 3 polynomials, if desired. This was inspired by darij grinberg's answer, and that earlier answer inspired user44191's comment, so both of them are partially responsible for this solution.)

Will Sawin
  • 148.4k
  • 9
  • 324
  • 563