Show that function is differentiable but its derivative is discontinuous. 
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.
 A: 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$.
A: First a stylistic comment: you should use the word "differentiable" in place of "derivable." Second: you should show that $f$ is well-defined on $[0,1]$ so that you can take its derivative (this is easy). We want to consider the difference quotient $\frac{f(x)-f(y)}{x-y}$ and what happens as $x\rightarrow y$ (I will leave it to you to argue why you can interchange sum and limit.. Weierstrass M-test and uniform convergence are your friends). I'll help out with part of the solution.
So we want to evaluate the limit of the difference quotient. To do so, we consider two cases: when $y$ is irrational and when $y$ is rational.
Case 1: $y$ is irrational.
What we have is 
$$\lim_{x\rightarrow y}\frac{f(x)-f(y)}{x-y} = \sum_{n=0}^{\infty}\frac{1}{n^2}\lim_{x\rightarrow y}\frac{g(x-r_n)-g(y-r_n)}{x-y}.$$
The important part here is the limit, so I'll focus on that. The limit looks eerily close to a difference quotient (and after a clever introduction of $0$, we see that it is):
$$\lim_{x\rightarrow y}\frac{g(x-r_n)-g(y-r_n)}{x-y} = \lim_{x\rightarrow y}\frac{g(x-r_n)-g(y-r_n)}{(x-r_n)-(y-r_n)}.$$
This is just the derivative of $g$ evaluated at $y-r_n$! Which is equal to $2(y-r_n)\sin\left(\frac{1}{y-r_n}\right)-\cos\left(\frac{1}{y-r_n}\right)$. This is well-defined for all $r_n$ since $y$ is irrational. Since this function is bounded for all $r_n$ and $y$ by the value of $4$, the series converges and so $f'(y)$ is well-defined if $y$ is irrational.
Case 2: $y$ is rational.
If $y$ is a rational in $[0,1]$, then $y=r_k$ for some $k$. Then our difference quotient is
$$\lim_{x\rightarrow r_k}\frac{f(x)-f(r_k)}{x-r_k} = \lim_{x\rightarrow r_k}\left(\frac{1}{k^2}\frac{g(x-r_k)-g(r_k-r_k)}{x-r_k}+\sum_{n\neq k}\frac{1}{n^2}\frac{g(x-r_n)-g(r_k-r_n)}{x-r_k}\right).$$
We could not haphazardly apply the trick from above in this case because we required that $y$ be irrational above (else the denominator in the trigonometric functions will be ill-defined) which is why we split off the term in the series corresponding to $y$ in this case. Notice that the remainder of the series is now susceptible to the trick we did above and the term we pulled out is easy to handle. This gives us:
$$\lim_{x\rightarrow r_k} \frac{f(x)-f(r_k)}{x-r_k} = \lim_{x\rightarrow r_k}\left(\frac{1}{k^2}\frac{g(x-r_k)}{x-r_k} + \sum_{n\neq k}\frac{1}{n^2}\frac{g(x-r_n)-g(r_k-r_n)}{(x-r_n)-(r_k-r_n)}\right).$$
The first part is simply $\frac{1}{k^2}g'(0)$ and the second part is exactly like above.
Do you see how this is also well-defined making $f'$ differentiable everywhere? Can you take it from here?
