TITLE: Help with modified Takagi functions
QUESTION [18 upvotes]: First, I need to give some definitions and background information:
Define $h(x)=|x|$ for $x\in [-1,1]$. Extend this function to $\mathbb R$ by defining $h(x+2) = h(x)$. Here is a graph of $h$:

Now if we define $g(x) = \sum_{n=0}^\infty {1 \over 2^n}h(2^nx)$ then $g$ is the Takagi function. One can prove that $g$ is continuous and nowhere differentiable. I did both. Continuity follows easily from the Weierstrass M-test and for non-differentiability one can first show it for dyadic points and then for non-dyadic points. 
Now I am interested in two different modified versions of the Takagi function:
$$ g_1(x) = \sum_{n=0}^\infty {1\over 2^n}h(3^n x)$$
and
$$ g_2(x) = \sum_{n=0}^\infty {1\over 3^n}h(2^n x)$$
These two are easily seen to be continuous. 
Could someone please show me how to determine the differentiability of both $g_1$ and $g_2$? I really tried but failed.

REPLY [3 votes]: Let $x \in \mathbb{R}$.
For $n$, define $a_n,b_n \in 1/3^{n+1}.\mathbb{Z}$ as follow.
If $x$ is in some interval $[\frac{2p}{3^n},\frac{2p+1}{3^n})$, put $a_n=\frac{2p}{3^n}$ and $b_n=\frac{2p+2/3}{3^n}$.
If $x$ is in some interval $[\frac{2p+1}{3^n},\frac{2p+2}{3^n})$, put $a_n=\frac{2p+4/3}{3^n}$ and $b_n=\frac{2p+2}{3^n}$.
In both cases $y \mapsto h(3^n y)$ is of constant slope in some interval of length $1/3^n$ containing $x,a_n,b_n$.
For $k \geq n+1$, $h(3^k a_n) =0$ and $h(3^k b_n)=0$.
For $k \leq n$, $\frac{h(3^k b_n)-h(3^k a_n)}{b_n-a_n} = \varepsilon_k(x).3^k$ where $\varepsilon_k(x)$ is the right-derivative of $h$ at $3^kx$.
Hence 
$$\frac{g_1(b_n)-g_1(a_n)}{b_n-a_n} = \sum_{k=0}^{n} \varepsilon_k(x) \frac{3^k}{2^k}.$$
So the sequence $(g_1(b_n)-g_1(a_n))/(b_n-a_n)$ does not converge.

 Suppose that $g_1$ has derivative $\lambda$ at $x$. Write $\frac{g_1(b_n)-g_1(a_n)}{b_n-a_n}-\lambda = \left( \frac{g_1(b_n)-g_1(x)}{b_n-x} -\lambda \right) \frac{b_n-x}{b_n-a_n} + \left( \frac{g_1(x)-g_1(a_n)}{x-a_n} -\lambda\right) \frac{x-a_n}{b_n-a_n}$. This goes to zero because $\frac{b_n-x}{b_n-a_n}$ and $\frac{x-a_n}{b_n-a_n}$ is bounded.

For $g_2$.
Let $x \in \mathbb{R}$. For $h>0$, write
$$\frac{g_2(x+h)-g_1(x)}{h} = \sum_{k} g_k(h),$$
with $g_k(h) = \frac{h(2^k(x+h))-h(2^k x)}{3^kh}$.
Since $h$ is $1$-Lipchitz, we have $\|g\|_{\infty} \leq (2/3)^k$.
Moreover $\lim_{h \to 0} g_k(h) = (2/3)^k h^+(2^kx)$, where $h^+$ is the right-derivative of $h$.
Hence $g_2$ has right-derivative $\sum_k (2/3)^k h^+(2^kx)$.
Similary $g_2$ has left-derivative $\sum_k (2/3)^k h^-(2^kx)$.
Thus $g$ has derivative at all non dyadic rationnals.