The function $f$ is discontinuous but $f\circ f$ is continuous

434 Views Asked by At

I have thought without a solution. Are there actually examples of a function $f:\Bbb{R}\to \Bbb{R}$ such that $f$ is discontinuous at every point but $f\circ f$ is continuous?

Answers will be highly appreciated.

1

There are 1 best solutions below

4
On BEST ANSWER

Consider $$ f(x)=\left\{ \begin{array}{ll} x,&x\in\mathbb{Q},\\ -x,&x\in\mathbb{R}\setminus\mathbb{Q}. \end{array} \right. $$ This function yields $$ f\circ f(x)=x. $$

Edit:

Let me fix the bug. Thanks to @totoro, the above example does not work, because it is continuous at $x=0$.

Considering this, let us make it as follows. $$ f(x)=\left\{ \begin{array}{ll} 1/x,&x\in\mathbb{Q}\setminus\left\{0\right\},\\ 0,&x=0,\\ -1/x,&x\in\mathbb{R}\setminus\mathbb{Q}. \end{array} \right. $$ Now this function is everywhere discontinuous, and yields $$ f\circ f(x)=x. $$