Is this function differentiable at 0? I would like to know if this function is differentiable at the origin:
$$f(x) =
\left\{
 \begin{array}{cl}
  x+x^2  & \mbox{if } x \in \mathbb{Q}; \\
  x & \mbox{if } x \not\in \mathbb{Q}. \end{array}
\right.$$
Intuitively, I know it is, but I don't know how to prove it. 
Any ideas?
Thanks a lot.

For continuity at any arbitrary point $c\in\mathbb{R}$ and considering sequential criteria(first consider a rational sequence converging to $c$ and then a irrational sequence converging to $c$ and equate the limit) of continuity at $c$  you need $c^2+c=c$ so $c^2=0$ so $c=0$, so only at $c=0$ the function is continuos, Now consider the limit $\lim_{x\rightarrow 0}\frac{f(x)-f(0)}{x}$ take rational sequence $x_n\rightarrow 0$ and see what is the limit and take irrational sequence $x_n\rightarrow 0$ and see the limit, are they equal?
you need read this two topic first to understand the solution:Sequential Criterion For Limit Sequential Criterion For Continuity Here you can look the Sequential criterion for Derivative
