$ f(x)=\begin{cases} 0 & \text{if $x$ is irrat. } \\ \sin |x| &\text{if $x$ is rat. }\end{cases} $, Show $ \lim_{x \to x_0 }f(x) =0 $ by Heine def. Problem:
$ f(x)=\begin{cases} 0  & \text{if $x$ is irrational}
\\ \sin |x|  &\text{if $x$ is rational}\end{cases} $
Let $ x_0 \in \{ \pi n : n \in \Bbb Z \} $. Show that $ \lim_{x \to x_0 }f(x) $ exists or not, if it exists, find it.
Attempt: Let $ \epsilon > 0$ be arbitrary.  Since we know that $ \sin |x|  $ is continuous then there exists $ \delta >0 $. Let $ x \in \Bbb R $ be arbitrary. Suppose $ | x- x_0 | < \delta $. Then we know $ | \sin|x| | <\epsilon $ ( since $ \lim_{x \to 0 } \sin |x| = 0 $  ). Now,
If x is irrational, $ f(x) = 0  $ and so $ |f(x)| = 0 < \epsilon $.
If x is rational,$f(x) = \sin|x| $ and so $ |f(x)| = |\sin |x| | < \epsilon $.
Since $ \epsilon>0, x \in \Bbb R  $ were arbitrary, we showed that $ \lim_{x \to x_0 }f(x) = 0 $. $ \square $
Question:  Initially I tried to solve the problem using Heine's definition of limit but I found it to be very difficult. How would one prove the limit above using Heine's definition?
 A: You can consider three cases. Let $x_1, x_2, \dots$ converge to $x_0$. We need to show that $f(x_1),f(x_2),\dots$ converges to zero (i.e. that it is a null sequence).
First suppose that the sequence of $x_j$ is eventually all irrational. Then, the sequence $f(x_j)$ is eventually all zero.
Second suppose that the sequence of $x_j$ is eventually all rational. Then, the sequence $f(x_j)$ is eventually $f(x_j) = \sin|x_j|$. So this goes to zero by the continuity of $x \mapsto \sin|x|$.
Lastly it may be that we have rationals and also irrationals appearing as $x_j$ infinitely often. Then we have finite streaks of zeros in the sequence $f(x_j)$. It is known in the basic theory of sequences that any sub-sequence of a convergent-to-$x_0$ sequence is also convergent-to-$x_0$. So those $x_j$ that are rational also converge to $x_0$. The corresponding sub-sequence of $f(x_j)$ thus is a null sequence, again by the continuity of $\sin|x|$. Lastly we apply (to the $f(x_j)$) the theorem that if any given sequence be partitioned into two sub-sequences, both of which are null, then the full sequence is also null.
That satisfies Heine's version. Your proof via Cauchy's definition looks okay; there are maybe some improvements possible to the phrasing.
https://en.wikipedia.org/wiki/Limit_of_a_function#In_terms_of_sequences
A: First note that $|f(x+n\pi)| = |f(x)|$ so we can assume without loss of generality that $x_{0}=0$
Let $\varepsilon>0$. We need to find $\delta>0$ such that $|x|<\delta \implies |f(x)|<\varepsilon$
Well $|f(x)|\leq|\sin(|x|)|\leq|x|$
So taking $ \delta = \varepsilon $ gives the result
