Let $f: \Bbb{R} \to \Bbb{R}$ be defined as $f(x)=x^2 \; \forall x \in \Bbb{Q}$ and $f(x)=0 \; \forall x \in \Bbb{R} \setminus \Bbb{Q}$. Show that $f$ is differentiable at $x=0$ and also find $f '(0)$
My attempt:
We will consider $$\lim_{x \to 0}\frac{f(x) - f(0)}{x-0}$$
consider,
$|\frac{f(x) - f(0)}{x-0} - 0| \leq |\frac{x^2 - 0}{x-0} - 0| = |x| \; \; \forall x \in \mathbb{R}$
now,
$\forall \epsilon >0 $ taking $\delta= \epsilon$
if $0<|x|< \delta$ $\Rightarrow |\frac{f(x) - f(0)}{x-0} - 0| \leq |x| < \epsilon $
Thus $\lim_{x \to 0}\frac{f(x) - f(0)}{x-0}$ exists and equals $0$
Hence derivative exists at $0$ and is equal to $0$
Is my proof correct ?
Yes, it is correct. It was a good idea when you concluded that $|f(x)|\le x^2$ so that you didn’t need to analyse separately the rational and the irrational case.