How to prove differentiability and continuity for piecewise function Given the following piecewise function: $f(x)$
\begin{cases} 
      x \sin x & x\ \in \mathbb Q \\
      0 & x \in \mathbb {R/Q} 
   \end{cases}
Prove/Disprove:
a) $f(x)$ is continuous
b) $f(x)$ is differentiable
I am having trouble using the Epsilon-Delta definition given that there is always an irrational number between rational numbers, so I'm assumung that I need to construct a sequence that converges to an x $\in \mathbb {Q}$ but these sequences  $(x_{n})_n$ could also theoretically be $\in \mathbb {R/Q}$?
 A: It's worth doing some investigating before throwing ourselves at the problem.
Pick a point $c \in \mathbb{R}$. Then either $c \in \mathbb{Q}$ or $c \in \mathbb{R}\setminus\mathbb{Q}$. We can start by looking at $c \in \mathbb{Q}$. 
Suppose that $c \in \mathbb{Q}$. Let $(x_n)_{n \in\mathbb{N}}$ be the sequence with $x_n \in \left(c, c+\frac{1}{n}\right)\cap (\mathbb{R} \setminus\mathbb{Q}) $. Then $\lim x_n = c$ but $f(x_n) = 0$. So unless $c=0$, there is no way the function could be continuous there.
For $c=0$, the function is actually continuous! You can show this using $\epsilon-\delta$.
Now we can start looking at irrational points. Let $r\in\mathbb{R} \setminus\mathbb{Q}$. Obviously, unless we have $r\sin(r)=0$, the function has no chance of being continuous. The points where this happens are the $r = n\pi$, where $n\in\mathbb{Z}$. Again, the function is continuous at these points, I will let you think about why . 
At $c=0$, the function is differentiable. You can show this using the linear approximation definition of differentiability: put $$R(h) = \begin{cases} 0,\quad \quad x \in \mathbb{R}\setminus\mathbb{Q} \\ \sin(x),\quad x \in\mathbb{Q}\end{cases} $$
Then $R(h) \to 0 $ as $h\to0$. Furthermore $$f(h) = f(0) + 0h + R(h)h$$
So the derivative of $f(x)$ at $0$ is $0$.
Now at points $c\ne0$ where the function is continuous, the function is not differentiable (thanks @Henning Makholm). You can see this by taking two sequences that tend to that those points, one of rational numbers and of irrational numbers, and see that $\lim_{n \to \infty} \frac{f(x_n) - f(c)}{x_n-c}$ is different for both sequences, hence the limit does not exist. 
A: This function is discontinuous. For instance, take a sequence $(q_n)_{n\in\mathbb N}$ of irrational numbers such that $\lim_{n\in\mathbb N}q_n=1$. Then$$\lim_{n\in\mathbb N}f(q_n)=0\text{ and }f\left(\lim_{n\in\mathbb N}q_n\right)=\sin(1)\neq0.$$Since it is discontinuous, it is not differentiable.
