Continuity and Differentiation on open interval $$f(x) =
\begin{cases}
x\sin(1/x), & \text{if $x$ $\ne$ $0$} \\
0, & \text{if $x$ = $0$} \\
\end{cases}$$
Is $f$ continuous on $(-1/\pi$, 1/$\pi$)?
Is $f$ differentiable on $(-1/\pi$, 1/$\pi$)?
I know how to prove continuity on a single point, but I'm not sure how to prove continuity for a whole interval. Also, I know there is a theorem that states that if a function is differentiable at a point, then it's continuous.
 A: If we take as an example $X=[0,1]\cup[2,3]$, $f$ simply changing between these intervals ($f(x)=2+x$ for $x\in [0,1]$, $f(x)=x-2$ for $x\in[2,3]$.
This function is continuous (obviously), and it's range is $X$ (also obviously). 
Now, imagine we had a series $x_n$ such that $\lim_{n\to\infty}{(f(x_n)-x_n)}=0$. Since $f$ is continuous, $f-\rm{id}$ is also continuous, and since the domain of $f$ is closed, the range must also be. Thus we know that there would have to be an $x$ with $f(x)-x=0$, which is a contradiction to the first assumption that $f(x)\neq x\quad\forall x\in X$.
A: First of all, a good example of $f(x)$ that works for any union $X$ would be $f(x)= x+1$.
Now consider the values of $f(x)-x$ on the two endpoints of each interval.  For each interval these values must be non-zero (otherwise $f(x) = x$ on that endpoint).  By the intermediate value theorem they must have the same sign on the two endpoints of the interval. And in fact, $f(x)-x$ must be of that same sign throughout the interval, otherwise the IVT tells you that $f(x)-x = 0$ somewhere between the different-sign points.
So for each interval $I_n$ we have a function which is always positive (or always negative) and since this is a closed interval there is a minimum (or for the negative case, a maximum) value of $f(x)-x$ on $I_n$.  Note that the fact that the function is continuous on a closed interval is critical here; consider the function $g(x)=x + x^2$ on the open interval $(0,1)$ -- $g(x)-x$ has no minimum
on $(0,1)$.
So now taking the set of the absolute values of all those minima and maxima, we have a finite set of numbers, all of which are positive.  That set must have a positive minimum (now you know why we needed the word "finite" in the statement of the theorem).  And that minimum is the largest $\epsilon$ that works for the theorem.
