TITLE: Show that function is differentiable but its derivative is discontinuous.
QUESTION [6 upvotes]: Let $g(x)=x^2\sin(1/x)$, if $x \neq 0$ and $g(0)=0$. If $\{r_i\}$ is the numeration of all rational numbers in $[0,1]$, define
  $$
f(x)=\sum_{n=1}^\infty \frac{g(x-r_n)}{n^2}
$$
  Show that $f:[0,1] \rightarrow R$ is differentiable in each point over [0,1] but $f'(x)$ is discontinuous over each $r_n$. Is possible that the set of all discontinuous points of $f'$ is precisely $\{r_n\}$?

I'm not seeing how this function is working. I could not even derive it. I need to fix some $ n $ to work? And to see the discontinuity of $ f '(x) $ after that? Can anyone give me any tips? I am not knowing how to work with this exercise and do not know where to start.

REPLY [4 votes]: A standard result from analysis is: 
Let $I$ be a bounded interval of $\Bbb R$ and let $(f_n)$ be a sequence of  functions on $I$ to $\Bbb R$. Suppose there exists $x_0\in I$ such that $(f_n(x_0))$ converges, and that the sequence $(f_n')$ of derivatives exists on $I$ and converges uniformly on $I$ to a function $g$.
Then the sequence $(f_n)$ converges uniformly on $I$ to a function $f$ that has a derivative at every point of $I$ and $f'=g$.  (c.f. Bartle and Sherbert, Introduction to Real Analysis, Theorem 8.2.3)

On to your problem: 
The salient facts concerning $g$ are:
$\ \ \ $1) $g$ is indeed differentiable everywhere (use the definition of derivative  for $g'(0)$).
$\ \ \ $2) $g'$ is continuous at every $x\ne 0$.
$\ \ \ $3) $g'$ is not continuous at $x=0$, as it oscillates between $1$ and $-1$ as $x$ approaches $0$.
$\ \ \ $4) $g'$ is bounded.

Warning: a mostly complete solution follows.
You can apply the $M$-test to  the series $\sum\limits_{n=1}^\infty {g'(x-r_n)\over n^2}$ (use the fact that the family $g'(x-r_n)$ has a common bound) to show that the above result applies to your problem.  This will show $f$ is differentiable at every point in $[0,1]$ and that $f'(x)=\sum\limits_{n=1}^\infty {g'(x-r_n)\over n^2}$.
To show $f'$ is not continuous at any $r_n$, fix an $r_n$. Choose $N$ so that the tail $\sum\limits_{n=N}^\infty {g'(x-r_n)\over n^2}$ is uniformly small (less than $1/2^{n+1}$, say).
Break the sum for $f'$ into three parts: the small tail, the $n^{\rm th}$-term, and the rest.  Now use the fact that $g'(x-r_n)$ oscillates from $1$ to $-1$ about $r_n$ and that the $g'(x-r_i)$, $i=1,\ldots,n-1, n+1,\ldots, N$ are continuous at $r_n$ (note there is a $\delta>0$ so that $(r_n-\delta, r_n+\delta)$ excludes every $r_i$, $i=1,\ldots, n-1, n+1,\ldots N$) to show that $f'$ oscillates with positive amplitude about $r_n$.
For the last part, you may use the following result:
Let $(h_n)$ be a sequence of functions defined on an interval  $I$ that converges uniformly to a function $h$ on $I$ and let $x_0\in I$. If each $h_n$ is continuous at   $x_0$, then $h$ is also continuous at $x_0$.
So, here, if $\alpha\in[0,1]$ is irrational, then each $g_n(x)={g'(x-r_n)\over2^n}$ is continuous at $\alpha$.  It follows from the above then that  $f'$ is continuous at $\alpha$.