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.

  • 9
    $\begingroup$ $f(x)=0$ for $x$ irrational and $f(x)=1$ for $x$ rational. Then $f\circ f(x)=1$. $\endgroup$
    – user551819
    May 4 '18 at 12:49
  • $\begingroup$ @ totoro: Please, does it work? $\endgroup$ May 4 '18 at 12:50
  • $\begingroup$ @ totoro: I've just seen that! Thanks! $\endgroup$ May 4 '18 at 12:51
  • $\begingroup$ You have an example in front of your nose. $\endgroup$
    – user551819
    May 4 '18 at 12:51
  • $\begingroup$ No what you are looking for but a nice, related concept: en.wikipedia.org/wiki/Cantor_function $\endgroup$ May 4 '18 at 13:03

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. $$


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. $$

  • 2
    $\begingroup$ This function is continuous at $x=0$. $\endgroup$
    – user551819
    May 4 '18 at 12:53
  • 1
    $\begingroup$ @totoro: You are right. So what about the template $1/x$? $\endgroup$
    – hypernova
    May 4 '18 at 12:56
  • $\begingroup$ @ hypernova: Thanks for the edit. You have my respect for fixing this! @ totoro and hypernova: Thanks for the eagle eye. You are both good! $\endgroup$ May 4 '18 at 13:32
  • $\begingroup$ Thank you. And I really appreciate @totoro for the crucial comment. I will keep my mistake as it was, in case it could be helpful here :-) $\endgroup$
    – hypernova
    May 4 '18 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.