We were asked to prove that on class. I thought I could use the composition of continuous functions and be done. There are no indefinitions anywhere. But my teacher defined a whole new function on $[0,1]$; for $x=0$ it's $0$, and for the rest, it's $x \sin \frac {1}{x}$. He proved it was continuous in zero with the limit, and then, since it's uniformly continuous it must be continuous in every sub interval, so since it is continuous in $(0,1)$, $x \sin \frac {1}{x}$ is continuous.
I don't understand why would he do such a long thing when it can be done by composition, unless there is something I am not seeing??
Thanks
By composition, you can show that $x \sin (\frac1x)$ is continuous on $(0,1)$, because you're combining continuous functions.
But $\frac1x$ is not uniformly continuous on $(0,1)$: as you get closer to $0$, the intervals for $x$ on which $\frac1x$ varies by at most $\epsilon$ get smaller and smaller. Therefore you can't hope to show that the result is uniformly continuous by composition alone.