Differentiable bijection $f:\mathbb{R} \to \mathbb{R}$ with nonzero derivative whose inverse is not differentiable

I had an exam today, and I was asked about the inverse function theorem, and the exact conditions and statement (as stated in Mathematical Analysis by VA Zorich): Let $X, Y \subset \mathbb{R}$ be open sets and let the functions $f: X \to Y$ and $f^{-1}: Y \to X$ be mutually inverse and continuous at points $x_{0} \in X$ and $y_{0}=f(x_{0})$, respectively. If $f$ is differentiable at $x_{0}$ and $f'(x_{0}) \neq 0$, then $f^{-1}$ is also differentiable at $y_{0}$ and its derivative is $$(f^{-1})'(y_{0})=(f'(x_{0}))^{-1}=\frac{1}{f'(x_{0})}.$$

Then I was asked to come up with an example which would show that the condition that $f^{-1}$ be continuous at $y_{0}$ is not redundant, i.e. that there exists a differentiable bijection $f: \mathbb{R} \to \mathbb{R}$ such that $f'(x) \neq 0$ for all $x \in \mathbb{R}$, but whose inverse $f^{-1}$ is non-differentiable at some point $y_{0} \in \mathbb{R}$ (my professor stated that both the domain and range are $\mathbb{R}$, but I'd be open to any example whose domain/range are open subsets of $\mathbb{R}$). I couldn't come up with an answer on the spot, so I was left with a homework assignment, which I'm shamelessly asking for help with here.

Here are some examples that almost, but don't quite fit the bill:

  1. $f(x)=x^3, f:\mathbb{R} \to \mathbb{R}$, whose inverse $f^{-1}(y)=\sqrt[3]y$ is not differentiable at $0$, but the problem is that $f'(0)=0$. If $f'(x) \neq 0$ were removed as a conditions, many counterexamples could be easily found, because any bijection $f$ whose derivative is zero at $x$ implies that $f^{-1}$ is not differentiable at $f(x)$.

  2. An example which is possibly closer to what I'm looking for is the one found in the answer of Functions which are Continuous, but not Bicontinuous, which fits the bill completely except for the domain/range, because $f^{-1}$ is not continuous at 1, let alone differentiable, but its domain is not an open or connected set, so it wouldn't be easy to extend its domain to $\mathbb{R}$ and still keep all of its properties.

I'm aware that the inverse $f^{-1}$ of a continuous bijection $f$ defined on an interval ($\mathbb{R}$ in this case) is also continuous, so the "pathological inverse" that I'm looking for is continuous (unlike example 2), but not differentiable (i.e. "spiky") at a point, even though $f$ isn't "spiky" anywhere.


On whether "there exists a differentiable bijection $f: \mathbb{R} \to \mathbb{R}$ such that $f'(x) \neq 0$ for all $x \in \mathbb{R}$, but whose inverse $f^{-1}$ is non-differentiable at some point $y_{0} \in \mathbb{R}$": I don't think this is possible.

Proof: Recall that every continuous bijection on $\mathbb R$ has a continuous inverse. So certainly this holds for $f.$ Consider the difference quotient

$$\tag 1 \frac{f^{-1}(y) - f^{-1}(y_0)}{y-y_0} = \frac{f^{-1}(y) - f^{-1}(y_0)}{f(f^{-1}(y))- f(f^{-1}(y_0))}.$$

As $y\to y_0,$ $f^{-1}(y) \to f^{-1}(y_0).$ Thus $(1)$ converges to the familiar $\dfrac{1}{f'(f^{-1}(y_0))}$ and we're done.

Added later: With reference to the comments below, I found the following example: On $(-1,2)$ define $f(x) = x$ on $(-1,0].$ On $(0,1)$ we do something more complicated while keeping $f(x)$ trapped between $g(x) = x$ and $h(x) =x+x^2.$ In so doing we are guaranteed $f'(0)=1.$

On the interval $I_n =(1/(n+1),1/n)$ define $f$ to equal the line through $(1/(n+1), h(1/(n+1))$ and $(1/n,g(1/n)).$ Then $f(I_n) = (h(1/(n+1),g(1/n)).$ Verify that $f$ is between $g$ and $h$ on each $I_n.$ Also notice that the intervals $f(I_n)$ have gaps betweem them. For example $f(I_1) = (3/4,1),$ $f(I_2) = (4/9,1/2).$

So we've defined $f$ on $(-1,1).$ Now there is a bijection from $[1,2)$ onto all the above-mentioned gaps, i. e., onto $(0,1)\setminus \cup_{n=1}^{\infty}f(I_n).$ Define $f$ to be this bijection on $[1,2).$

Then $f$ maps $(-1,2)$ bijectively onto $(-1,1),$ $f(0)=0,$ $f'(0) = 1,$ but $f^{-1}$ fails to be continuous at $0$ (because there are sequences $\to 0^+$ that $f^{-1}$ sends to $[1,2)$).


After some thoughts and discussions, I've come to the unfortunate realization that such a function ($f:\mathbb{R} \to \mathbb{R}$ a differentiable bijection, $f'>0$ WLOG (which is equivalent to $f' \neq 0$ because of Darboux's mean value theorem), $f^{-1}$ not everywhere-differentiable), does not exist, for a rather trivial reason.

If $f:\mathbb{R} \to \mathbb{R}$ were a differentiable bijection, it would be a continuous bijection, and therefore by the invariance of domain theorem, $f^{-1}$ is also continuous on all of $\mathbb{R}$, so all the conditions of the inverse funciton theorem are met, therefore $f^{-1}$ is differentiable everywhere.

PS: I'm not touting my horn by answering my own question, and zhw's answer is simpler than mine and correct, so I've accepted it. I just happened to write it out at the same time as them.