# Rationals/Irrationals and Continuity

If you define $\displaystyle g: \mathbb{R} \rightarrow \mathbb{R}$ by $\displaystyle g(x) := 2x$ for $\displaystyle x$ rational, and $\displaystyle g(x) := x + 3$ for $\displaystyle x$ irrational, at what points is $\displaystyle g$ continuous?
If you define $\displaystyle g: \mathbb{R} \rightarrow \mathbb{R}$ by $\displaystyle g(x) := 2x$ for $\displaystyle x$ rational, and $\displaystyle g(x) := x + 3$ for $\displaystyle x$ irrational, at what points is $\displaystyle g$ continuous?
Think about it likes this. If $\displaystyle f$ is continuous and $\displaystyle x_n\to x$ then $\displaystyle f(x_n)\to f(x)$. So, let $\displaystyle x\in\mathbb{R}$ the since both the irrationals and rations are dense in the reals there exists sequences $\displaystyle \{q_n\}_{n\in\mathbb{N}},\{i_n\}_{n\in\mathbb{N}}$ such that $\displaystyle q_n\to x,i_n\to x$. Thus, we must have that $\displaystyle f(x)=\lim\text{ }f(q_n)=\lim\text{ }2q_n=2\lim\text{ }q_n=2x$ and $\displaystyle f(x)=\lim\text{ }f(i_n)=\lim\text{ }\left\{i_n+3\right\}=\lim\text{ }i_n+3=x+3$. In particular, $\displaystyle 2x=x+3\implies x=3$. Thus, that is the only point of continuity.