Show $f(x)=\sin\frac1x$ is discontinuous on $\Bbb R$ using open balls Suppose we have the function $f:\Bbb R\to\Bbb R$, where $f(x)=\sin\frac1x$ for any $x\ne0$ and $f(x)=0$ for $x=0$. Furthermore, suppose both the domain and codomain are metric spaces with the Euclidean metric.
I want to show $f$ is discontinuous by finding an open set $U\subset\Bbb R$ such that $f^{-1}(U)$ is not open.
I was thinking of taking an open ball centred at $0$, but any preimages seem to be open intervals of $\Bbb R$, which are open.
 A: As noted in the comments, you are not using the definition of continuity correctly. You want to find $U \subset \mathbb{R}$ (not $\mathbb{R}^2$) such that $f^{-1}(U)$ is not open.
I believe taking $U$ to be a small neighborhood of $0$ will work, since then $f^{-1}(U)$ will look like the union of many open intervals with the singleton set $\{0\}$, but no neighborhood of $0$ will lie in $f^{-1}(U)$.
A: f is not continuous at 0.  Proof:  f(0) = 0 in K = (-.1, .1).
For all open U nhood 0, f(U) = [-1,1].  Thus there cannot be
an open V nhood 0 with f(V) subset K;  so f is not continuous at 0.
A: Assume that $f$ is continuous.
The inverse image $U = f^{-1}\text{[ }(-1,+1)\text{ ]}$ must be open. Since $f(0) = 0$, $0 \in U$, and so $0$, being an interior point of $U$, can be surrounded by an open interval $(-\delta, +\delta)$ that gets mapped by $f$ into $(-1,+1)$. But you can choose an integer $k \gt 0$ so that $u = \frac{1}{\pi /2 + 2 \pi k} \lt +\delta$ and $f(u) = 1$.
This is a contradiction.
A: Take $U=(-0.5,0.5)$.
Then:
$$\begin{array}{rcl}
f^{-1}[U]
&=& \displaystyle \left\{x \in \Bbb R ~\middle|~ \sin\left(\frac1x\right) \in (-0.5,0.5)\right\} \cup \{0\} \\
&=& \displaystyle \left\{x \in \Bbb R ~\middle|~ \frac1x - n\pi \in \left(-\frac\pi6,\frac\pi6\right)\right\} \cup \{0\} \\
&=& \displaystyle \left\{x \in \Bbb R ~\middle|~ \frac1x \in \left(\frac{(6n-1)\pi}6,\frac{(6n+1)\pi}6\right)\right\} \cup \{0\} \\
&=& \displaystyle \bigcup_{n \in \Bbb Z\setminus\{0\}}\left(\frac6{(6n-1)\pi},\frac6{(6n+1)\pi}\right) \cup \left(-\infty,-\frac6\pi\right) \cup \left(\frac6\pi,\infty\right) \cup \{0\} \\
&=& \displaystyle \left(-\infty,-\frac6\pi\right) \cup \left(-\frac6{5\pi},-\frac6{7\pi}\right) \cup \left(-\frac6{11\pi},-\frac6{13\pi}\right) \cup \cdots \cup \{0\} \\ && \displaystyle \cup \cdots \cup \left(\frac6{13\pi},\frac6{11\pi}\right) \cup \left(\frac6{7\pi},\frac6{5\pi}\right) \cup \left(\frac6\pi,\infty\right)
\end{array}$$
For $f^{-1}[U]$ to be open, since $0 \in f^{-1}[U]$, we need to find an open ball around $0$ that is contained in $f^{-1}[U]$. We will show that no such ball exists.
We note that $f^{-1}[U]$ is missing reciprocals of half-integer multiples of $\pi$, i.e. $\dfrac1{\left(n+\frac12\right)\pi}$.
For let $\varepsilon > 0$ be a positive real number such that $(-\varepsilon,\varepsilon) \subseteq f^{-1}[U]$. We wish to find $n$ such that $0 < \dfrac1{\left(n+\frac12\right)\pi} < \varepsilon$, i.e. $\left(n+\dfrac12\right)\pi > \dfrac1\varepsilon$, i.e. $n+\dfrac12 > \dfrac1{\varepsilon\pi}$, i.e. $n > \dfrac1{\varepsilon\pi}-\dfrac12$. Take $n=\max\left(0,1+\left\lfloor\dfrac1{\varepsilon\pi}-\dfrac12\right\rfloor\right)$ does the job.
