How to show that the following function is continuous: $$f(x) = \cases{x\sin\frac{1}{x}\quad x>0\\ 0\quad\quad \quad\,\,x\leq 0}$$
$f(x)$ is continuous at $x=a$ iff $$\forall \epsilon >0,\quad\exists\delta:|x-a|<\delta\implies|f(x)-f(a)|<\epsilon$$
I split it into $2$ cases, for $a\leq 0$:
Fix $\epsilon >0$. Then define $\delta:= \epsilon$. We then suppose $|x-a|<\delta$.
$|x-a|<\delta =\epsilon\implies |f(x)-f(a)|=|f(x)|=|x\sin\frac{1}{x}|\leq |x|\leq \epsilon -a<\epsilon$ as required.
For $a>0$, again I fix $\epsilon >0$, and define $\delta:=\epsilon$
Suppose $|x-a|<\delta=\epsilon$. Then we have $|f(x)-f(a)| = |x\sin\frac{1}{x}-a\sin\frac{1}{a}|$, and also $|x\sin\frac{1}{x}|\leq |x|$ (similar is true for $a$).
I'm not sure how to proceed here, I need to show that $|f(x)-f(a)|<\epsilon$. Could someone please offer some tips? Also in the highly possible event I've made some mistakes, feel free to ignore everything I've written when responding lol.