# Continuous function and indicator function on a Borel set

Suppose $A$ is a Borel measurable subset of [0,1], $m$ is Lebesgue measure, and $\varepsilon\in (0,1)$. Prove that there exists a continuous function $f: [0,1]\to \mathbb{R}$ such that $0\le f\le 1$ and $$m(\{x:f(x)\ne\chi_A(x)\})<\varepsilon.$$ Here $\chi_A(x)$ is the indicator function on $A$.

• Hint: Apply Dynkin's $\pi-\lambda$ theorem. – pre-kidney Mar 8 '17 at 5:28

If $A$ is Borel measurable, then it is certainly Lebesgue measurable. The Lebesgue measure is regular, meaning that for any $\epsilon > 0$, you can find a closed set $F$ and an open set $U$ with $F \subset A \subset U$ such that $m(U \backslash F) < \epsilon.$
By Urysohn's lemma, there exists a continuous function $f:[0,1]\to \mathbb R$ with $0 \leq f \leq 1$ such that $f(x) = 0$ for $x \notin U$ and $f(x) = 1$ for $x \in F$. Thus the only place where $f \neq \chi_A$ is the region $U \backslash F$, whose measure is less than $\epsilon$ by assumption.