Dini Derivative Let $f$ be defined on $\mathbb{R}$ such that $$
f(x) =
\begin{cases}
|x|, & \text{if }x \in \mathbb{Q} \\
|2x|, & \text{if }x \notin \mathbb{Q} 
\end{cases}
$$
Calculate $D^{+}f(0),D^{-}f(0),D_{+}f(0),D_{-}f(0)$ and $D^{+}f(1),D^{-}f(1),D_{+}f(1),D_{-}f(1)$.
 A: I will try and help with a few to try and guide you along:
For $D^+ f(0)$ we need to find the following:
$$
\limsup_{h \to 0^+} \frac{f(0 + h) - f(0)}{h}
$$
First since we're approaching from the right (meaning with $h>0$) we note that our function, with this restriction is defined as:
$$
f(x\ge0) = \begin{cases} x & x \in \mathbb{Q} \\ 2x & x \not\in \mathbb{Q} \end{cases}
$$
Now since we want the $\limsup$ we need to find the following:
$$
\lim_{h\to 0^+} \sup_{0 < k < h} \frac{f(k)}{k}
$$
Now one can show (tell me if you need this to be more rigorously if you don't believe me here) that the $\sup$ of this will always be
$$
\lim_{h \to 0^+} \frac{2h}{h}
$$
(an easy intuitive way to see this is that $2x > x$ when $x > 0$). Thus naturally we get that
$$
D^+ f(0) = 2
$$
Now if we take the limit from the left something similar will happen:
$$
\limsup_{h \to 0^-} \frac{f(0 + h) - f(0)}{h} = \lim_{h \to 0^-} \sup_{h < k < 0} \frac{f(k)}{k}
$$
Here our function will be defined as:
$$
f(x\le0) = \begin{cases} -x & x \in \mathbb{Q} \\ -2x & x \not\in \mathbb{Q} \end{cases}
$$
But be careful and note that when $x < 0$ we have $-2x > -x$ so similar to above, we get
$$
\lim_{h \to 0^-} \frac{-2h}{h} \implies D^- f(0) = -2
$$
Doing the lower derivatives will be a similar process, however with $\inf$:
$$
D_+ f(0) = \liminf_{h \to 0^+} \frac{f(0 + h) - f(0)}{h} = \lim_{h \to 0^+} \inf_{0 < k < h} \frac{f(k)}{k} = \frac{k}{k} = 1 \\
D_+ f(0) = \liminf_{h \to 0^-} \frac{f(0 + h) - f(0)}{h} = \lim_{h \to 0^-} \inf_{h < k < 0} \frac{f(k)}{k} = \frac{-k}{k} = -1
$$
Can you follow this for $D^\pm_\pm (1)$ ?
