differentaibility of a piecewise continuous function For each $n\in \mathbb{N}$ let 
$$
f_n =
\begin{cases}
x^{n+1},  & x \in \mathbb{Q} \cap (-1,1),  \\
x^{2n}, & x \in \mathbb{Q}^c\cap(-1,1).   \\
\end{cases}$$
Prove that for each $n\in \mathbb{N}$ that $f_n$ is differentiable at $0$.
 A: For $n=0$ your function is discontinuous hence not differentiable. So assume that your natural numbers start at zero. Then we conclude $|f_n(x)|\leq x^2$ for every $x\in (-1,1)$.
Then use the following result:
Let $g:(-1,1)\to \mathbb{R}$ be such that $|g(x)|\leq x^2$. Then $g$ is differentiable at $0$ with $g'(0)=0$.
Proof. Consider the difference quotients
$$ | \frac{g(x)-g(0)}{x-0}| \leq \frac{x^2}{|x|} \leq |x| \to 0 $$
Hence $g'(0)=0$. In particular $g$ is differentiable at $0$.
A: Since both functions defining $f_n$ are differentiable in $0$ with the same derivative (namely $0$), the resulting function is differentiable in $0$ with derivative $0$.
In fact
$$
  f'_n(x_0) = \lim_{x\to x_0} \text{something}
$$
and if you define a function by cases, like, 
$$
  f(x) = \begin{cases} f_1(x) \quad\text{if $x\in A$}\\
     f_2(x) \quad\text{if $x\not\in A$} \end{cases}
$$
and if $f_1$ and $f_2$ have the same limit $\ell$ in $x_0$, then $f$ has limit $\ell$ in $x_0$ (directly by the definition of limit).
