I am going through Spivak's Calculus. Thomae's Function is defined (though not named) in the book as:

$$ f(x) = \begin{cases} 0,& x \text { irrational}, \text{ }0<x<1, \\ 1/q , & x = p/q \text{ in lowest terms}, \text{ }0<x<1.\end{cases} $$

For any number $a$ so that $0<a<1$ $f$ approaches $0$ near $a$. The proof starts with letting $n$ be a natural number so large that $1/n <= \epsilon$. Now the only numbers x for which $|f(x) - 0| < \epsilon$ is false $x$ are:

$$ \frac{1}{2},\frac{1}{3},\frac{2}{3},\frac{1}{4},\frac{3}{4},\cdots,\frac{1}{n},\cdots,\frac{n-1}{n}. $$

However, many of these numbers may be, there are only finitely many. Therefore of all these numbers, one is closest to $a$ meaning $|p/q - a|$ is smallest for one $p/q$.(If a is rational, then it might be one of these numbers, in that cases values $p/q$ such that $p/q \ne a$ should be considered.) This closes distance may be chosen as the $\delta$. For if $0<|x-a|<\delta$, then $x$ is not one of:

$$ \frac{1}{2},\cdots,\frac{n-1}{n}. $$

and therefore $|f(x) - 0| < \epsilon$ is true.

Now there are few things I don't seem to understand. I can see why picking an $n$ such that $1/n <= \epsilon$ works but what I don't get is why $1/n < \epsilon$ or $1/n = \epsilon$ wouldn't work instead of $n$ such that $1/n <= \epsilon$. Also what is the reasoning of picking an $n$ such that $1/n <= \epsilon$? Is it because the function returns $\frac{1}{q}$ provided that $x$ is in the form $\frac{p}{q}$? And lastly could this also be considered a proof that shows that there is always an irrational between two reals?


When you wrote “For any number $a$”, I suppose that you meant “For any irrational number $a$”.

Why do you think we could pick $\frac1n=\varepsilon$? If, say, $\varepsilon=\sqrt{\frac12}$, then $n$ would be $\sqrt2$, which is not a natural number.

Of course, if a proof which starts by choosing $n$ such that $\frac1n\leqslant\varepsilon$ works, then choosing $n$ such that $\frac1n<\varepsilon$ also works, since $\frac1n<\varepsilon\implies\frac1n\leqslant\varepsilon$.

Yes, the choice of picking $n$ such that $\frac1n$ is small comes from the fact that, for each $x\in\mathbb R$, $f(x)$ is either $0$ or of the form $\frac1q$ for some natural $q$.

And, no, this cannot be considered as a proof that shows that there is always an irrational between two reals. Suppose that we restrict the function to $\bigl([0,1]\cap\mathbb Q\bigr)\cup\left\{\sqrt{\frac12}\right\}$. Then the proof would also prove that the limit of the function at $\sqrt{\frac12}$ is $0$, but in this case there is only a single irrational number involved.

  • $\begingroup$ Thanks a lot for the answer! In the book it doesn't specify wheter $a$ is irrational or rational, it is stated just as I did. I realized there is one more thing I am confused about. I get if $x$ is one of $\frac{1}{2},\cdots,\frac{n-1}{n}$ makes $|f(x)|<\epsilon$ false but how are there finitely many of such numbers. I mean if $n$ is 4 than $1/2,1/3,2/3,1/4,3/4$ are the values but aren't there infinitely many rationals between each of them too. Sorry if these questions seem dumb but this is my first encounter with analysis and I am self-studying. Gets me demoralized too when I get stuck. $\endgroup$ – user500668 Jan 23 '18 at 11:22
  • $\begingroup$ @user500668 Concerning your first remark: I was wrong about that. It's for every $a$. $\endgroup$ – José Carlos Santos Jan 23 '18 at 11:25
  • $\begingroup$ @user500668 Yes, there are infinitely many rationals between them, but thos from your list are the only ones for which $f$ takes a value $\geqslant\frac14$. $\endgroup$ – José Carlos Santos Jan 23 '18 at 11:26
  • $\begingroup$ Oh right I forgot that the function returns $1/q$ and thought it returned $q/p$ in which case I would have been right. $\endgroup$ – user500668 Jan 23 '18 at 11:32
  • $\begingroup$ By picking $\frac{1}{n} = \epsilon$ I actually tried to mean why bother with the equation $\frac{1}{n} <= \epsilon$ instead of just writing $|f(x)| < \frac{1}{n}$ as $\frac{1}{n} <= \epsilon$ also means $|f(x)| < \frac{1}{n} <= \epsilon$, though I admit my wording was confusing. $\endgroup$ – user500668 Jan 23 '18 at 15:29

I think one has to understand the discrete nature of rational numbers even though because of density property they appear to be continuous.

Take any interval $[a, b] $ and any positive integer $n$. Then there are only a finite number of rationals with denominator not exceeding $n$ and lying in the interval $[a, b] $. One must be convinced of the triviality/obviousness of this result. The result is obvious because once we fix the denominator equal to $k$ then we can have only a maximum of $(b-a) /k$ rationals in the interval $[a, b] $. And this is without considering the rationals in lowest form. If we do consider that then the number of rationals with the desired property is reduced even further.

The density of rationals (infinitely many rationals in any interval) is primary because of the fact that the denominator can be any positive integer and is thus an immediate consequence of the fact that there are infinitely many positive integers.

Once we are convinced of these trivial matters we can the see that $\lim_{x\to a} f(x) =0$ for any $0<a<1$. Starting with an $\epsilon>0$ we can choose a positive integer $n>1/\epsilon$ and consider all the rationals with denominator not exceeding $n$ and lying in $[0,1]$ and not equal to $a$. These form a finite set, say $A$ and hence the number $$\delta=\min\{|x-a|\mid x\in A\} $$ exists and is positive. If necessary we can choose a smaller $\delta$ such that $(a-\delta, a+\delta) \subseteq [0,1]$. Let $0<|x-a|<\delta$. If $x$ is irrational then $|f(x) |=0<\epsilon$ and if $x$ is rational then $x\notin A$ and hence has a denominator $q$ greater than $n$ and hence $|f(x) |=1/q<1/n<\epsilon$. By definition of limit $f(x) \to 0$ as $x\to a$.

You can see that the same result holds if the $1/q$ in the definition of $f$ is replaced by any function $\phi(q) $ where $\phi(q) \to 0$ as $q\to\infty$.

The usage of $1/n$ to represent arbitrarily small numbers is a very common technique which is used in many proofs in analysis. The fact is that most of the easier proofs in analysis depend on density of reals and that part is handled well by just using the rationals of type $1/n$. But this technique inherently reduces the problem to the density of rationals and therefore can't be used to prove the density of irrationals. If you want to prove that between any two real numbers lies an irrational number then you need to use either some construction of real numbers or the completeness of real numbers.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.