## The Grandfather Of All Fractals And The Spikes Of Doom

This post is about the monster of the monsters, Riemann’s continuous almost nowhere differentiable function:

$r(x)=\sum^{\infty}_{k=1}\frac{sin(k^2 x)}{k^2}$

Proving that it is continuous is simple enough; proving that it doesn’t have the derivative almost everywhere is more complicated. (It is differentiable on a countable, dense subset of $\mathbb{R}$, so calling it ‘nowhere differentiable’ would be technically incorrect.)

This is the case where not even the world’s brightest mind could possibly figure out what the graph of this function will look like just by looking at the equation, so here is the picture:

Note the self-similarity. It was discovered around 1860, which makes it if not the earliest known fractal, then the first that wasn’t intentionally constructed to be self-similar, like for example, Sierpinski triangle was. (Of course, Sierpinski triangle was discovered much later, anyway.)

The best thing about Riemann’s function is that its behavior is well understood, which is surprising, given how complicated the thing looks. To be more specific, we now know how does it behave around the points of the form $\pi q$, where $q$ is rational. Write $q$ as an irreducible fraction. Now, if both the numerator and the denominator are odd, then $r(x)$ is differentiable there, and the neighborhood of that point it looks like this:

Observe that while it has the derivative there, it still isn’t monotonic there, that is to say it behaves a lot like the function from the yesterday’s post. $r(x)$ isn’t differentiable anywhere else, except for the points of this particular type.

If, on the other hand, the numerator is odd while the denominator is even, what we have is a drop:

If the numerator is even, while the denominator is 1 mod 4, we have ourselves an ‘inflection’:

Finally, if the numerator is even and the denominator is 3 mod 4, there is a spike:

Spikes may be turned upside down, and drops can be turned upside down and/or flipped horizontally. Further playing with remainders is required to determine that.

All the things I just wrote are more than just observations – they were proven rigorously, and they make the behavior of Riemann’s function much easier to understand.