Continuity On $\mathbb{Q}$ 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?
 A: 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$).
A: 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?
A: 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$.
