Can every continuous function $f(x)$ from $\mathbb{R}\to \mathbb{R}$ be continuously "transformed" into a differentiable function?
More precisely is there always a continuous (non constant) $g(x)$ such that $g(f(x))$ is differentiable?
- This seems to hold for simple functions, for instance the function $f(x)=|x|$ can be transformed into a differentiable function by the function $g(x)=x^2$.
- If $g(x)$ is additionally required to be increasing everywhere and differentiable then the answer seems to be no by the inverse function theorem, because of the existence of continuous nowhere differentiable functions.
Inspired by Frank's notion of "corner", let's define
One easily proves:
If $f$ is differentiable at $x$ and has a flat at $x$, then $f'(x)=0$.
The points where $f$ has flats depend only on the set of fibers of $f$ -- or, in other words, on the equivalence relation $x\sim_f y \Leftrightarrow f(x)=f(y)$.
If $f$ has a flat at $x$ and $g$ is an arbitrary function, then $g\circ f$ also has a flat at $x$.
I will construct a continuous surjection $f:\mathbb R\to \mathbb R$ where every $x$ is flat (that is, in more dignified terms, a function whose fibers are all perfect sets). This property guarantees that $g\circ f$ can only be differentiable if it is constant.
First, let $w:[0,1]\to[0,1]$ be a zig-zag function that goes from $0$ up to $1$, then down to $0$ and back up to $1$:
$$ w(x) = \begin{cases} 3x & 0 \le x \le 1/3 \\ 2 - 3x & 1/3 \le x \le 2/3 \\ 3x - 2 & 2/3 \le x \le 1 \end{cases} $$
Stack an infinite sequence of $w$s to get $u:\mathbb R\to \mathbb R$: $$ u(x) = \lfloor x\rfloor + w\bigl(x-\lfloor x\rfloor\bigr) $$ We note that $u$ is continuous and $|u(x)-x|<1$ everywhere.
Now for each $n\ge 0$, let $$ h_n(x) = \frac{u(2^n x)}{2^n} $$ This looks like $u$, except that we have "zoomed out" by a factor of $2^n$ so we have more and smaller wiggles around $x=y$. In particular, $|h_n(x)-x|\le 2^{-n}$.
Now form the infinite composition of all the $h_n$'s: $$ f = \lim_{n\to\infty} h_n \circ h_{n-1} \circ \cdots \circ h_1 \circ h_0 $$ or, written in more detail: $$ f_0(x) = x \qquad\qquad f_{n+1}(x) = h_n(f_n(x)) \qquad\qquad f(x) = \lim_{n\to\infty} f_n(x) $$ The limit exists pointwise because the bound on the wiggles on each $h_n$ makes the sequence Cauchy -- and this argument actually bounds the difference uniformly. So $f$ is continuous, being a uniform limit of continuous functions.
To see that $f$ has flats everywhere, it is convenient to define $$ k_n(x) = 2^n f_n(x) $$ We then have the recurrence $$ k_0(x) = x \qquad\qquad k_n(x) = 2u(k_{n-1}(x)) $$ In other words, we're just iterating $2u$. We don't need to worry about taking the limit anymore, because the fibers of the $k_n$s (and therefore also of $f_n$) will tell us enough to conclude that $f$ has flats everywhere.
Note that $k_n$ is piecewise linear, with each linear piece having slope $\pm 6^n$, and it changes direction only at points where $k_n(x)$ is an (even) integer.
Now suppose we're given $x$ and we're looking for a $x_1$ within $\delta=6^{-n}$ of $x$ where $f(x_1)=f(x)$. We fast-forward to $k_n$ and find that $x$ lies in a closed interval $[y,y+6^{-n}]$ where $k_n(x)$ either ascends linearly from an integer to the next or descends from an integer to the previous (namely, $y=6^{-n}\lfloor 6^n x\rfloor$ will work). This means that $k_{n+1}$ restricted to this interval attains each value in its image at least twice. So we can find an $x_1\ne x$ in the interval such that $k_{n+1}(x_1) = k_{n+1}(x)$ and therefore also $f(x_1)=f(x)$, as required.