# Proof check , Derivability piecewise function

## Question : Check derivability at point x=0 $$f(x) = \begin{cases} x & \text{if x \in Q} \\ \sin x & \text{if x \notin Q} \end{cases}$$

Here's my solution:

if $x \in Q$ $$\underset{x\to 0 }{\mathop{\lim }} \frac{f(x)-f(0)}{x-0}=\underset{x\to 0 }{\mathop{\lim }} \frac{x-0}{x-0}=1$$

if $x \notin Q$ $$\underset{x\to 0 }{\mathop{\lim }} \frac{f(x)-f(0)}{x-0}=\underset{x\to 0 }{\mathop{\lim }} \frac{\sin x}{x}=1$$

we conclude that $f'(0) = 1.$

Why do sometime we need to check the continuity at $0$ first before proving that is derivable at $0$?

• Presumably, your "$x$" here is actually supposed to be a sequence $x_n$. Is that what you meant to write? – Omnomnomnom Aug 2 '16 at 19:09
• no... I guess I make a mistake – Elina Aug 2 '16 at 19:12
• So, if $x$ is just real number, then what is the role of $n$ here? – Omnomnomnom Aug 2 '16 at 19:13
• 'Why do sometime we need to check the continuity at 0 first before proving that is derivable at 0?' Differentiability implies continuity. Therefore, if function is discontinuous at 0, we can conclude that it is not differentiable at 0. – alans Aug 2 '16 at 19:15
• Did you mean to say as $x$ tends to 0 maybe? $x$ tending to infinity doesn't seem right here and you still have $n$ in your post – m1cky22 Aug 2 '16 at 19:17

Note that (by definition) the derivative of this function is given by $$f'(0) = \lim_{x \to 0} \frac{f(x) - f(0)}{x}$$ so to show that $f'(0) = 1$, it suffices to show that for any sequence $x_n \to 0$, we have $$\lim_{n \to \infty} \frac{f(x_n) - f(0)}{x_n} = 1$$ What you can show with the steps you describe is that for any sequence $(x_n)_{n \in \Bbb N} \subset \Bbb Q$ or $(x_n)_{n \in \Bbb N} \subset (\Bbb R \setminus \Bbb Q)$, we have the desired equality. What you have failed to address, however, is the general case in which the sequence $(x_n)$ consists of both rational and irrational elements.
As for continuity: saying that $f$ is continuous at zero is equivalent to proving that $$\lim_{x \to 0} \;[f(x) - f(0)] = 0$$ that is, the limit of our limit's numerator is zero. This is a necessary condition for differentiability. That is, it is impossible for $f$ to be differentiable at $x = 0$ without also being continuous at $x = 0$. It is not clear to me, however, that proving continuity should necessarily be the first step of this proof.
• So if I understand correctly is that , i need to show 3 cases of derivability : $x\in Q$ , $x\notin Q$ and $x \in R$ ? To show the derivability of $x\in R$, I need to check the continuity at point 0 and then proove that the limit is 1 with the definition $\epsilon$ $\delta$ limit – Elina Aug 2 '16 at 19:33
• There's that notation again! What is $x\in Q$ supposed to mean? You could mean three possible things that could bear relevance to this question: 1: you could be referring to a sequence $(x_n) \subset \Bbb Q$. 2: you might be considering the restriction of $f$ to the domain of $\Bbb Q$. 3: you might be considering a net in $\Bbb Q$. I assumed you are really thinking about the first one, but maybe you meant the second. I highly doubt you mean the third. Could you please clarify what you are trying to say with $x \in \Bbb Q$? – Omnomnomnom Aug 2 '16 at 19:37
• Okay, well that makes a bit more sense now. In that case, yes: you have the right idea. The idea, when going through the $\epsilon$-$\delta$ proof, is to note that for a particular $\epsilon > 0$, there is a $\delta_1$ that works for the restriction of $f$ to $\Bbb Q$, and there is a $\delta_2$ that works for the restriction of $f$ to $\Bbb R \setminus \Bbb Q$. It suffices, for the purposes of the overall proof, to take $\delta = \min\{\delta_1,\delta_2\}$. The way I see it, it is not necessary to prove that $f$ is continuous at $0$, though. – Omnomnomnom Aug 2 '16 at 19:51