Example of a function that is continuous at $c$ whose inverse is discontinuous at $f(c)$ I'd like an example of a function $f:(a,b)\to\mathbb R$ and a point $c\in(a,b)$ such that:

*

*$f$ is invertible.

*$f$ is continuous at $c$.

*$f^{-1}$ is discontinuous at $f(c)$.


Motivation: There is a calculus book that states the following.

Let $f$ be an invertible function defined on an interval $I$. If $f$ is differentiable at $c\in I$ and $f'(c)\neq 0$, then $f^{-1}$ is differentiable at $f(c)$.

In the proof, the continuity of $f^{-1}$ at $f(c)$ is essential. Usually, the said essential fact is an hypothesis (if the domain is not an interval) or it is implied by the hypothesis that $f$ is continuous in a neighborhood of $c$ (if the domain is an interval). But in the said book, both hipothesis are missing and the fact is justified as follows:

As $f$ is differentiable at $c$, $f$ is continuous at $c$. Therefore, $f^{-1}$ is continuous at $f(c)$.

I suspect continuity at $c$ does not imply continuity of the inverse at $f(c)$ due to the following facts:

*

*It seems it is not a common result in analysis books.

*In the usual proofs that the inverse of a continuos map (on an interval or on a compact set) is continous, in order to prove that the inverse is continuous at a given point, we need the continuity of $f$ in the whole domain.

*In more recent editions of the said book, the statement was modified (now, it is supposed that $f$ is differentiable in a neighborhood of $c$, which implies what is needed).

However, I do not have a counterexample.
 A: Here's a bijection $f$ from the interval $(-2,2)$ to the interval $(-\frac32,\frac32)$, such that $f$ is continuous at $0$, and in fact even differentiable there with $f'(0)=1$, but $f^{-1}$ is discontinuous at $f(0)=0$.
Define $f$ on the interval $(-1,1)$ by
$$
f(0) = 0
$$
and
$$
f(x) = \left( 1 + \frac{1}{n} \right) x
,\quad\text{for}\quad
\frac{1}{n} \le |x| < \frac{1}{n-1}
\quad (n = 2,3,\dots)
.
$$
For $1 \le |x| < 2$, define $f$ in a piecewise linear way, such that it assumes precisely those values that it previously jumped over, as indicated by this picture:

A: Here is an example of such a function.
It comes from the book Les contre-exemples en mathématiques by Bertrand Hauchecorne (more precisely, section 8.22, page 150, in the second edition).
Consider $g\colon \Bbb R_+ \to \Bbb R_+$ defined by
$$
g(x) = \begin{cases}
\frac{n}{2} & \text{if} \quad x=n \quad \text{is an even integer},\\
\frac{1}{n+2} & \text{if} \quad x=n \quad \text{is an odd integer},\\
\frac{1}{2(n-1)} & \text{if} \quad x=\frac{1}{n} \quad \text{with} \quad n \geqslant 2 \quad \text{integer},\\
x & \text{in any other case}. 
\end{cases}
$$
Now, consider $f\colon \Bbb R \to \Bbb R$ defined as
$$
f(x) = \begin{cases}
g(x) & \text{if} \quad x \geqslant 0,\\
-g(-x) & \text{if} \quad x < 0.
\end{cases}
$$
One shows with a bit of effort that $f$ is a bijection.
Note that $|f(x)| \leqslant |x|$ for all $x$, so that $f$ is continuous at $0$ with $f(0)=0$.
However, for all $n \geqslant 1$, $f(2n-1) = \frac{1}{2n+1}$ shows that $f^{-1}\left(\frac{1}{2n+1}\right) = 2n-1 \underset{n \to \infty}{\longrightarrow} \infty$, so that $f^{-1}$ is not continuous at $0$.
