# Math Genius: Calculus – Michael Spivak, Continuous functions Problem 17-(c)

This is a question from Spivak’s Calculus(2008 edition) on continuous functions.
The statement of the problem is:

Let $$f(x)=0$$ when $$x$$ is irrational and $$f(frac{p}{q}) = frac{1}{q}$$ if $$frac{1}{q}$$ is in lowest terms. What is the function defined by $$g(x) = lim_{y to x}{f(y)}$$

Claim: $$lim_{x to c}{f(x)}=0 forall c in mathbb{R}$$

Case 1: When $$c in mathbb{R-Z}$$, then let $$n in mathbb{Z}$$ such that $$n < c < n + 1$$. Let $$epsilon > 0$$ be given. Let $$N in mathbb{N}$$ such that $$frac{1}{N} < epsilon$$.

Consider the following sets: $$D={{2, cdots, N}}$$ and $$S = {{n + frac{i}{d}:0

We claim that the set $$S$$ is precisely the set of all rational numbers in the interval $$(n, n+1)$$ for which $$|f(x)-0| may fail to hold, for, if $$frac{k}{d}$$ be any rational number in the interval $$(n, n+1)$$, then $$frac{k}{d}$$ can be written as $$n + frac{j}{d}$$ where $$0 and hence it belongs to $$S$$. Any other rational number in the interval $$(n, n+1)$$ will have a denominator $$>N$$ and thus the condition $$|f(x)-0| is automatically satisfied. Also note that if $$x$$ is irrational, $$f(x)=0$$ and thus $$|f(x)-0|< epsilon$$

Now, choose $$delta$$ such that $$delta = min({|x-c|:x in S text{and} x neq c})$$. Therefore, if $$0<|x-c|, then $$x notin S$$ and hence $$|f(x) – 0| is satisfied. Hence, by the definition of the limit, we have $$lim_{xto c}{f(x)}=0 forall c in mathbb{R-Z}$$

Case 2: When $$c in mathbb{Z}$$
This case is very similar, we just work on the interval $$(c-1, c+1)$$ and define $$S$$ such that $$S = {{(c-1) + frac{i}{d}:0. Then we proceed in the same way as before.

Therefore, we have $$lim_{xto c}{f(x)}=0 forall c in mathbb{R}$$ and thus $$g(x)=0 forall x in mathbb{R}$$

First of all, I would like to know whether my proof is correct.
If yes, then I have a feeling that this proof is needlessly complicated, so I would like to know if there is any other way to solve this problem.

Yes, it is correct.

I think that the following proof, which employs the periodicity of $$f$$, is a bit simpler, but if you don’t agree I will delete it. As you know, for each $$varepsilon>0$$, there are only finitely many elements $$xin[0,1]$$ such that $$|f(x)|geqslantvarepsilon$$. So, if $$cin[0,1]$$ and if $$varepsilon>0$$, then you take$$delta=min{|x-c|mid xin[0,1]text{ and }|f(x)|geqslantvarepsilon}.$$So, $$0<|x-c|.

This proves that, as far as the restriction of $$f$$ to $$[0,1]$$ is concerned, we have $$lim_{xto c}f(x)=0$$. Since $$f$$ is periodic with period $$1$$, the same is true on any interval $$[n,n+1]$$ (with $$ninBbb z$$).

Finally, if $$ninBbb Z$$, since we know that $$lim_{xto n^-}f(x)=lim_{xto n^+}f(x)=0$$, we know that $$lim_{xto c}f(x)=0$$.