# function is not differentiable on $\mathbb R\setminus\{0\}$

I need to prove that the given function $f$ is not differentiable on $\mathbb R \setminus\{0\}$.

$$f(x) = \begin{cases} x^2, \ x \in \mathbb{Q}\\ 0, \ x \in \mathbb{R}-\mathbb{Q} \end{cases}$$ Can anyone tell me for $c\in\mathbb R \setminus \{0\}$ my work is correct or not and also if you have any different way to this question comment them please thanks

Suppose $c\in\mathbb R \setminus \{0\}$ be arbitrary

CASE 1 $c\in\mathbb R \setminus \mathbb Q$. Let $\varepsilon = c^2>0$

Let $δ>0$ be arbitrary

Suppose $|x-c|<δ$

If $c > 0$ choose $x'\in(c,c+\delta) \cap \mathbb R \setminus\mathbb Q$.

If $c < 0$ choose $x'\in(c-\delta,c) \cap \mathbb R \setminus\mathbb Q$.

Since $|f(x')-f(c)|=|x'^2-0^2 |=|x'^2-0^2 |>c^2=ε$. $f$ is not continuous at $0$ hence $f$ is not differentiable at $\mathbb R \setminus\mathbb Q$.

• In your last sentence, I think you mean "$f$ is not continuous at $c$" (indeed, $f$ is continuous at $0$). Also, don't you want to choose $x' \in \mathbb Q$? Also, what about case 2, $c \in \mathbb Q \setminus \{0\}$? – Bungo Jun 23 '16 at 19:07
• yes, but that can be done more easily – sumudu madushan Jun 23 '16 at 19:11
• Well, case 1 will be correct if you choose $x' \in \mathbb Q$ instead of $x' \in \mathbb R \setminus \mathbb Q$, and fix the typo "$f$ is not continuous at $0$". – Bungo Jun 23 '16 at 19:17

The function is clearly not differentiable at any point $x$ with $x\ne0$, because we can find two sequences, $(a_n)$ in $\mathbb{Q}$ and $(b_n)$ in $\mathbb{R}\setminus\mathbb{Q}$ so that $$\lim_{n\to\infty}a_n=x=\lim_{n\to\infty}b_n$$ and $$\lim_{n\to\infty}f(a_n)=\lim_{n\to\infty}a_n^2=x^2, \qquad \lim_{n\to\infty}f(b_n)=0$$ so $f$ is not continuous at $x$. A function differentiable at $x$ is continuous at $x$.
So the only possibility is differentiability at $0$. Now $$\lim_{x\to0}\frac{f(x)-f(0)}{x-0}=0$$ because, for $x\ne0$, $$-|x|\le \frac{f(x)}{x}\le |x|$$ and the squeeze theorem applies.