Spivak Chapter 6, Question 1.4 Spivak's chapter 6, question 1 asks: for which of the following functions $f$ is there a continuous function $F$ with domain $\mathbb{R}$ such that $F(x) = f(x)$ for all $x$ in the domain of $f$. Part (iv) asks us to consider the function $f(x) = 1/q, x = p/q$ rational in lowest terms.
The answer book says: No, because it would have to be that $F(x) = 0$ for irrational $x$, but then $F$ would not be continuous at rational numbers. I understand the second part (that $F$ would not be continuous at rational $x$ if $F(x) = 0$ for irrational $x$). But I don't know how to prove the first part. If there were an $F$ such that $F(x) = f(x)$ for all $x$ in the domain of $f$, why does it follow that $F(x) = 0$ for irrational $x$?
 A: The general idea is to pick some positive $\varepsilon$ and some irrational $z,$ then show that there is an open interval containing $z$ such that for every rational $x$ (in lowest terms) in that interval, the denominator is large enough that $f(x)<\varepsilon.$ Then you have to show that if $y<0,$ then there is some positive $\varepsilon$ such that no matter what $x\in\Bbb Q$ you choose, $|f(x)-y|>\varepsilon.$
A: If $x$ is an irrational numbers and if $\varepsilon>0$, then, in $(x-1,x+1)$, there are only finitely many rational numbers which, when written in lowest terms as $\frac pq$, have $q\leqslant n$. So, you only have $f(y)\geqslant\frac1n$ finitely many times in $(x-1,x+1)$. Take $0<\delta<1$ such that $(x-\delta,x+\delta)$ has no element of that finite set. Then $(\forall y\in\Bbb Q):|y-x|<\delta\implies\bigl|f(y)\bigr|<\varepsilon$. This shows that $\lim_{y\to x}f(y)=0$. So, if $F$ is continuous at $x$ and if $F$ is an extension of $f$, $F(x)=0$.
A: This is roughly what the graph of $f$ looks like:

Note that I drew only a few blue points, representing rational values for $x$. In reality, there are infinite such points smaller than the ones I drew. They all have $f(x)>0$.
For any $a \in \mathbb{Q}$, $\nexists \lim\limits_{x \to a} f(x)$ because $f$ is not defined at irrational numbers.
That is, for any $l \in \mathbb{R}$ that we choose as a candidate for being $\lim\limits_{x \to a} f(x)$ there exists $\epsilon>0$ such that for all $\delta>0$, $\exists y$ such that it is not true that $|y-a|<\delta$ and $|f(y)-l|<\epsilon$.
The $y$ in this argument is some irrational number in the interval $|x-a|<\delta$. Since $f(y)$ is not defined, $|f(y)-l|<\epsilon$ is false.
This is the negation of the definition of this limit.
Therefore, $\lnot (\exists \lim\limits_{x \to a} f(x))$, ie $\nexists \lim\limits_{x \to a} f(x)$.
For any new function $F(x)$ such that $F(x)=f(x)$ for rational $x$, no matter how we define $F(x)$ at irrational $x$ there will be at least one (actually it will end up being infinitely many) points with rational $x$ for which $\nexists \lim\limits_{x \to a} f(x)$.
The reason why $F$ being $0$ at irrational numbers is mentioned is that this is the only choice that makes $F$ continuous at the irrational numbers. This is supposedly the "best" case scenario: continuity at irrational numbers but not at (any) rational numbers.
José Carlos Santos answer shows how we can prove continuity at the irrational $x$ with such a definition of $F$ at irrational $x$.
