How to show that $f$ is differentiable at $x=0.$ $f:\mathbb{R} \to  \mathbb{R}$ be defined as  $f(x)$= $x^2 , x \in \mathbb{Q} \\ 0 \ \ , x \in \mathbb{Q^c}\\ $
How to show that $f$ is differentiable at $x=0.$
I want to try this approach.
here  $f'(x)=$ $2x  \in \mathbb{Q}  \\
 0  \in \mathbb{Q^c} $
since $lt \\ x \to 0+$$f(x)$ = $lt \\ x \to 0-$$f(x)= 0$ 
so $f$ is differentiable at $x=0$
 A: You can't just apply the derivative rules unless you check differentiability. In fact in this case the function is only continuous at $x=0$ so this function could only be differentiable at $x=0$ if it is anywhere differentiable. We check if it is as follows.
We wish to find $\lim_{h\to0}\frac{f(0+h)-f(0)}{h}=\lim_{h\to0}\frac{f(h)}{h}$.
If $h\in\mathbb{Q}$ then we get $\frac{f(h)}{h}=\frac{h^{2}}{h}=h$.
If $h\in\mathbb{Q}^{c}$ then we get $\frac{f(h)}{h}=0$.
By choosing $|h|<\epsilon$ and looking at the above we have that $|\frac{f(h)}{h}-0|=|\frac{f(h)}{h}|\le|h|<\epsilon$.
Thus the derivative exists and is $0$ at $x=0$.
A: If it is a homework, please specify it in the tags and state what you have tried. As a first observation and as Daniel Fischer and Thomas Andrews pointed out in the comments, the way your question is phrased, it is false: continuously differentiable at a point $x_0$ means differentiable on a neighborhood of that point, with the derivative being continuous on this neighborhood. In your case, $f$ is only differentiable (and even continuous) at $0$, and nowhere else.
Assuming you meant "continuous and differentiable at $0$":


*

*for the continuity, show that for any $\epsilon > 0$, there exists a $\delta > 0$ (here, try $\delta = \sqrt\epsilon$, for instance) such that $|x-0| \leq \delta\Rightarrow |f(x)-f(0)| \leq \epsilon$ (a distinction of two cases will do the trick).

*For differentiability, same thing ; use the definition of differentiability at a point.
PS: you also might want to have a look at this question.

Edit: regarding your approach; you're not allowed to write "$f'(x)=2x$ for $x\in\mathbb Q$"; $f$ is not continuous at any point except $0$, a fortiori it is not differentiable and its derivative is not defined.
