# Proving that the function $f(x)=\sum_n\frac{1}{10^n}\{10^nx\}$ is everywhere continuous but nowhere differentiable.

Theorem: The function $$f(x)=\sum_{n=1}^{\infty}\frac{1}{10^n}\{10^nx\}$$ is everywhere continuous but nowhere differentiable, where $$\{.\}$$ represents distance from nearest integer.
This theorem has been taken from chapter $$23$$ of Spivak's Calculus book.

By Weirstrauss M test, $$f$$ is uniformly continuous.
In the book, the theorem is proven by showing that the limit $$L=\lim_{m\to \infty}\frac{f(a+h_m)-f(a)}{h_m}=\lim_{m\to \infty}\sum_{n=1}^{\infty}\frac{\{10^n(a+h_m)\}-\{10^na\}}{10^nh_m}$$ does not exist when $$h_m\to 0$$, where $$a\in (0,1]$$. Let $$a=0.a_1a_2\cdots$$

Let $$h_m=10^{-m}$$ if $$a_m\ne 4,9$$ and $$h_m=-10^{-m}$$ if $$a_m=4,9$$.$$\tag{1}$$
No. of terms in summation in the above limit $$L$$ is finite as if $$n\ge m, 10^nh_m$$ is integer and hence numerator of the summations becomes zero. So for $$n\lt m$$, $$\{10^na\}=\text{integer}+0.a_{n+1}a_{n+2}\cdots a_m\cdots$$ and $$10^n \{a+h_m\}=\text{integer}+0.a_{n+1}a_{n+2}\cdots (a_m\pm1)\cdots$$ and this representation into decimals is correct as $$h_m=-10^{-m}$$ if $$m=9$$.
**

Then, Spivak makes a statement that if $$0.a_{n+1}a_{n+2}\cdots a_m\cdots \le 0.5$$, then we also have $$0.a_{n+1}a_{n+2}\cdots (a_m\pm 1)\cdots \le 0.5$$ as $$h_m=-10^{-m}$$ if $$a_m=4$$.

**

And I think that this is not true at all because in the special case $$m=n+1$$, if $$a_m=5$$ then clearly $$0.a_m\le 0.5$$ but $$0.(a_m\pm 1)\le 0.5$$ is not true! and hence condition on $$h_m$$ should be $$h_m=-10^{-m}$$ when $$a_m=5,9$$ and $$h_m=10^{-m}$$ when $$a_m\ne 5,9$$. Is my understanding correct?

Another doubt that I have is:

Is the following alternative way correct?
Let's choose $$h_m=10^{-m}$$ if $$a_m\ne 9$$ and $$h_m=-10^{-m}$$ if $$a_m=9$$. Then it's clear by writing decimal representation that, $$\{10^n(a+h_m)\}-\{10^na\}=\pm 10^{n-m}$$ and then $$L=\lim_{m\to \infty}\frac{f(a+h_m)-f(a)}{h_m}=\lim_{m\to \infty}\sum_{n=1}^{\infty}\frac{\{10^n(a+h_m)\}-\{10^na\}}{10^nh_m}=\lim_{m\to \infty}\sum_{n=1}^{m-1}\frac{\{10^n(a+h_m)\}-\{10^na\}}{10^nh_m}\lim_{m\to \infty}\sum_{n=1}^{m-1}\pm 1=\lim_{m\to \infty}\pm (m-1)$$,
which doesn't exist. Hence proved.

• @OliverDiaz: Even in the book in your link, it's not made clear why $h_m=-10^{-m}$ when $a_m=4$, which I think should have been $a_m=5$. And why do we have to distinguish cases $\lt 1/2$ , $\gt 1/2$? – Koro Sep 16 at 21:46
• Do you agree that with $h_m=-10^{m}$ for $a_m=4,9$ and $h_m=10^{-m}$ things work? All you need is a particular sequence $h_m\rightarrow0$ for which the sum does not converge. notice that there is a choice to make for the decimal expansion of $x$ when $x$ has a a possible finite decimal expansion. – Oliver Diaz Sep 16 at 21:56
• @OliverDiaz: I disagree with $h_m=-10^{-m}$ when $a_m=4$ as it will create problems for $a_m=5$. – Koro Sep 16 at 22:04

This is a comment that is to long for the comment section.

The idea of the construction is to keep preserved fractional parts on the same side of $$\frac{1}{2}$$, that is if $$10^na-[10^na]<\frac{1}{2}$$, then $$10^n(a+h_m)-[10^na]<\frac12$$ and if $$10^na-[10^na]\geq\frac{1}{2}$$, then $$10^n(a+h_m)-[10^na]\geq\frac12$$

Try to convince yourself that

• If $$a_m\notin\{4,9\}$$, then for all $$n=1,\ldots,m-1$$, $$\{10^n(a+10^{-m})\}-\{10^na\}=10^{n-m}\,(-1)^{\mathbb{1}_{a_n<5}(a)}$$ For $$n\geq m$$ $$\{10^n(a+10^{-m})\}=\{0.a_{m+1}a_{m+2}\ldots\}=\{10^na\}$$ so $$\Delta_m:=\frac{1}{10^{-m}}\sum^\infty_{n=1}\frac{\{10^n(a+10^{-m})\}-\{10^na\}}{10^n}\equiv m\mod 2$$

• If $$a_m\in\{4,9\}$$, then for all $$n=1,\ldots,m-1$$, $$\{10^n(a-10^{-m})\}-\{10^na\}=10^{n-m}\,(-1)^{1+\mathbb{1}_{a_n<5}(a)}$$ For $$n\geq m$$ $$\{10^n(a-10^{-m})\}=\{0.a_{m+1}a_{m+2}\ldots\}=\{10^na\}$$ so $$\Delta_m:=-\frac{1}{10^{-m}}\sum^\infty_{n=1}\frac{\{10^n(a-10^{-m})\}-\{10^na\}}{10^n}\equiv m\mod 2$$

If you were to modify the construction and set $$h_m=-10^{-m}$$ if $$a_m\in\{5,9\}$$ and $$h_m=10^{-m}$$ otherwise then, for $$a$$ with $$a_m=4$$ you get

$$\{10^{m-1}(a+10^{m})\}-\{10^{m-1}a\}=1-10^{-m} -2(0.4a_{m+1}\ldots)$$ and so $$\frac{1}{10^m}\sum^\infty_{n=1}\frac{\{10^n(a+10^{-m})\}-\{10^na\}}{10^n}\notin\mathbb{Z}$$

The genius of the construction is to keep all differential increments $$\Delta_m$$ as integers that vary on the parity of $$m$$.

• In "that is if $10^na-[10^na]<\frac{1}{2}$, then $10^n(a+h_m)-[10^na]<\frac12$", did you mean $10^n(a+h_m)-[10^n(a+h_m)]<\frac12$? I suppose $[.]$ is greatest integer function. – Koro Sep 17 at 5:45
• No, I wrote what I meant. The construction maintains which side of of 1/2 the fractional part is. – Oliver Diaz Sep 17 at 14:09
• @Koro: In the construction, the only crucial setp is when $a_m=4$ and $n=m-1$. then $\{10^{m-1}(0.a_1\ldots a_{m-1}(4-1)a_{m+1}\ldots\}-\{10^{m-1}(0.a_1\ldots a_{m-1}4a_{m+1}\ldots\}=-0.1$ – Oliver Diaz Sep 17 at 14:59