Help with modified Takagi functions
Solution 1:
I believe Daniel's conjecture, so let me do some work on $g_1(x)$. Let $c=2m/3^k$ for some integer $m$ and some positive integer $k$. I want to show that $g_1(x)$ is not differentiable at $x=c$. Define $\epsilon_a = 2/3^a$ for positive integers $a$. Let's compute $\frac{g_1(c+\epsilon_a)-g_1(c)}{\epsilon_a}$ and show the limit as $a\rightarrow \infty$ does not converge to a real number.
For any non-negative integer $n\geq a$, we have $(2)3^{n-a}$ is an even integer, so: \begin{eqnarray*} h(3^nc + 3^n\epsilon_a) - h(3^nc) &=& h(3^nc + (2)3^{n-a})-h(3^nc)\\ &=& h(3^{n}c) - h(3^nc) \\ &=& 0 \end{eqnarray*}
If $a>n\geq k$ then $2m3^{n-k}$ is an even integer, and the right-derivative of $h(x)$ at $x=2m3^{n-k}$ is $1$. Since $(2)3^{n-a}<1$, we have: \begin{eqnarray*} h(3^nc + 3^n\epsilon_a) - h(3^nc) &=& h(2m3^{n-k} + (2)3^{n-a})-h(2m3^{n-k})\\ &=& (2)3^{n-a} \end{eqnarray*}
In summary, assuming $a>k$:
\begin{eqnarray*}
\frac{g_1(c+\epsilon_a)-g_1(c)}{\epsilon_a} &=& \frac{1}{\epsilon_a}\left[\sum_{n=0}^{k}\frac{1}{2^n}[h(3^nc+3^n\epsilon_a)-h(3^nc)] + \sum_{n=k+1}^{a-1}\frac{(2)3^{n-a}}{2^n}\right] \\
&\geq&\frac{1}{\epsilon_a}\left[-\sum_{n=0}^k\frac{3^n\epsilon_a}{2^n} + \sum_{n=k+1}^{a-1}\frac{(2)3^{n-a}}{2^n} \right] \\
&=& -\sum_{n=0}^k(3/2)^n + \sum_{n=k+1}^{a-1}(3/2)^n
\end{eqnarray*}
and the right-hand-side goes to $\infty$ as $a\rightarrow \infty$. So $g_1(x)$ is not differentiable at $x=c$.
Solution 2:
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.