Dini derivatives of Dirichlet function I'm hoping someone can verify my answers. I have that for $x\in\mathbb{Q}$ we have $$D^+f(x)=\limsup_{h\to 0^+}\frac{f(x+h)-f(x)}{h}=\limsup_{h\to 0^+}\frac{f(x+h)-1}{h}$$ and since $\mathbb{Q}$ is dense in $\mathbb{R}$, $(x+h)$ is rational as $h\to 0^+$ and we have $$D^+f(x)=\limsup_{h\to 0^+}\frac{1-1}{h}=0$$  Similarly for $D^-f(x)$ we have $$D^-f(x)=\limsup_{h\to 0^+}\frac{f(x)-f(x+h)}{h}=\limsup_{h\to 0^+}\frac{1-1}{h}=0$$And for $D_+f(x)$ $$D_+f(x)=\liminf_{h\to 0^+}\frac{f(x+h)-f(x)}{h}=\liminf_{h\to 0^+}\frac{0-1}{h}=-\infty$$ Finally for $D_-f(x)$ we have $$D_-f(x)=\liminf_{h\to 0^+}\frac{f(x)-f(x+h)}{h}=\liminf_{h\to 0^+}\frac{1-0}{h}=\infty$$ Now for $x\in\mathbb{R}\setminus\mathbb{Q}$ we have that $f(x)=0$ and we have $$D^+f(x)=\limsup_{h\to 0^+}\frac{1-0}{h}=\infty$$ $$D^-f(x)=\limsup_{h\to 0^+}\frac{0-1}{h}=-\infty$$ $$D_+f(x)=\liminf_{h\to 0^+}\frac{0-0}{h}=0$$ $$D_-f(x)=\liminf_{h\to 0^+}\frac{0-0}{h}=0$$ I am having trouble convincing myself of the effect (and proper explanation) of $\liminf$ vs $\limsup$ and their impact on the derivates. Is this correct? Could someone help me better conceptually understand what is going on?
Thanks
 A: First comment
Your definition for the various $D^+, D_+, \dots$ are not the right ones. For example $D^-f(x)=\limsup_{h\to 0^+}\frac{f(x)-f(x-h)}{h}$ and not $D^-f(x)=\limsup_{h\to 0^+}\frac{f(x)-f(x+h)}{h}$. See Dini derivatives for the correct definitions.
Second comment
You got some right results in term of values. However, the way you did it is not the best one and can lead you to wrong results when applied to others functions.
Let's take the example of $D^+f(x)$ when $x \in \mathbb Q$ where you wrote $$D^+f(x)=\limsup_{h\to 0^+}\frac{f(x+h)-f(x)}{h}=\limsup_{h\to 0^+}\frac{1-1}{h}.$$
This is not correct as $f(x+h)$ depends on whether $x+h$ is rational or not. What you should say is that for any $\epsilon \gt 0$, $\{f(x+h) \mid 0 \lt h \lt \epsilon\} = \{0,1\}$ and therefore
$$\left\{\frac{f(x+h)-f(x)}{h} \mid 0 \lt h \lt \epsilon\right\} = \{0,-1/h\}.$$
As for $h \gt 0$ we have $\sup \{0,-1/h\} = 0$, we can conclude that
$$D^+f(x)=\limsup_{h\to 0^+}\frac{f(x+h)-f(x)}{h}=0.$$
A: In order for $f$ to be differentiable at any $x\in\mathbb{R}$ we must have that $D^+=D^-=D_{-}=D_{+}$. Let's calculate our derivates. We must calculate separately for the cases when $x\in\mathbb{Q}$ and $x\in\mathbb{R}\setminus\mathbb{Q}$. Note that since $\mathbb{Q}$ is dense in $\mathbb{R}$ we can get arbitrarily close to zero and find a rational number.  Then for $x\in\mathbb{Q}$ we have $$D^+f(x)=\limsup_{h\to 0^+}\frac{f(x+h)-f(x)}{h}=\limsup_{h\to 0^+}\frac{f(x+h)-1}{h}$$ Now, note that $$\forall\varepsilon>0, \{f(x+h):0<h<\varepsilon\}=\{0,1\}$$ depending on whether or not $(x+h)$ is rational or not (the same can be said for $(x-h)$ in subsequent cases). and then $$\left\{\frac{f(x+h)-f(x)}{h}:0<h<\varepsilon\right\}=\{0,\frac{-1}{h}\}$$ and we have $$D^+f(x)=\limsup_{h\to 0^+}\{0,\frac{-1}{h}\}=0$$  Similarly for $D^-f(x)$ we have $$D^-f(x)=\limsup_{h\to 0^+}\frac{f(x)-f(x-h)}{h}=\limsup_{h\to 0^+}\{\frac{1}{h},0\}=\infty$$And for $D_+f(x)$ $$D_+f(x)=\liminf_{h\to 0^+}\frac{f(x+h)-f(x)}{h}=\liminf_{h\to 0^+}\{0,\frac{-1}{h}\}=-\infty$$ Finally for $D_-f(x)$ we have $$D_-f(x)=\liminf_{h\to 0^+}\frac{f(x)-f(x-h)}{h}=\liminf_{h\to 0^+}\{\frac{1}{h},0\}=0$$
Now for $x\in\mathbb{R}\setminus\mathbb{Q}$ we have that $f(x)=0$ and since $\mathbb{R}\setminus\mathbb{Q}$ is also dense in $\mathbb{R}$, following the same lines of reasoning from above we have $$D^+f(x)=\limsup_{h\to 0^+}\{\frac{1}{h},0\}=\infty$$ $$D^-f(x)=\limsup_{h\to 0^+}\{\frac{-1}{h},0\}=0$$ $$D_+f(x)=\liminf_{h\to 0^+}\{\frac{1}{h},0\}=0$$ $$D_-f(x)=\liminf_{h\to 0^+}\{\frac{-1}{h},0\}=-\infty$$ Since our derivates are not equal we have that $f$ is not differentiable for any $x$.
