TITLE: Lebesgue Density Theorem
QUESTION [5 upvotes]: Problem from Folland : based on Lebesgue Density Theorem:
Let $D_{E}(x) = \lim_{r\to 0}\frac{\mu(E\cap B(r,x))}{\mu(B(r,x))}$ whenever it exists.
Find examples of $E$ and $x$ such that $D_{E}(x)$ is a given number $\alpha \in (0,1)$ , or such that $D_{E}(x)$ does not exist. ($X = \mathbb{R}^n$,$\mu$ is Lebesgue measure)

REPLY [9 votes]: For the second part, let $B_n=B(1/n,0)=(-1/n,1/n)\subseteq\mathbb{R}$ for every $n\in\{1,2,\ldots\}$ and 
$$E=\bigcup_{n=1}^\infty(B_{(2n-1)!}\setminus B_{(2n)!}).$$
If $n$ is odd, then $B_{n!}\setminus B_{(n+1)!}\subseteq E$. Hence
$$\frac{\mu(E\cap B_{n!})}{\mu(B_{n!})}\geq\frac{\mu(B_{n!}\setminus B_{(n+1)!})}{\mu(B_{n!})}=\frac{2/n!-2/(n+1)!}{2/n!}=1-\frac{1}{n}\longrightarrow 1$$
and we see that the Lebesgue upper density of $E$ at $0$ is $1$.
On the other hand, if $n$ is even, then $E\cap B_{n!}\subseteq B_{(n+1)!}$. Hence
$$\frac{\mu(E\cap B_{n!})}{\mu(B_{n!})}\leq\frac{\mu(B_{(n+1)!})}{\mu(B_{n!})}=\frac{2/(n+1)!}{2/n!}=\frac{1}{n+1}\longrightarrow 0$$
and we see that the Lebesgue lower density of $E$ at $0$ is $0$.
Since the upper and lower density of $E$ at $0$ differ, the density of $E$ at $0$ does not exist.