# Can it be that $f$ and $g$ are everywhere continuous but nowhere differentiable but that $f \circ g$ is differentiable?

So, I was just asking myself can something like this happen? I was thinking about some everywhere continuous but nowhere differentiable functions $f$ and $g$ and the natural question arose on can the composition $f \circ g$ be differentiable, in other words, can the operation of composition somehow "smoothen" the irregularities of $f$ and $g$ which make them non-differentiable in such a way that composition becomes differentiable?

So here is the question again:

Suppose that $f$ and $g$ are everywhere continuous but nowhere differentiable functions. Can $f \circ g$ be differentiable?

If such an example exists it would be interesting because the rule $(f(g(x))'=f'(g(x)) \cdot g'(x)$ would not hold, and not only that it would not hold, it would not make any sense because $f$ and $g$ are not differentiable.

• monotone functions must be somewhere differentiable. Dec 12 '15 at 15:04

Suppose that $f\circ g$ is differentiable. Then it has bounded variation on some interval $[c,d]$. Since $g$ is nowhere differentiable, it is nowhere monotone; thus, we can arrange that $g(c) < g(d)$ by shrinking the interval further. Let $a=g(c)$ and $b=g(d)$.
The function $f$, being nowhere differentiable, has infinite variation on $[a,b]$. That is, for every $M$ we can find a partition $a=x_0<x_1<\dots<x_n=b$ such that $$\sum_{i=1}^n |f(x_i)-f(x_{i-1})| > M$$ Let $t_i=\inf\{t\in [c,d] : g(t) \ge x_i\}$. The continuity of $g$ implies that $g(t_i)=x_i$ and $c=t_0< t_1<\dots<t_n\le d$. (It may happen that $t_n<d$.) Then $$\sum_{i=1}^n |f(g(t_i))-f(g(t_{i-1}))| > M$$ and since $M$ was arbitrary, this contradicts $f\circ g$ having bounded variation on $[c,d]$.