30

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.
Vivaan Daga
  • 5,531

3 Answers3

6

Edit 1. I realized my proof has a mistake. Because I use the inverse function theorem on $g \circ f$, my answer only checks out if $g \circ f$ is required to be continuously differentiable.


Original answer. Here's a counterexample.

We say a function $f$ is locally injective at a point $x$ if there exists a small interval $(x - \delta, x + \delta)$ where $x$ is injective. Suppose we have a function $f$ that is not locally injective at a point $x$. Also, suppose we have a function $g$ where the composition $g \circ f$ is differentiable at $x$. Note that because $f$ is not locally injective at $x$, $g \circ f$ cannot be locally injective by $x$. So by the inverse function theorem, its derivative $(g \circ f)'$ must necessarily vanish at $x$. This leads us to the following question:

Question. Can we find a function that is everywhere continuous, but nowhere locally injective?

If we can find such a function $f$, then any composition $g \circ f$ must be have an identically zero derivative. This means $g \circ f$ must be constant, implying $g$ is constant (at least in the range of $f$)!

We can achieve this with a function $f$ that is everywhere continuous, but nowhere differentiable. There are many such functions, the most famous being the “pathological” Weierstrass function. To prove $f$ is nowhere locally injective, suppose toward a contradiction that it is locally injective at a point $x$. Then there is in a small interval $I$ about $x$ where $f$ is injective and continuous, and hence monotone. By Lebesgue's monotone function theorem referenced in this post, $f$ must be differentiable almost everywhere in $I$. This is a contradiction because $f$ is nowhere differentiable.


Edit 2. Instead of examining local injectivity, we can maybe examine a slightly stronger condition. Let's say a function $f$ has a corner (not an actual term) at a point $x$ if for all $\delta > 0$, there exists $x_1, x_2 \in (x - \delta, x + \delta)$ such that $x_1 < x < x_2$ and $f(x_1) = f(x_2)$. The key here is that a “corner” requires the points breaking injectivity to lie on both sides of $x$.

We can show that if $f$ has a corner at $x$ and $g \circ f$ is differentiable at $x$, then $(g \circ f)'$ must vanish at $x$. For all $\delta > 0$, let $x_{1, \delta} < x < x_{2, \delta}$ be as in the definition of a corner. Taking the left-side points, we get $$ \tag{1} (g \circ f)'(x) = \lim_{\delta \to 0^+} \frac{(g \circ f)(x_{1, \delta}) - (g \circ f)(x)} {x_{1, \delta} - x}, $$ and taking the right-side points, we get $$ \tag{2} (g \circ f)'(x) = \lim_{\delta \to 0^+} \frac{(g \circ f)(x_{2, \delta}) - (g \circ f)(x)} {x_{2, \delta} - x}. $$ Note that the numerators of $(1)$ and $(2)$ are equal because $(g \circ f)(x_{1, \delta}) = (g \circ f)(x_{2, \delta})$. However, the denominators $x_{1, \delta} - x$ and $x_{2, \delta} - x$ have opposite signs, so we must have $(g \circ f)'(x) = 0$. Therefore, we can instead ask the question:

Question. Can we find a function that is everywhere continuous, but has a corner at every point in $\mathbb{R}$?

Because the Weierstrass function behaves like a fractal, this seems like it would be true (but maybe it only has corners densely packed in $\mathbb{R}$, in which continuous differentiability comes back to bite us). I'm not sure how to prove this though.

Frank
  • 2,416
  • If $f(x_1) = f(x_2)$, then $g(f(x_1)) = g(f(x_2))$. So if $f$ is not locally injective at $x$, then we can find points $x_1, x_2$ arbitrarily close to $x$ where $f(x_1) = f(x_2)$. Then $g(f(x_1)) = g(f(x_2))$, which implies $g \circ f$ is not locally injective. – Frank Jun 01 '21 at 04:05
  • Yeah, that was my intuition. – Frank Jun 01 '21 at 18:02
  • If you're referring to equation (1), note that $\delta$ is always positive. – Frank Jun 02 '21 at 06:26
  • Inspired by this answer, I found a different stronger form of "nowhere locally injective" which let me construct an explicit counterexample. – Troposphere Jun 27 '21 at 23:59
4

