Extension of a continuous function $f: \mathbb{Q}\to\mathbb{R}$ to a continuous function $g:\mathbb{R}\to\mathbb{R}$.

analysiscontinuity

Prove or disprove that for all continuous functions $f:\mathbb{Q}\to\mathbb{R}$ there is a unique continuous function $g:\mathbb{R}\to\mathbb{R}$ with $g(x)=f(x),\ \forall x\in\mathbb{Q}$.

Now, this is a task consisting of 2 subtask and this is the latter. In the first one (I think) I have proved that this statement is true for uniformly continuous functions. Now I will try to disprove this statement.

Let us choose $x,y\in\mathbb{R}$ with $d(x,y)<\delta/3$ where $x$ is fixed. Now let us choose $x_n\to x\wedge y_n\to y,\ x_n,y_n\in\mathbb{Q}$. Thereby $d(x_n,y_n)<\delta$. In my other proof, I now used the property for uniformly continuous functions and said that $d(f(x_n),f(y_n))<\varepsilon/2$ and followed that $g$ is uniformly continuous and unique. However, I can't use that premise here, which is why I think that this statement is false as $d(f(x_n),f(y_n))$ can be anything because of $x_n$ not being fixed (and we can't apply the continuity).

How do I go from here / is this the right path in the first place?

Any help would be greatly appreciated.

Best Answer

Is false

Let $$ f:\Bbb Q\to\Bbb R\\ f(x) = \begin{cases} 1, & \text{if $x<\sqrt2$} \\ 0, & \text{if $x>\sqrt2$} \end{cases} $$ The function is continuos but $$ \lim_{x\to \sqrt2^{+}}f=0\\ \lim_{x\to \sqrt2^{-}}f=1 $$ So it cant be extended to a continuos function in $\Bbb R$.