Given a function $f \in L^1 (\mathbb R)$, define the *roughness* $R\_f$ of $f$ at $x \in \mathbb R$ by


$$\DeclareMathOperator{\esssup}{\operatorname{esssup}}
R\_f (x) := \limsup\_{r \to 0+}\dfrac{r \esssup\_{y \in B\_r (x)} |f(y) - f(x)|}{\displaystyle\int\limits\_{B\_r (x)} |f(s) - f(x)| ds} 
$$
where $\esssup$ denotes the essential supremum, and by convention we take $\frac{0}{0} = 1$.


**Question:** Let $f$ be continuous. Is it true that $f$ is differentiable almost everywhere if and only if $R\_f = 1$ almost everywhere?


*Remark: The “only if” direction is relatively straightforward, the “if” direction is the issue.*



An equivalent condition for differentiability almost everywhere?
The answer is **negative**: If $f'(x) = 0$ "too often", then $R\_f$ may fail to be equal to one almost everywhere.




---


Let $C$ be a [fat Cantor set](https://en.wikipedia.org/wiki/Smith%E2%80%93Volterra%E2%80%93Cantor_set), let $I\_n = (a\_n, b\_n)$ ($n \geqslant 2$) be the sequence of all finite components of the complement of $C$, and let $f$ be a differentiable function with the following properties:


* $f(x) = 0$ for $x \in C$;
* on $I\_n$, $f$ is a smooth bump of a fixed shape, supported in $\tfrac1n I\_n$ (the middle $n$th part of $I\_n$), and with maximum equal to $|I\_n|^2$ (and hence the integral of $f$ over $I$ is equal to $\tfrac1n |I\_n|^3$).


Then $f'(x) = 0$ for $x \in C$ by the first property, so $f$ is everywhere differentiable. On the other hand, it is rather straigthforward to see that there is a constant $C$ such that for each $n$ and $t \in I\_n = (a\_n, b\_n)$ we have
$$ \int\_{a\_n}^t f(y) dy \leqslant \frac{C}{n} (t - a\_n) \sup\_{y \in [a\_n, t]} f(y) $$
and
$$ \int\_t^{b\_n} f(y) dy \leqslant \frac{C}{n} (b\_n - t) \sup\_{y \in [t, b\_n]} f(y) . $$
It follows that if $x \in C$ and $r$ is small enough, so that $B\_r(x)$ is disjoint with $\tfrac12 I\_2 \cup \tfrac13 I\_3 \cup \ldots \cup \tfrac1{n-1} I\_{n-1}$, then
$$ \int\_{B\_r(x)} f(y) dy \leqslant \frac{C}{n} |B\_r(x)| \sup\_{y \in B\_r(x)} f(y) . $$
This, in turn, implies that $R\_f(x) = \infty$ for every $x \in C$.


Thus, $R\_f(x) \ne 1$ on a set of positive Lebesgue measure.


