# If a function is almost everywhere continuous then it is the limit of step functions almost everywhere.

I want to prove that if $f: \mathbb{R} \rightarrow \mathbb{R}$ is continuous a.e. the there is a sequence of step functions $(\phi_n)$ such that $\displaystyle f=\lim_{n\rightarrow \infty }\phi_n$ a.e.

What I thought is that $f$ is Riemann Integrable on any compact, then if I could find a step function $\phi_n$ a.e. within $1/n$ from $f$ on $[-n,n]$ I would be done taking $n \rightarrow \infty$

But I don't think Riemann Integrability is sufficient to get this condition, as the space of regulated functions is a subspace of the Riemann Integrable ones.... any suggestion?

EDIT : Maybe considering $\mathbb{R}$ taking away $\cup _{i=1}^{\infty} I_n$ covering the null set in which $f$ is not continuous, so there is a step function approximating $f$ on this set, then I extend it to a step function on $\mathbb{R}$ by giving it any value on the union of the $I_i$....

EDIT2 ok I will try to expand on my previous edit.

Let $n \in \mathbb{N}$ Consider the covering for the set in which $f$ is not continuous made of the open intervals $(I_n)$ s.t. $\sum l(I_n) < 1/n$

Now $f$ is continuous on the compact $[-n,n] \setminus (\cup I_n)$ so choose the step function $\theta _n$ to be s.t. $|\theta_n - f|<1/n$ on this compact.

Now consider $\phi_n$ defined on the all $[-n,n]$ to be equal to $1$ where $\theta_n$ is not defined.

Then $\phi_n$ is a step function and as $n \rightarrow \infty$ it converges to $f$ almost everywhere.

What do you think of this?

-
Hint: It is simpler than that: every a.e. continuous function is measurable and every measurable function is pointwise limit of (measurable) step functions. To show the last assertion you just have to truncate $f$ over increasingly finer levels. – AndreasT Feb 9 '13 at 21:11
@AndreasT yeah but the point of my problem is to deduce from what I want to prove above that every a.e. continuous function is measurable!! – Moritzplatz Feb 9 '13 at 21:27
got it, but first let me clear this out: (1) do you mean "Now $f$ is continuous on the compact $[−n,n]\cap\bigcap_n I_n^C$ so..." (where $I_n^C$ is the complement of $I_n$)? Cause otherwise I don't see why $f$ should be continuous, nor why such set should be compact. (2) From your idea I presume that you already know that continuous functions are approximable with step functions, don't you? (3): What exactly do you mean with step functions? I mean, are they required (just) to be measurable? – AndreasT Feb 10 '13 at 10:39
@AndreasT yeah sorry, I wanted to say on $[n,n] \setminus \cap I_n$, yes I know that a continuous function on a compact can be uniformly approximated by step functions: a step function is a function with finite range and such that for each value of the range the preimage of it is an interval! (that's why I take the interval cover instead than simply E) – Moritzplatz Feb 10 '13 at 11:07

Let $f$ be continuous on $\mathbb R\setminus E$ with $\mu(E)=0$ where $\mu$ denotes the Lebesgue measure over $\mathbb R$. $E$ is measurable, therefore (by definition) for every $n\in\mathbb N$ there exists an open set $E_n\supseteq E$ such that $\mu(E_n)<\frac 1n$. An open set in $\mathbb R$ is countable union of open intervals, so that for every $n\in\mathbb N$ the compact set $R_n\,\dot=\,[-n,n]\setminus E_n$ (on which $f$ is continuous) is countable union of intervals - where a set $\{x_0\}$ is considered as the closed interval $[x_0,x_0]$. Note that $R_n\nearrow\mathbb R\setminus E$ as $n\to\infty$.
Assuming (which is true) that every continuous function is uniformly approximable with step functions over compact sets let $\vartheta_n$ be a step function with ${\sf supp}\vartheta_n\subseteq[-n,n]$ and such that $\|\vartheta_n-f\chi_{R_n}\|_\infty<\frac1n$ where $\chi_{R_n}$ denotes the characteristic function of the set $R_n$. (Just for a matter of simplicity, so that there is no need to define another function $\varphi_n$, I chose $\vartheta_n$ to be equal to $0$ on $[-n,n]\setminus R_n=E_n$ instead of $1$ which would work as well). Note that $\vartheta_n$ is a step function over $\mathbb R$ as well (not only over $R_n$).
Then for every $x\in\mathbb R\setminus E~$ $\vartheta_n(x)\to f(x)$ as $n\to\infty$. In fact, since $R_n\nearrow\mathbb R\setminus E$, there exists a natural $\nu=\nu(x)$ such that $x\in R_n$ for every $n\geq\nu$, therefore by the property of $\vartheta_n$ you have that $|\vartheta_n(x)-f(x)|<\frac 1n$ for every $n\geq\nu$. This ensures that $\vartheta_n\to f$ pointwise in $\mathbb R\setminus E$, id est almost everywhere.
EDIT: I think that local Riemann-integrability over is sufficient though. If $f$ is locally Riemann-integrable, then for every $n$ there exists a partition $\mathcal P_n=(t_0,\ldots,t_{k_n})$ of $[-n,n]$ such that $$\left| s_n - \int_{-n}^nf(x)\,{\rm d}x \right| < \frac 1n$$ where $$s_n = \sum_{j=1}^{k_n} (t_j-t_{j-1})m_j \quad\text{and}\quad m_j = \underset{x\in[t_{j-1},t_j]}{\sf ess\,inf} f(x)$$ where the essential infimum is taken with respect to the Peano-Jordan measure. Therefore the function $$\vartheta_n = \sum_{j=1}^{k_n} m_j\chi_{(t_{j-1},t_j]}$$ locally converges in the $L^1$-norm to $f$ as $n\to\infty$ (remember that a locally Riemann-integrable function is also locally Lebesgue integrable). There is an easily provable result that states that this implies that there exists a subsequence $\vartheta_{n_j}$ which converges to $f$ almost everywhere as $j\to \infty$.