I need a continuous function $f:\mathbb{Q}\rightarrow \mathbb{R}$ and discontinuous $g:\mathbb{R}\rightarrow \mathbb{R}$ s.t $f(x)=g(x)$ for all rational $x$ s. So if I say $f(x)=0$ and $g(x)=0$ for $x \in \mathbb{R}\setminus\{\sqrt2\}$ and $g(x)=1$ at $x=\sqrt 2$ .would I be right?
-
yes,you are right – Nasibabuba Nov 03 '12 at 16:52
3 Answers
Yes, that will work.
More interesting examples would be
$$ g(x) =\begin{cases} 1 & x\ge \sqrt 2 \\ 0 & x < \sqrt 2\end{cases} $$
or
$$ g(x) = \begin{cases} 1 & x\notin\mathbb Q \\ 0 & x \in \mathbb Q \end{cases} $$
with $f$ in each case being the restriction of $g$ to $\mathbb Q$.
(Note, incidentally, the the first of these examples gives an example of a continuous function $\mathbb Q\to\mathbb R$ that cannot be extended to a continuous function $\mathbb R\to\mathbb R$).

- 286,031
-
3@Pilot: What do you think is wrong about the second example (which is one minus the Dirichlet function)? The restriction of $g$ to $\mathbb Q$ is everywhere zero, which is perfectly continous, but $g$ itself is discontinuous everywhere. – hmakholm left over Monica Nov 03 '12 at 17:00
-
-
1I don't see how the $f$ associated with the $g$ you provide in your first example can be continuous. I can take an $\varepsilon$ as small as I want such as $x_1 = \sqrt{2}-\varepsilon$ and $x_2=\sqrt{2}+\varepsilon$ are rational, and I will have $f(x_1)=0$ and $f(x_2)=1$, which will show that $f$ is not continuous. Am I missing something? – S4M Nov 04 '12 at 00:25
-
-
2@S4M: When we say that $f:\mathbb Q\to\mathbb R$ is "continuous" we mean that it is continuous at every point in its domain. Since the domain is $\mathbb Q$, it is (more than) enough that you can take any $a\in\mathbb Q$ and find an $\delta$ such that $f$ is constant between $a-\delta$ and $a+\delta$ -- and you can always find such a $\delta$ just by choosing it less than $|a-\sqrt2|$. We know that $a\ne\sqrt2$ because by assumption $a$ must be something in the domain of $f$. – hmakholm left over Monica Nov 04 '12 at 02:35
-
(This is not different in principle from the fact that $x\mapsto 1/x$ is continuous on $\mathbb R\setminus {0}$ -- we can't take $a=0$ because $0$ is not in the domain of the function). – hmakholm left over Monica Nov 04 '12 at 02:36
-
1@Pilot: When I say that $f$ is zero everywhere, I mean that it $f(x)=0$ for every $x$ in the domain of $f$. By your own initial requirement, the domain of $f$ is to be $\mathbb Q$, so "everywhere" means everywhere on $\mathbb Q$. – hmakholm left over Monica Nov 04 '12 at 02:37
-
@HenningMakholm thanks for the clarification! Your analogy with the function $1/x$ helped me to get it. – S4M Nov 04 '12 at 14:54
You're right. But if that wasn't obvious to you, then a more interesting question is: why are you right? Can you prove it from the definition of continuity?

- 223
- 1
- 11
-
-
1$f$ is constant function thus it is continuous. We ll show that g is discontinuous on R if we show that it is discont.at one point of R: it is easy to see it's discontinuity at $\sqrt2$ if we consider $\epsilon=1/2$ neighborhood of it,then $(1/2,3/2)$ doesnt contain $0$,which is image of $g$ at all other points of R,so there is no $\delta$ neighborhood of $\sqrt2$ which could be mapped to above considered $\epsilon$ neighborhood. – Nasibabuba Nov 04 '12 at 00:56
-
Yup. Continuity is a topological property, so there's also a topological definition of continuity based on open sets that is equivalent to the $\delta$-$\epsilon$ definition you use, but applies to non-metrizable spaces. Basically: for $f:X\rightarrow Y$, $U\subseteq Y$ is open $\Rightarrow f^{-1}(U)$ is open. – Mike Nov 04 '12 at 01:12
This answer is unsalvageable wrong, I leave it so others could learn from my mistakes
Given $f : \mathbb Q \to \mathbb R$ we can extend it to a continuous function $\bar f : \mathbb R \to \mathbb R$ in the following way:
For every irrational $x$ having Cauchy sequence $(x_a)$ define $$\bar f(x) = (f(x_a)),$$ by continuity this is a Cauchy sequence hence a well defined real number. this is wrong you can not extend a continuous function $\mathbb Q \to \mathbb R$ to a continuous function $\mathbb R \to \mathbb R$, there is a counterexample above
In general metric spaces let $f : V \to X$ be a continuous function and $U$ a dense subset of $V$, then $f$ is defined by its restriction $f|_U : U \to X$. [For proof use the sequential definition of continuity]
That tells us that $\bar f$ is the unique continuous extension of $f$, so if $g : \mathbb R \setminus \mathbb Q \to \mathbb R$ is any function then the extension $$f_g(x) = \begin{cases} f(x), & x \in \mathbb Q \\ g(x), & x \not\in \mathbb Q \end{cases}$$ is discontinuous at $x \in \mathbb Q$ if there's a sequence $x_n \to x$ such that $g(x_n) \not \to f(x)$.
For example if we take $g(x) = \bar f(x) + 1$ then $f_g$ is discontinuous everywhere. If we take $g(x) = \bar f(x) + x$ then $f_g$ is discontinuous everywhere except $0$.

- 2,219