Investigating continuity of a function defined differently on the rationals and irrationals For a function defined as follows:
$f(x) =
\begin{cases}
1  & \text{if $x$ is rational} \\
e^x & \text{if $x$ is irrational}  \\
\end{cases}$
How does one figure out the points at which f is continuous? Is there some kind of heuristic to figuring this out intuitively?
To be honest I was a little taken aback by the definition of the function. Naively I thought the function is likely continuous at $0$ since that's when the $e^x$ and $1$ become equal. Are there any other points?
 A: Let $a$ be any real number. There is always a sequence $\langle q_n:n\in\Bbb N\rangle$ of rational numbers converging to $a$, and along this sequence you have $\langle f(q_n):n\in\Bbb N\rangle\to 1$, since all of the $f(q_n)$ are equal to $1$. There is also always a sequence $\langle x_n:n\in\Bbb N\rangle$ of irrational numbers converging to $a$, and along this sequence you have $\langle f(x_n):n\in\Bbb N\rangle=\langle e^{x_n}:n\in\Bbb N\rangle\to e^a$. In order for $f$ to be continuous at $a$, these two limits must be the same. What does that tell you about $a$?
A: The two functions $f_1(x)= 1$ and $f_2(x)=e^x$ for themselves would be continuous. Then the function obtained by "mixing" them like in this problem is continuous exactly at those points $x$ where $f_1(x)=f_2(x)$ holds.
To see this, consider $x_0$ with $f_1(x_0)\ne f_2(x_0)$. Let $\epsilon = \frac12 |f_1(x_0)-f_2(x_0)|$. If $x_0$ is rational, you find irrational points $x$ arbitrarily close to $x_0$ such that $|f_2(x)-f_2(x_0)|<\epsilon$, hence $|f(x)-f(x_0)|=|f_2(x)-f_1(x_0)|\ge |f_2(x_0)-f_1(x_0)|-|f_2(x)-f_2(x_0)|=\epsilon$, i.e. $f$ is not continuous at $x_0$. The sam works with rational and irrational interchanged if $x_0$ is irrational.
On the other hand, if $f_1(x_0)=f_2(x_0)$, then for any $\epsilon>0$ there exists $\delta_1>0$ with $|f_1(x)-f_1(x_0)|<\epsilon$ if $|x-x_0|<\delta_1$ and $\delta_2>0$ with $|f_2(x)-f_2(x_0)|<\epsilon$ if $|x-x_0|<\delta_2$. Then with $\delta:=\min\{\delta_1,\delta_2\}$ we have $|f(x)-f(x_0)|<\epsilon$ if $|x-x_0|<\delta$.
