Is there a continuous function $F: R\to R$ such that $F$ is a surjection but not an injection, $F(Q)\subset Q$ and the restriction $F: Q\to Q$ is an injection, but not a surjection. Here $Q$ denotes the set of rational numbers. Thx for the reply!
2 Answers
An explicit example is $F(x) = x^3-2x$. Properties #1 and #2 are clear. For #3, if $x\neq y$ but $F(x)=F(y)$ then $x^2+xy+y^2=2$, but there is no integer solution $(a,b,c) \neq (0,0,0)$ of $a^2+ab+b^2=2c^2$ (remove common factors and get a contradiction modulo either $2$ or $3$).
-
$\begingroup$ Thx for your answer, but could you show in #3 $F:Q\to Q$ is not a surjection? $\endgroup$– CodeGolfCommented Jan 2, 2015 at 20:03
-
$\begingroup$ Pick almost any rational $t$ and $F(x)-t$ is usually irreducible. $t=2$ works. $\endgroup$ Commented Jan 2, 2015 at 20:06
-
$\begingroup$ Ah, sure. Thx a lot for your excellent reply $\endgroup$– CodeGolfCommented Jan 2, 2015 at 20:08
Yes, such a function exists. First observe that if $A$ and $B$ are two closed intervals and $C$ is a countable dense subset of the interior of $B$, then there is are strictly increasing and strictly decreasing homeomorphisms from $A$ onto $B$ that map the rationals in the interior of $A$ onto $C$. Now take irrational $a<b<c<d$ and three disjoint sets $C_i$, $1\le i\le 3$ of rationals that are dense in $(0,1)$. Use the lemma to map each of $[a,b]$, $[b,c]$, and $[c,d]$ homeomorphically onto $[0,1]$ with $b$ mapped to $1$ and $c$ mapped to $0$ under both of the mappings that apply to these points, and with the rationals in $(a,b)$, $(b,c)$, $(c,d)$ mapped onto $C_1$, $C_2$, and $C_3$, respectively. Extend the resulting mapping from $[a,d]$ onto $[0,1]$ in the obvious way.