Inspired by Frank's notion of "corner", let's define

  • The function $f$ has a "flat" at $x$ iff for every $\delta>0$ there is an $x_1$ with $0<|x-x_1|<\delta$ such that $f(x_1)=f(x)$. (In other words, $x$ is a limit point of the fiber of $f$ it's a member of).

One easily proves:

  1. If $f$ is differentiable at $x$ and has a flat at $x$, then $f'(x)=0$.

  2. 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)$.

  3. 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.

Troposphere
  • 7,158
  • (I'm fairly sure one could also set $u(x) = x + \alpha \sin(2\pi x)$, with $\alpha\approx 0.73264413$ chosen so the local minimum near $x=0.715$ is exactly $0$. That would make the $f_n$s (but not $f$, of course) nice and smooth -- but it would also make it more complicated to be sure that there's always a $k_n$ whose wiggles are narrow enough to fit into a $\delta$.) – Troposphere Jun 28 '21 at 01:49
  • 1
    What was the motivation for taking the infinite composition ? – Vivaan Daga Jun 28 '21 at 08:32
  • @PaxDaga: Umm, that I can prove it works? In particular, it's a way to add more wiggles that's guaranteeed to preserve already-established $f(x_1)=f(x_2)$ relations, which would'n't be the case if I added new wiggles (like in the Weierstrass function). – Troposphere Jun 28 '21 at 10:58
  • With hindsight, you could say that I'm trying to give the function a property that says "no matter which $g$ we compose on the left, such-and-such will be true". Thus when my construction takes multiple steps, combining the steps by composition instead of addition naturally means that later steps will not ruin the parts of the property I've already achieved. – Troposphere Jun 28 '21 at 11:09
  • I don't understand why the filers of $f_{n}$ give the filers of f ? – Vivaan Daga Jun 29 '21 at 14:02
  • @PaxDaga: If you have $f_n(x)=f_n(y)$, then by definition of the $f_n$s you also have $f_{n+1}(x)=f_{n+1}(y)$, and $f_{n+2}(x)=f_{n+2}(y)$, and so on. This means that the sequences $f_1(x), f_2(x), f_3(y) \ldots$ and $f_1(y), f_2(y), f_3(y), \ldots$ that define the pointwise limits are identical from step $n$ onwards, and therefore their limits are the same -- in other words, $f(x)=f(y)$. – Troposphere Jun 29 '21 at 14:11
  • To be sure, we don't get all equalities between $f(x)$s that way (or in other words, we don't get full knowledge of the fibers of $f$). As one example: $k_n(\frac15) = 2^n-\frac45$ (becasue $2w(\frac15)=1+\frac15$) so $f_n(\frac15)= 1 - 2^{-n}\frac45$, and $f_m(1)=1$ for all $n$, so $f(\frac15)=f(1)=1$, but there's no $n$ where $f(\frac15)=f(1)$. But that's not a problem; all that matters for us here is that we discover enough of the $(x,y)$ pairs where $f(x)=f(y)$ to conclude that $f$ has flats everywhere. – Troposphere Jun 29 '21 at 14:27
  • (Above comment should have said "there's no n where $f_n(\frac15)=f_n(1)$"). – Troposphere Jun 29 '21 at 14:35
  • I think there is a continuous function with 0’s on all rationals that should be another counter example ? – Vivaan Daga Jul 06 '21 at 17:03
  • 1
    @PaxDaga: Do you mean a continuous function $\mathbb R\to\mathbb R$ such that $f(q)=0$ for every $q\in\mathbb Q$? The only such function is the constant zero function, not much of a counterexample :-) – Troposphere Jul 06 '21 at 17:11
  • Interesting! To plot some function, you could use this link: https://www.desmos.com/calculator/ys9nuafdq0 . The $f_n$ iterated would be cool to have, but I am not familiar with Desmos. But with these graphs, most of his arguments is easy to follow. – R. W. Prado Feb 20 '22 at 17:18
4

Gillis, Note on a conjecture of Erdos, Quart. J. of Math.,Oxford 10, (1939),151-154, has an example of a continuous function $f$, all of whose level sets are Cantor sets. Unless $g$ is a constant function, it seems $g \circ f$ won't be differentiable. (Gillis made other claims that were false, but his function does have every level set being a Cantor set).

Foran also has an example, but I don't think he published it. He constructs its graph as the intersection of a nested sequence of rectangles in the unit square.