Consider the function \begin{align*} h(x) = \begin{cases} x & \text{if } x \in \mathbb{Q} \\ 0 & \text{if } x \in \mathbb{R} \setminus \mathbb{Q}. \end{cases} \end{align*} Prove it is not continuous on $\mathbb{R} \setminus \{0\}$.
My working to show that it is not continuous on $\mathbb{R} \setminus \{0\}$ is as follows. However, I am wondering, how can I show it is continuous at $0$? Let $(z_n)$ be any sequence such that $(z_n) \rightarrow 0$, I need to show that $h(z_n) \rightarrow 0$. But how? It is certainly obvious, but I can't seem to formally provide an argument.
First, we show that the above function is not continuous at any real number different from $0$. Let $r \neq 0 \in \mathbb{Q}$, since the set of irrationals is dense in $\mathbb{R}$, then there exists a sequence $(x_n)$ contained in the irrationals such that $\lim_{n \rightarrow \infty} x_n = r$. Note that $h(x_n) = 0$ for all $n \in \mathbb{N}$ so $\lim_{n \rightarrow \infty} h(x_n) = 0$ while $h(r) = r \neq 0$. So $\lim_{n \rightarrow \infty} h(x_n) \neq h(r)$, which shows that $h(x)$ is not continuous at any $r \neq 0 \in \mathbb{Q}$.
Now let $i \neq 0 \in \mathbb{R} \setminus \mathbb{Q}$. Since $\mathbb{Q}$ is dense in $\mathbb{R}$, there exists a sequence $(y_n)$ contained in $\mathbb{Q}$ such that $\lim_{n \rightarrow \infty} y_n = i$. Note that $h(y_n) = y_n$ for all $n \in \mathbb{N}$. Therefore, $\lim_{n \rightarrow \infty} h(y_n) = i \neq 0$ while $h(i) = 0$. So, $\lim_{n \rightarrow \infty} h(y_n) \neq h(i)$, which implies that $h(x)$ is not continuous at any $i \neq 0 \in \mathbb{R} \setminus \mathbb{Q}$.