Real Analysis – Prove differentiability of the function $f(x)=\begin{cases}\sin x & \text{if $x$ is rational} \\ x & \text{if $x$ is irrational}\end{cases}$ at $x=0$

proof-verificationreal-analysis

This is the function:
$$ f(x)=\begin{cases}\sin x& \text{if $x$ is rational}\\x &\text{if $x$ is irrational}\end{cases} $$

My attempt:
It is continuous at $x=0$ which is easily verified using the sequential definition of continuity.

I claim that $f$ is differentiable at $x=0$ and $f'(0)=1$.
Proof of claim:
Let $\varepsilon >0$ be given. Since $\lim_{x \to 0 } \frac{\sin x}{x} = 1$, there exists a $\delta > 0$ such that if $0<|x| < \delta $ then we have $\left| \frac{\sin x}{x} -1 \right| < \varepsilon $. Using the same $\delta$, we will show that $\lim_{x \to 0} \frac{f(x)-f(0)}{x-0} =1$. Now if $x\in \mathbb{Q}$ and $0<|x|<\delta$, then we have $\left| \frac{f(x)-f(0)}{x-0} – 1 \right| = \left| \frac{\sin x}{x} – 1 \right| < \varepsilon$ and if $x\in \mathbb{R}\setminus \mathbb{Q}$ and $0<|x|<\delta$, then we have $\left| \frac{f(x)-f(0)}{x-0} – 1 \right| = 0 < \varepsilon $ and we are done.

Is this proof okay? Alternative ways to do it?

Best Answer

Your proof is correct. But you also asked for alternative approaches. Here is one.

Define $g$ by $g(x)=x$. Then $f-g$ is $O(x^2)$ as $x\to 0$ (because $\sin x=x+O(x^2)$ as $x\to0$).

Therefore $f-g$ is differentiable at $x=0$ with $(f-g)’(0)=0$.

But $f=g+(f-g)$, and the sum of two functions differentiable at a point is also differentiable at that point. We conclude

$$f’(0)=g’(0)+(f-g)’(0)=1+0=1$$


Intuitively, the point is that your function is sufficiently “close” to a differentiable function as $x\to0$ for it to be differentiable, too.

Related Question