Confusion about Lusin's Theorem. I saw a proof which heavily relied on Lusin's Theorem recently, and I was hoping someone might be able to help me fill in the detail as to why this theorem allows for a particular creation. 

(Lusin's Theorem) If $f : [a, b] \rightarrow \mathbb{C}$ is Lebesgue measurable and $\epsilon > 0$, there is a compact set $E \subset [a,b]$ such that $\mu(E^c) < \epsilon$ and $ f $ is continuous on $E$.

The line in the proof I read was as follows,

"Suppose $f \in L^\infty$ is given, we can apply Lusin's theorem infinitely many times to construct a sequence $(f_n)$ in $C[0,1]$ uniformly bounded by $\|f\|_\infty$ such that the measure of the set where $f$ and $f_n$ are unequal less than $\frac{1}{n}$."

The requirement for this theorem is the existence of a compact set for continuity, but the set may only be a single point. Let's just say we had the measurable function
\begin{equation}
f(x) = \begin{cases} 1 &\mbox{if } x\in \mathbb{Q} \\ 
0 & \mbox{if } x \not \in Q. \end{cases}
\end{equation}
What would this creation $(f_n)$ look like, and how does it follow that this sequence will be continuous on $[0,1]$. 
 A: A continuous function defined on a closed set can be continuously extended to the entire interval (e.g. linear extrapolation on the open intervals exhausting the complement).
So in the n-th step, we take a closed set $E_n$ such that $\mu(E^c) < 2^{-n}$ and $f|_{E_n}$ is continuous. Then we extend $f|_{E_n}$ to $f_n$ by linear extrapolation. This in particular keeps the bounded by $||f||_\infty$ condition true.
In your example, the approximating functions just would be constant 0.
A: Lusin's theorem gives a sequence of functions $f_n$ as well as a sequence of sets $E_n$. In this case, the approximating functions would be constant 0. The set $Q' = [0,1]\setminus\mathbb{Q}$ has measure $1$. The closed sets would necessarily be increasingly larger closed subsets of $[0,1]$ containing no rationals. This is possible because $\mu(A) = \sup\{\mu(K) : K \subset A, \text{K compact}\}.$
I don't think the approximating sequence could be anything else,  because no function defined on a set containing an interval could agree with $f(x) = 1_{\mathbb{Q}\cap[0,1]}(x)$ and be continuous.
