Continuity of the inverse $f^{-1}$ at $f(x)$ when $f$ is bijective and continuous at $x$.

Prove or disprove: Let $f:\mathbb{R}\to\mathbb{R}$ be bijective and $f$ is continuous at $x$. Then $f^{-1}$ is continuous at $f(x)$.

Any hints are welcome. If this is false, I would like to have a counterexample.

I tried the $\epsilon,\delta$ argument and I know this statement may not be true. But this problem only tells the continuity at a single point, and the function may not be monotone, for example:

$$f:\mathbb{R}\to\mathbb{R},\quad f(x)=\begin{cases}x,&x\in\mathbb{Q}\\ -x,&x\notin\mathbb{Q}\end{cases}$$

This function is bijective and is only continuous at $0$, and it is not monotone.


I think the following could be a counterexample.

Let us define $f \colon [0,3] \to [0,3]$ as follows: $$ \begin{align} f\left(\frac 1n\right)&=\frac1{2n}; \text{ for }n=1,2,3,\dots;\\ f\left(3-\frac1{2n-1}\right)&=\frac1{2n-1}; \text{ for }n=1,2,3,\dots;\\ f\left(3-\frac1{2n}\right)&=3-\frac1{n}; \text{ for }n=1,2,3,\dots;\\ f(x)&=x; \text{ if $x$ does not have the form $\frac1n$ or $3-\frac1n$} \end{align} $$

In other words, we are working only with points of the form $1/n$ and $3-1/n$ and we do not move other points. The points of the form $1/n$ are mapped to $1/(2n)$. So far we do not have anything mapped onto points of the form $1/(2n+1)$, so we use half of the points of the form $2-\frac1n$ to get something mapped onto them.

The function $f$ is bijective, it is continuous at $0$, but $f^{-1}$ is not continuous at $0$. (To see this just take $x_n=\frac1{2n+1}$ and notice that $x_n\to0$ and $f^{-1}(x_n)\to3$.)

The basic idea is very similar to general "Hilbert's hotel" idea, like here and in many other constructions of bijections. I hope that, at least to some extent, I managed to capture the construction in the following picture, which might help you ti visualize this example.

enter image description here

EDIT: I've added one more version of the picture. The dotted lines might make easier to see which of the "full" and "empty" circles have the same x-coordinates/the same y-coordinates.

enter image description here


So first I would consider what a bijective function is:

A function $f : \mathbb{R} \to \mathbb{R}$ is bijective if it's both injective and surjective.

Next let's look at what surjective and injective mean:

A function $f : \mathbb{R} \to \mathbb{R}$ is injective given that $x \neq y \implies f(x) \neq f(y)$

and surjective:

A function $f : \mathbb{R} \to \mathbb{R}$ is surjective if $\forall \; y \in \mathbb{R} \; \exists \; x \in \mathbb{R} \; s.t. \; f(x) = y$ or in set notation $f(\mathbb{R}) = \mathbb{R}$

Now given some $x \in \mathbb{R}$ let's look at the definition of continuity at a point.

A function $f : \mathbb{R} \to \mathbb{R}$ is continuous at $x$ if $\forall \; \epsilon > 0 \; \exists \; \delta > 0 \; s.t. \; \lvert x - y \rvert < \delta \implies \lvert f(x) - f(y) \rvert < \epsilon$ or more concisely, and assuming there aren't any isolated points: $\lim_{x \to x_0} f(x) = f(x_0)$

Ok now we know this function is surjective (since it's bijective) and so we know there aren't any isolated points that $f$ takes (let me know if you don't understand any of this, I just realized I might be talking about too advanced of things for this question) so we can use the second definition of continuity of $f$. So we know

$$ \lim_{y \to x} f(y) = f(x) $$

Now if we look at the inverse function, we know it is as well bijective (a bijective function has a bijective inverse - not sure if you're allowed to assume this, if you're not a simple proof by contradiction could work). Now our goal is to show that

$$ \lim_{y \to f(x)} f^{-1}(y) = f^{-1} (f(x)) = x $$

Does this help at all? Do you need any more ideas?