# Proving Thomae's function is nowhere differentiable.

I am given the function

$$f(x)=\begin{cases} 0 \text{ ; when } x \text{ is irrational} \\\frac 1 q \text{ ; for } x=\frac p q \text{ irreducible fraction}\end{cases}$$

Spivak proved that for $a\in (0,1)$, we have $$\lim_{x\to a} f(x)=0$$

That is, this function is only continuous at the irrationals. I assume we consider $f$ for $x\geq 0$, since for negative $x$ it wouldn't be defined:

If $x=-\dfrac p q=\dfrac {-p }q=\dfrac {p }{-q}$ should we take $f(x)=-\dfrac 1 q$ or $f(x)=\dfrac 1q$?

Also, this function is periodic with period $1$, so we can just prove this on $(0,1)$ (as in the first case when proving continuity).

Now, Spivak wants me to prove this function is not differentiable at $a$, for any $a$. It is clear that, since it isn't continuous at the rationals, it is not differentiable there. Thus we need to prove the claim for $a$ irrational.

He gives the following hint.

Suppose $a=n,a_1a_2a_3\dots$. Consider the expression $$\frac{{f\left( {a + h} \right) - f\left( a \right)}}{h}$$ for $h$ rational, and also for $h=-0,0\dots0a_{n+1}a_{n+2}\dots$

I have been trying to work this out for a while, but I can't. I am not sure, also, if he meant to have the $n$ in the subindices match the $n$ of $a$, or if it is only a typo. The book has $$\frac{{f\left( {a + h} \right) - f\left( h \right)}}{h}$$ instead of $$\frac{{f\left( {a + h} \right) - f\left( a \right)}}{h}$$ which is (I guess) a typo, too.

For $h$ rational, one gets $$\frac{{f\left( {a + h} \right) - f\left( a \right)}}{h} = 0$$ and for $h=-0,0\dots0a_{n+1}a_{n+2}\dots$, you get,assuming $a+h=m/u$ $$\frac{{f\left( {a + h} \right) - f\left( a \right)}}{h} = \frac{{f\left( {a + h} \right)}}{h} = f\left( {\frac{m}{u}} \right)\frac{1}{h}$$

but I really don't know what to do with this. I know I have to show the limit $$\mathop {\lim }\limits_{h \to 0} \frac{{f\left( {a + h} \right) - f\left( a \right)}}{h} = \mathop {\lim }\limits_{h \to 0} \frac{{f\left( {a + h} \right)}}{h}$$ doesn't exist for any $a$, but I can't see how.

I'm looking for good hints rather than full solutions.

-
I'm used to the convention that a "reduced fraction" always has positive denominator. (the numerator can be either positive, negative, or zero) – Hurkyl Sep 16 '12 at 23:48
@Hurkyl Good to know. – Pedro Tamaroff Sep 17 '12 at 0:00
Without the hint: 1. Recall that another equivalent definition of differentiability of $f$ at $a$ is _$f$ is diff. at $a$ iff $$\displaystyle{\lim_{x\to a} \frac{f(x)-f(a)}{x-a}}\in\Bbb R$$._ 2. Use the fact that for any function $h$, $\lim_{x\to a}h(x)=l$ iff for each sequence $(x_n)$ with $x_n\to a$, $\lim_{n\to\infty}f(x_n)=l$. – leo Sep 17 '12 at 0:41
@leo See Brian's comment. I see what you mean now. I guess the proof of $2$ shouldn't be awfully difficult, right? – Pedro Tamaroff Sep 17 '12 at 0:51
Well it is a good exercise, just let flow the definitions of limit of a function and limit of a sequence. – leo Sep 17 '12 at 0:55

First, I agree with Hurkyl that you should understand the denominator to be positive.

In the hint the index $n$ in the expansion of $h$ is not the same as the $n$ before the comma in the expansion of $a$.

If $h=-0,0\dots0a_{n+1}a_{n+2}\dots$, then $a+h=n,a_1\dots a_n$, which can be written as a fraction with denominator $10^n$. In lowest terms, therefore, its denominator is at most $10^n$, and $f(a+h)\ge 10^{-n}$. On the other hand, $|h|<10^{-n}$. Can you finish it from there? Consider letting $n\to\infty$.

-
Hmm OK. Now, I should say that, for every $h$ of the form $-0,0\dots0a_{n+1}a_{n+2}\dots$ we'll have $f(a+h)/h>1$, thus, for any $\epsilon \geq 1$ no $\delta$ will work. That is, we can make $h$ as small as we want (keeping it of the desired form) but $f(a+h)/h>1$ in any case, while for $h$ rational $f(a+h)/h=0$, so the limit doesn't exist? Why would I want to let $n\to \infty$? – Pedro Tamaroff Sep 17 '12 at 0:43
@Peter: You’ve got it. There’s at least this one ‘bad’ sequence of $h$’s approaching $0$ for which the difference quotient is always greater than $1$, while there are other sequences for which it’s always $0$. – Brian M. Scott Sep 17 '12 at 0:45
So that's what @leo was saying! Great. – Pedro Tamaroff Sep 17 '12 at 0:52
@PeterTamaroff yes I was following those lines of thought – leo Sep 17 '12 at 0:58

Fix $\epsilon = 1$. We want to show that $\forall \delta > 0$, there exists $x + h = \dfrac{p}{q} \in (x - \delta, x + \delta)$ for which $\dfrac{f(x + h)}{h} > 1$.

Notice that if $x + h = \dfrac{p}{q}$, then $f(x + h) \ge \dfrac{1}{q}$.

Pick $q > \dfrac{1}{\delta}$. We can find an integer $p$ so that $p - 1 < qx < p$. Set $x + h = \dfrac{p}{q}$. We have:

$$\dfrac{p}{q} - \dfrac{1}{q} < x \Rightarrow h < \dfrac{1}{q}$$

Finally:

$$\dfrac{f(x + h)}{h} > \frac{1}{q} \cdot q = 1$$

-