Set $f:[0,1]\rightarrow \mathbb{R}$ for which each set $X_{c}=\{x\in [0,1] \mid f(x)\leq c \}$ has Lebesgue measure 0 or 1. Prove that there is $c_{0}$ such that $f(x)=c_{0}$ q.t.p $x\in[0,1]$.
I take $c_{0}:=\inf \{c , m(X_{c})=1 \}$, where $m$ is the Lebesgue measure.
Any help would be appreciated. Thanks!
For any $c<c_0$ one has $m(X_c)=0$. Let $q_i, i \in \mathbb{N}$, be an increasing sequence of numbers approaching $c_0$. Then $$\{x: f(x)<c_0\}=\bigcup_{i=1}^\infty \{x: f(x) \leq q_i\}=\bigcup_{i=1}^\infty X_{q_i},$$ and since $m(X_{q_i})=0$, one has $m\{x: f(x)<c_0\}=0$.
Next, let $p_i$ be a decreasing sequence of numbers approaching $c_0$, and let $p_1=\infty$. Then $$\{x: f(x)>c_0\}=\bigcup_{i=1}^{\infty} \{x: p_{i+1}<f(x) \leq p_i\}.$$ But $$m\{x: p_{i+1}<f(x) \leq p_i\}=m\{x: f(x) \leq p_i\} - m \{x: f(x) \leq p_{i+1}\}=1-1=0.$$ It follows that $m \{x: f(x)>c_0\}=0$. Therefore, $m\{x: f(x) \neq c_0\}=m\{x: f(x)<c_0\}+m\{x: f(x)<c_0\}=0$ which implies the claim.