# Discontinuous bijection example

Is there an example of a function that is discontinuous but bijective whose inverse is also a bijection and discontinuous?

• Almost anything, really. Being bijective doesn't have anything to do with being continuous. Just try thinking of your favorite discontinuous function and check if it also happens to be a bijection. – Jair Taylor Sep 20 '16 at 17:46
• Three answers have appeared (including mine) but so far I'm the only one to up-vote the question (and the only one whose answer has no up-votes). $\qquad$ – Michael Hardy Sep 20 '16 at 22:33

## 3 Answers

$$f(x) = \begin{cases} x & \text{if }x\in \mathbb Q \\ x+1 & \text{if }x\in \mathbb R\setminus\mathbb Q \end{cases}$$

Or even $$g(x) = \begin{cases} -x & \text{if }x\in\mathbb Q \\ 2\sqrt2-x & \text{if }x-\sqrt2 \in \mathbb Q \\ x & \text{otherwise} \end{cases}$$ which is its own inverse and nowhere continuous.

A very simple pictorial example: The inverse of a bijection is always a bijection.

The inverse of a function that is not everywhere continuous is in some cases everywhere continuous, and in particular there exist bijections that are not everywhere continuous but whose inverse is everywhere continuous, so there's more work to do than just finding a bijection that is not everywhere continuous.

How about this: \begin{align} f &: [0,1)\to [0,1) \\[5pt] f(x) & = \begin{cases} x+\frac 1 2 & \text{for } 0\le x\le \frac 1 2, \\[5pt] x - \frac 1 2 & \text{for } \frac 1 2 \le x < 1. \end{cases} \end{align} This is an involution, i.e. it is its own inverse. It has a jump discontinuity at $x=\frac 1 2.$