Which of these Attempted Proofs for Discontinuity is Correct and Why? Question:
Let $f$:$R$$\to R$  be defined by the formula $f(x) = sin(1/x)$ when $x$ is rational and $f(x) = 0$ when $x$ is irrational. Show that $f(x)$ is not continuous at $x = 0.$
Attempt 1:
Since $\lim_{x \to 0^+}sin(1/x)$ and $\lim_{x \to 0^-}sin(1/x)$ do not exist, then $f$ is discontinuous at $x = 0.$
Attempt 2:
For $\epsilon$ $= 1/2$, there exists no $\delta$ $>0$ such that $|f(x) - f(0)|$ $<$ $\epsilon$  whenever $|x|<$ $\delta$ because every neighbourhood of zero contains infinitely many irrationals. Hence, $f(x)$ is not continuous at $x = 0.$
Attempt 3:
We can find a sequence $x_{n}$ which converges to zero but $limf$$($$x_{n}$$)$ $\neq$ $f(0) = 0.$
What I think about Each of the Attempted Proofs
I think Attempt 3 is wrong since $f(0)$ does not exist in the first place. We can calculate $f(0)$ from the formula $f(x) = sin(1/x)$ since $x = 0$ here (and $0$ is rational). Since $1/x$ is not defined at $x = 0,$ then $sin(1/x)$ will not be defined at $x = 0$. This means $f(0)$ does not exist. So, the proof could have been something along this line: We know $f(0)$ is required to exist for a function $f$ to be continuous at $0$. We say $f$ is not continuous at $0$ since $f(0)$ does not exist. However, I still feel I am mixing things up here.
I am more confident about Attempt 1 than I am of Attempt 2. The later is an adapted solution from a similar question that investigates the discontinuity of $f$ at $x = 0,$ where $f(x) = 1$ when $x$ is rational and $0$ when $x$ is irrational. My doubt for Attempt 2 stems from my struggle to really understand the reason I gave:'...because every neighbourhood of zero contains infinitely many irrationals'. This reason is fairly common in solutions to problems of this type in the textbooks I have seen. What does this reason really mean? How does it support the argument in the proof? Does it mean whenever we consider the rationals in a neighbourhood of $0$, the irrationals interfere, and vice versa? Please help me understand what is going on here.
Please help me shed light on these solutions. Your help will be greatly appreciated.
Thanks.
 A: Your question is nonsensical since
$$f : \Bbb R \to \Bbb R \qquad x \mapsto \begin{cases}
\sin(1/x) & x \in \Bbb Q \\
0 & x \in \Bbb R \setminus \Bbb Q\end{cases}$$
is not even defined at zero (so really it's a function $f : \Bbb R \setminus \{0\} \to \Bbb R$). For continuity to hold we require that
$$\lim_{x \to 0} f(x) = f(0)$$
In particular then we cannot be continuous at a point outside of the domain of the function.

Ignoring this particular issue rendering all three attempts problematic (after all, you could just redefine $f(0)$ to be whatever you please, it won't matter in the end), I'd also note that:

*

*Attempt $\#1$: This works fine enough, though it would need some rigorization. You could take sequences of points $x_n \in \Bbb Q$ where $x_n \to 0$ from either side, and consider that $\sin(1/x_n)$ does not exist in the limit.


*Attempt $\#2$: The (other) issue is not that each neighborhood of $0$ has infinitely many irrationals, but infinitely many rationals, and in particular $\sin(1/x)$ achieves its extreme values of $\pm 1$ infinitely many times for $x$ in a neighborhood of zero. The irrationals give $0$ as a possible candidate for the limiting process.


*Attempt $\#3$: This attempt would be fine in theory ... but hard to manage in practice since the "obvious" candidates for such a sequence are the points where $\sin(1/x)$ achieves a maximum or minimum, but
$$\sin \frac 1 x = \pm 1 \implies x = \frac{1}{\pi} \cdot \frac{2}{4n \pm 1} , n \in \Bbb Z$$
and so these are not at rational points. Using $\sin(\pi/x)$ would nullify that of course, however.
