If polynomial with rational number is injective on rationals then it is injective on reals?

Answering this CW, using the clever technique of Hailong Dao on MO, pointed out by David Speyer in comment above. We have $$ f(x) = x^3 - 2 x. $$ Now, if we have distinct rational $x,y$ such that $$ f(x) = f(y), $$ we have $x - y \neq 0$ and $$ x^2 + x y + y^2 = 2. $$ We can then take a positive integer $t$ as the least common multiple of the denominators of $x,y,$ so that $$ u = t x, \; \; v = t y $$ are integers and $$ \gcd(u,v) = 1. $$ Then $$ u^2 + u v + v^2 = 2 t^2. $$ However, $u^2 + u v + v^2$ is anisotropic in the 2-adic numbers. That is, since the result is even, it follows that $u,v$ are both even (Try it!). This contradicts $ \gcd(u,v) = 1. $ So, actually $x=y.$

I had no idea that this was related to quadratic forms in this simple way. The number 2 can be replaced by any prime $q \equiv 2 \pmod 3.$ That is, $$ x^3 - 2 x, \; \; x^3 - 5 x, \; \; x^3 - 11 x, \; \; x^3 - 17 x, \; \; x^3 - 23 x, \; \; x^3 - 29 x, \; \; x^3 - 41 x $$ are all injective on the rationals.

The more familiar way is to say Legendre symbol $(2|3) = -1.$

Note that $u^2 + u v + v^2$ is one of Pete L. Clark's ADC forms, because it is one of his Euclidean forms. That is, $u^2 + u v + v^2$ represents an integer $n$ over the rationals if and only if it represents $n$ over the integers. If you are checking this property for some $n,$ note that you also need to check $u,v$ with opposite signs as well, to be sure.