Is there a bijective function $f: \mathbb{R}\to\mathbb{R}$ that is discontinuous?

Is there a bijective function that is discontinuous?


Discontinuous everywhere: $f(x)=x$ if $x$ rational, $x+1$ if $x$ irrational.


$$f(x) =\left\lbrace \begin{array}{ll} x & \text{ if } x\not\in\lbrace 0,1\rbrace \\ 1 & \text{ if } x=0 \\ 0 & \text{ if } x=1 \end{array} \right.$$ for example.


Yes. In fact, one can construct a maximally disconnected function in the sense that it is discontinuous on every open interval $(a, b)$.

This is constructed by having every open interval $(a, b)$ map to $\mathbb{R}$. An example of this is Conway's base 13 function

Another example is the indicator function for rational numbers.

Define a function

$$ f(x) = \begin{cases} x \in \mathbb{Q} & 1 \\x \notin \mathbb{Q} & 0\end{cases} $$

This function is discontinuous everywhere because the rationals are dense in the reals, and so are the irrationals.