1

If I take $f(x)=1,\ \forall x \in \Bbb Q$ , then since $\Bbb Q$ is dense in $\Bbb R$, $f(x)=1,\ \forall x \in \Bbb R$. In this the answer should be true, but I don't understand that why the answer is given false.

balddraz
  • 7,558
  • 1
    You gave one example of a continuous function on $\mathbb Q$ which extends continuously to $\mathbb R$. This doesn't imply that it works for every continuous function on $\mathbb Q$. – Wojowu May 22 '19 at 17:52

3 Answers3

4

Consider $f(x)= \frac{1}{x-\sqrt{2}}$ on $\Bbb Q$ . This is clearly continuous on $\Bbb Q$ but can you extend continuously to $\Bbb R$ ? ( Then answer is No. Try to prove!)

Brozovic
  • 2,264
3

You've provided a nice example of a function that does have a continuous extension. What if we altered it to $$g(x)=\begin{cases}1 & x<\pi\\0 & x>\pi,\end{cases}$$ instead?

Cameron Buie
  • 102,994
2

Cameron has already provide a nice counter example but I want to add that the extension of $f:\Bbb Q\to \Bbb R$ to $\tilde f:\Bbb R\to \Bbb R$ is possible provided that we assume a stronger condition, namely $f$ is uniformly continuous.

The above claim can be seen as a consequence of a more general principle that if $f:X\to Y$ is a uniformly continuous function, where $X,Y$ are metric spaces, $Y$ being complete, then $f$ admits a unique extension to $\tilde f:\overline X\to Y$, where $\overline X$ is the completetion of $X$.

You can read more about the proof here.

BigbearZzz
  • 15,084