2
$\begingroup$

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?

  • 0
    yes,you are right2012-11-03

3 Answers 3

7

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

  • 0
    @HenningMakholm thanks for the clarification! Your analogy with the function $1/x$ helped me to get it.2012-11-04
1

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?

  • 0
    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.2012-11-04
-1

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