TITLE: How much time does a function spend above or below its average value around a point?
QUESTION [5 upvotes]: Given a locally integrable function $f: \mathbb R \to \mathbb R$, define $
K: \mathbb R \times \mathbb R+ \to \mathbb R$ by 
$$
K(x, r) :=
\begin{cases}
1, & \text{if  }f(x) > \dfrac{1}{2r}\displaystyle\int\limits_{B_{r}(x)}f\,\mathrm{d}x\\
-1, & \text{if }f(x) < \dfrac{1}{2r}\displaystyle\int\limits_{B_{r}(x)}f\,\mathrm{d}x\\
0,& \text{if }f(x) = \dfrac{1}{2r}\displaystyle\int\limits_{B_{r}(x)}f\,\mathrm{d}x
\end{cases}
$$
Define $U: \mathbb R \to [-1, 1]$ and $L: \mathbb R \to [-1, 1]$ by 
$$
\begin{split}
U(x) &:= \limsup_{r \to 0} \frac{1}{2r}\int\limits_{B_r(0)} K(x, t)\,\mathrm{d}t\\
L(x) &:= \liminf_{r \to 0} \frac{1}{2r}\int\limits_{B_r(0)} K(x, t)\,\mathrm{d}t
\end{split}
$$
Intuitively, $U$ and $L$ represent the weighted proportion of time a function spends above or below its average value in an infinitesimal neighbourhood of a point.
i) Is it true that for any locally integrable function, $U = L$ a.e?
ii) Is it true that $U = 1, 0, or -1$ a.e.?

REPLY [2 votes]: For i) the Brownian motion gives a counter example.
We choose $f(t)=W_t$ with $W_t$ a Brownian on $\mathbb{R}$. Because one can calculte $U(0)$ and $L(0)$ from the Brownian motion restricted to any neighbourhood of $0$, we can apply Blumenthal’s 0-1 law: There exists $c_1,c_2\in \mathbb{R}$ such that $\mathbb{P}(U(0)=c_1)=1$ and $\mathbb{P}(L(0)=c_2)=1$. By symetry we have $c_1 =-c_2$. Moreover for any $0<a<1$ there exists $\epsilon$ such that for all $r>0$
$$\mathbb{P}\Big(\frac{1}{2r}\int_{B_r(0)}K(0,t)dt \geq a\Big)>\epsilon$$ Therefore $c_1\geq a$ and we conclude that $c_1=1$ and $c_2=-1$. 
Finally by translation invariance of the Brownian motion we have for all $t\in \mathbb{R}$ $$\mathbb{P}(U(t)=1)=\mathbb{P}(L(t)=-1)=1$$