# Does there exist a real valued function $f$ such that $\lim_{x\rightarrow q} f(x) = \infty$ for all $q\in\mathbb{Q}$

Does there exist a real valued function $f$ such that $\lim_{x\rightarrow q} f(x) = \infty$ for all $q\in\mathbb{Q}$?

My answer is no. If $f$ exists, then let us define $$g(x) = \left\{ \begin{array}{l l} \frac{1}{1+|f(x)|} & \quad \text{if } x\in \mathbb{Q}^c\\ 0 & \quad \text{if } x\in \mathbb{Q}\\ \end{array} \right. \\$$ and we see $g$ is continuous only on rational numbers, which is a contradicts the fact that the set of continuity points is a $G_\delta$ set.

Is my solution correct? And do you guys know if there is any good direct argument?

• You are right, if the condition is that $f$ goes to infinity only at rationals. But this does not seem to be the case. So your demonstration shows that any example of such a function must go to infinity on a $G_\delta$ set. Aug 18 '16 at 22:40
• @Bungo I edited my answer, so we don't have to work in extended reals.
– Xiao
Aug 18 '16 at 22:46
• @H.H.Rugh Good point! So the function goes to infinity on a dense $G_\delta$ set. I will see what else I could do.
– Xiao
Aug 18 '16 at 22:49
• What is a $G_\delta$ set? Aug 25 '16 at 7:43
• @miracle173 $G_\delta$ is the countable intersection of open sets.
– Xiao
Aug 25 '16 at 15:44

So suppose the map exists and define $$A_n=\{ x\in \Bbb{R} : \exists \delta_x>0 : 0<|u-x|<\delta_x \Rightarrow f(u)>n \}.$$ Then $A_n$ is open and dense (since it contains all the rationnals).
Define now: $$B_n=\{ x\in \Bbb{R} : \exists \epsilon_x>0 : |u-x|<\epsilon_x \Rightarrow f(u)>n\} .$$ $B_n$ is also open. And in fact also dense. To see this note that when $x\in A_n$ then $(x-\delta_x,x)$ and $(x,x+\delta_x)$ are subsets of $B_n$. So the closure of $B_n$ contains $A_n$ which was dense.
Now, by Baire the intersection of $B_n$ is non-empty. But for every $y\in \cap_n B_n$ we have $f(y)>n$ for all $n$ so $f(y)=+\infty$ and the map was not real-valued in the first place.