# A Continuous Nowhere-Differentiable Function

The book Understanding Analysis by Stephen Abbott asserts that

$$g(x)=\sum_{n=0}^{\infty}\frac{1}{2^n}h(2^nx),$$

where $h(x)=\left|x\right|$, $h:\left[-1,1\right]\to\mathbb{R}$, and $h(x+2)=h(x)$, is continuous on all of $\mathbb{R}$ but fails to be differentiable at any point.

However, if I am not mistaken, can the $2^n$'s be cancelled out in $g$? I tried plotting this and could not obtain a nowhere-differentiable function.

-
This function is called a Blancmange function, and you can easily google its nowhere differentiability. Anyway, your primary mistake is that $h(ax) = ah(x)$ does not hold even for $a > 0$. Note that $h(x)$ differs from $|x|$. – Sangchul Lee Dec 14 '12 at 4:27

The plot looks like this. It's hard to tell by a casual look that this is nowhere differentiable.

For a better view of what's going on, here's an animation that zooms into the graph. You can see that the picture looks similar at different length scales. A differentiable curve, on the other hand, would look more and more like a straight line as you zoomed in.

EDIT: I plotted this in Maple. I don't have the code any more, but it might have been something like this.

h:= x -> abs(x - 2*round(x/2)):
x0:= 0.23456: y0:= evalf(g(x0)): r:= 1.13:
for i from 0 to 99 do
frame[i]:= plot(r^i*(g(x/r^i + x0) - y0), x=-1..1, axes=none,
title = sprintf("Zoom factor %7.1f",r^i))
od:
plots[display]([seq(frame[i],i=0..99)],insequence=true);

-
Oops, factor of $\pi$ left out (I was using $\arccos(\cos(\pi x))/\pi$ for $h$): I'll fix it. – Robert Israel Dec 14 '12 at 6:55
How are you getting this plot $i.e.$ in which software are you piloting this ? Cold you please give the code? – Sachchidanand Prasad Sep 4 '15 at 16:13

No, the $2^n$s cannot be cancelled out, as William Macrae and sos440 have pointed out.

$h$ is a zig zag function. $h(2^nx)$ is like $h$ but with the zig zags squished in toward the $y$-axis, making it go up and down more rapidly, but at the same height. Then $\dfrac1{2^n} h(2^nx)$ is like $h(2^nx)$ but with the zig zags squished down toward the $x$-axis, making them a lot shorter.

The $1/2^n$ out front ensures that the series converges uniformly (and hence that the resulting function is continuous), because $h$ is bounded. The combination of $2^n$s ensures that each term has zig zags of slope $\pm1$, while the number of zig zags per unit interval doubles from one term to the next.

-

The $2^n$s cannot be cancelled because one is inside of the function $h$ (which is not affine). This is the same reason that $2 \sin(\frac12 x) \neq \sin(x)$ (for arbitrary $x$). The function that is being described is qualitatively the sum of more-and-more fine-grained 'zig-zag' functions; it's likely you are not plotting it quite right, so try plotting just one term first.

-