-1

consider $f:[a,b]\to \mathbb{R}$ such that $f(x) \in \mathbb{Q}$ when $x \in \mathbb{R} \setminus \mathbb{Q} \cap [a,b]$ and $f(x) \in \mathbb{R} \setminus \mathbb{Q}$ when $x \in \mathbb{Q} \cap [a,b]$. Then does there exist continuous function of this type ? I need an example ..if not then why?

Umberto P.
  • 54,204
Rupsa
  • 374
  • Just a function? Take $f(x)=1$ for irrational $x$ and $f(x)=1/\pi$ for rationals. It is not a very interesting function. – uniquesolution Sep 23 '15 at 13:44
  • sorry i cant remember the question exactly because the ques is asked in a interview ..sorry for printing mistake @uniquesolution – Rupsa Sep 23 '15 at 13:52

1 Answers1

0

Sure. Choose your favorite [the second-favorite works just as well] rational number $a$ and irrational numbers $b$, then define $f$ via $$f(x) = \begin{cases} a & x \in \mathbb{R} \setminus \mathbb{Q} \\ b & x \in \mathbb{Q}\end{cases}.$$

Dominik
  • 20,241