Proving $f(x)=\begin{cases}0&, x\in\mathbb Q\\x^2&,x\in\mathbb R\setminus\mathbb Q\end{cases}$ is differentiable only at $x=0$

you have $\dfrac{f(x)}{x}=0$ or $x$, depending on the rationality of $x$. Hence for all $x\neq 0$, we have $\vert \dfrac{f(x)}{x}\vert\leq \vert x\vert$. So the letf hand side goes to zero as $x$ goes to zero and you may conclude that $f$ is differentiable at $0$ and $f'(0)=0$.


There is no need to first study continuity.

You form two sequences converging to some $x_\infty$ by the irrationals and by the rationals.

We first assume $x_\infty$ irrational, and

$$\frac{f(x_n)-f(x_\infty)}{x_n-x_\infty}=\begin{cases}\dfrac{x_n^2-x_\infty^2}{x_n-x_\infty}\to2\,x_\infty&\text{ for }x_n\notin\mathbb Q\\\dfrac{-x_\infty^2}{x_n-x_\infty}\text{ d.n.e.}&\text{ for }x_n\in\mathbb Q.\end{cases}$$

Next, with $x_\infty$ nonzero rational,

$$\frac{f(x_n)-f(x_\infty)}{x_n-x_\infty}=\begin{cases}\dfrac{x_n^2}{x_n-x_\infty}\text{ d.n.e.}&\text{ for }x_n\notin\mathbb Q\\\dfrac{0}{x_n-x_\infty}\to0&\text{ for }x_n\in\mathbb Q.\end{cases}$$

Finally, with $x_\infty=0$,

$$\frac{f(x_n)-f(x_\infty)}{x_n-x_\infty}=\begin{cases}\dfrac{x_n^2}{x_n}\to0&\text{ for }x_n\notin\mathbb Q\\\dfrac{0}{x_n}\to0&\text{ for }x_n\in\mathbb Q.\end{cases}$$ and the derivative is $0$.


We have $$ \frac{f(x_n)}{x_n} = \frac{1}{x_n} \begin{cases} 0, & x_n \in \mathbb{Q} \\ x_n^2, & x_n \notin \mathbb{Q} \end{cases} = \begin{cases} 0, & x_n \in \mathbb{Q} \\ x_n, & x_n \notin \mathbb{Q} \end{cases} \overset{n \to \infty}{\longrightarrow} 0$$ as both terms converge to $0$.