Continuous at exactly two points and differentiable at exactly one of them Give an example of a function which is continuous at exactly two points and differentiable at exactly one of them. Justify your answer.
This question is from a competitive examination. I have of thinked a solution but I didn't get it
 A: Hint Let $\chi_{\Bbb Q}$ denote the indicator function of the set $\Bbb Q$ of rational numbers, that is
$$\chi_{\Bbb Q}(x)
:= \left\{\begin{array}{cl}1,& x \in \Bbb Q \\ 0, & x \not\in \Bbb Q\end{array}\right. .$$
Then, $|x \chi_{\Bbb Q}(x)| \leq |x|$ for all $x$. So, by the Squeeze Theorem,
$\lim_{x \to 0} |x \chi_{\Bbb Q}(x)| = 0 = x\chi_{\Bbb Q}(x)\vert_{x = 0}$, and thus by definition the function $$x \mapsto x \chi_{\Bbb Q}(x)$$ is continuous at $x = 0$. One can show with a little more effort that this is the only point at which it is continuous. On the other hand, the limit
$$\lim_{h \to 0} \frac{h \chi_{\Bbb Q}(h) - 0 \chi_{\Bbb Q}(0)}{h - 0} = \lim_{h \to 0} \chi_{\Bbb Q}(h)$$
does not exist, so by definition the function is not differentiable at $x = 0$.
Now, the function $$x \mapsto x^2 \chi_{\Bbb Q}(x)$$ is continuous at $x = 0$ (it is a product of functions continuous there) but again nowhere else, and applying the above squeezing argument to the limit of the difference quotient there shows that it is differentiable.
Can you build a function out of these two functions that satisfies the given conditions?
