Oscillation of a map in metric spaces and continuity Context:
Let M, N be metric spaces. The 'oscillation' of $ f : M\rightarrow N $ at $ a\in M $ is the real number $ w(f;a) $ given by $ ( \inf(\operatorname{diam}(f(X_{r})): r>0\ ) $
where $ X_{r} =B(a;r) $.
Problem:
(a) Show that $ f $ is continuous at $a$ iff $ w(f;a)=0 $
(b) Calculate the 'oscillation' of $ f: \mathbb{R}\rightarrow \mathbb{R} $ at $ 0 $, given that $ f(x)= \sin(1/x) $ $ x\neq 0 $ if and $ f(0)= 0 $ otherwise.  
This is from the book Espaços Métricos by Elon Lima. I've never taken an Analysis course, so working through this book is somewhat hard for me.
 A: $\newcommand{\diam}{\operatorname{diam}}$(a)
Suppose $f$ is continuous at $a$.
By definition this means that for any $\varepsilon>0$ there exists $\delta>0$ such that for any $x\in M$, we have
$$
d_M(a,x) < \delta \implies d_N(f(a),f(x)) < \varepsilon/2.
$$
Rewriting this a bit differently, it is equivalent to the statement that for any $\varepsilon>0$ there exists $\delta>0$ such that $f(B_M(a;\delta))\subseteq B_N(f(a);\varepsilon/2)$.
Hence for any $\varepsilon>0$, by choosing $\delta>0$ as above, we obtain
$$
\omega(f;a)
= \inf_{r>0}(\diam(f(B_M(a;r))))
\le \diam(f(B_M(a;\delta)))
\le \diam(B_N(f(a);\varepsilon/2))
= \varepsilon.
$$
Since $\omega(f,a)\le\varepsilon$ for every $\varepsilon>0$, we conclude $\omega(f,a)=0$.
Conversely suppose $\omega(f,a)=0$.
We argue $f$ is continuous at $a$.
Let $\varepsilon>0$.
Since $\omega(f,a)=0$, there exists $\delta>0$ such that $\diam(f(B_M(a;\delta)))<\varepsilon$.
This means $f(B_M(a;\delta))\subseteq B_N(f(a);\varepsilon)$.
Indeed, if $x\in B_M(a;\delta)$, then we have $f(a),f(x)\in f(B_M(a;\delta))$ so that
$$
d_N(f(a),f(x)) \le \diam(f(B_M(a;\delta))) < \varepsilon
$$
and hence $f(x)\in B_N(f(a);\varepsilon)$.
We have shown that for every $\varepsilon>0$ there exists $\delta>0$ satisfying $f(B_M(a;\delta))\subseteq B_N(f(a);\varepsilon)$.
Therefore $f$ is continuous at $a$.
(b) Do you mean $\sin(1/x)$ in place of $sen(1/x)$? If that's the case, note that the image under $f$ of every ball around $0$ is equal to $[-1,1]$. Consequently the oscillation is $2$.
