Why is $x \sin (\frac{1}{x})$ discontinuous at $x = 0$?
I know that $\sin(\frac{1}{x})$ diverges at $x = 0$ but $\sin(\frac{1}{x})$ is between $-1$ and $1$ so isn't $x \sin(\frac{1}{x})=0$ at $x=0$?
Why is $x \sin (\frac{1}{x})$ discontinuous at $x = 0$?
I know that $\sin(\frac{1}{x})$ diverges at $x = 0$ but $\sin(\frac{1}{x})$ is between $-1$ and $1$ so isn't $x \sin(\frac{1}{x})=0$ at $x=0$?
It is neither continuous nor discontinuous. It has something which is called a removable discontinuity.
Look carefully the function is not defined for $x=0$. So if you define it in this way:-
$$f(x)=\begin{cases} x\sin(\frac{1}{x}),\,x\neq 0\\ 0\,,x=0\end{cases}$$ is continuous at $x=0$.
However $$f(x)=\begin{cases} x\sin(\frac{1}{x}),\,x\neq 0\\ a\,,x=0\end{cases}$$ where $a\neq 0$ is not continuous.
If you are interested about differentiability then you can easily verify that it is not differentiable at $x=0$. as $\lim_{h\to 0}\frac{\sin(\frac{1}{h})}{h}$ does not exist.
For the function $f(x)=x\sin(\frac{1}{x})$ the problem is that it is not defined at $x=0$ but we can use your argument to show that
$$\lim_{x\to 0} x\sin\left(\frac{1}{x}\right)=0.$$ Thus the discontinuity at $x=0$ is a removable discontinuity and it arises due to $f(x)$ is not defined at $x=0$. If we define $$f(x)=\begin{cases} x\sin(\frac{1}{x}) & \text{ if } \hspace{4 pt} x\neq 0, \\ 0 & \text{ if } \hspace{4 pt} x= 0, \\ \end{cases}$$ then $f(x)$ is continuous at $x=0$.