Showing Continuity and Differentiability for Sinusoidal Functions

Assume that $\sin\colon \mathbb{R} \rightarrow \mathbb{R}$ is continuous. Hint: consider using the Sandwich Lemma.

i) Show that the function $f(x) = \begin{cases} \text{sin}(\frac{1}{x}), & \text{if$x \ne 0$} \\ 0, & \text{if$x = 0$} \end{cases}$ is not continuous at $0$.

ii) Show that the function $f(x) = \begin{cases} x\text{sin}(\frac{1}{x}), & \text{if$x \ne 0$} \\ 0, & \text{if$x = 0$} \end{cases}$ is continuous everywhere, and not differentiable at $0$.

I'm having a bit of trouble proving these 2 problems using formal definitions. For i), I thought that if the limit at $a$ does not exist, then the function is not continuous at $a$, but after looking at some posts that does not seem to be the case. Does i) have something to do with the composition of continuous functions? If $f$ and $g$ are continuous at $0$, then $f(g)$ is also continuous at $0$. Since $g(x) = \frac{1}{x}$ is not continuous at $0$, does that necessarily mean $f(g)$ cannot be continuous at $0$ as well? It seems to make sense to me, but I can't really prove it (if it even is correct).

For ii), I'm completely lost. I don't see how that function is even continuous everywhere.

Any help or guidance on understanding these 2 problems would be greatly helpful. Thank you.

• In i), in order to have continuity at $x=0$ you should get $\lim_{x \to 0} \sin\left(\frac{1}{x} \right) = 0$. However, this limit does not exist. The second one is continuous because $-x \le x\sin\left(\frac{1}{x} \right) \le x$, so you can use the squeeze theorem at $x=0$. – Gibbs Apr 20 '18 at 7:22

i) Take $x_{n}=1/(2n\pi)$ and $y_{n}=1/(2n\pi+\pi/6)$ and try to see what happens for $\lim_{n\rightarrow\infty}f(x_{n})$ and $\lim_{n\rightarrow\infty}f(y_{n})$.
ii) We have $|x\sin(1/x)|\leq|x|$. On the other hand, $f(h)/h=\sin(1/h)$ which leads to the case i).