# Measure Theory/Approximations of Measurable Functions
## Simple, Step, and Continuous Functions
#### Exercise 1. Simple Functions are Approximately Step

Let $\psi =\sum _{i=1}^{n}c_{i}\mathbf {1} _{E_{i}}$ be a simple function on the bounded interval [a,b]. Also let $\varepsilon \in {\mathbb {R}}^{+}$.
Prove that there exists a step function s and measurable set F such that
    s and $\psi$ are equal on F, and F is nearly all of [a,b].
More formally, for all $x\in F$, we have $\psi (x)=s(x)$.
And $\lambda ([a,b]\smallsetminus F)<\varepsilon$.
Hint: Approximate each of $E_{1},\dots ,E_{n}$.

#### Exercise 2. Step Functions are Approximately Continuous

Let s be any step function on a closed, bounded interval, $s:[a,b]\to {\mathbb {R}}$ and $s=\sum _{i=1}^{n}c_{i}\mathbf {1} _{I_{i}}$. Also let $\varepsilon \in {\mathbb {R}}^{+}$.
Prove that there is a continuous function $f:[a,b]\to {\mathbb {R}}$ and measurable set $E\subseteq [a,b]$, such that
    ${\text{ for all }}x\in E:f(x)=s(x),\quad {\text{ and }}\lambda ([a,b]\smallsetminus E)<\varepsilon$
Hint: There is a finite number of discontinuities of s.
Put a small enough neighborhood around each discontinuity. Outside of these neighborhoods, make f and s equal.
Inside of these neighborhoods, interpolate a linear function from one end to the other.

## Approximations of Measurable Functions

Here we study two kinds of approximation results. One defines a notion in which two functions are "basically the same" (at least for the purposes of integration). This is the idea of functions being equal "almost everywhere". For functions equal almost everywhere, one may replace one function by the other and the value of the integral is unchanged.
The other kind of approximation result is that every measurable function is (1) approximately continuous, and (2) approximately step. This means that measurable functions can be replaced by continuous or step functions, and although this changes the value of the integral, it does so "not too much".
Definition: almost everywhere, a.e.
Let $f,g:E\to {\mathbb {R}}$ be two measurable functions. We say that they are equal almost everywhere if the set of points at which they are not equal is a null set. That is to say,
    $\lambda (\{x|f(x)\neq g(x)\})=0$
We also abbreviate the statement that f equals g almost everywhere by writing $f=g{\text{ a.e. }}$

#### Exercise 3. Almost Equal to 0

Show that the constant function 0, and the Dirichlet function $\mathbf {1} _{\mathbb {Q}}$ are equal almost everywhere.

### A.e. Preserves Measurability

Suppose $f,g:E\to {\mathbb {R}}$ are two functions, and f is measurable, and suppose $f=g{\text{ a.e. }}$ We will prove that therefore g is measurable.
Let $a\in {\mathbb {R}}$ and consider the sets
    $F=f^{-1}((a,\infty ))=\{x\in E|g(x)>a\}$
    $G=g^{-1}((a,\infty ))=\{x\in E|f(x)>a\}$
    $H=\{x\in E|f(x)\neq g(x)\}$

#### Exercise 4. A.e. Preserves Measurability

Justify why the following sets are measurable, in this order:

### Simple Functions Are Approximately Step

In this section we will show that, if $\psi :[a,b]\to {\mathbb {R}}$ is a simple function then there is a step function $s:[a,b]\to {\mathbb {R}}$ and a set $E\subseteq [a,b]$ such that $\psi =s$ on E and $\lambda ([a,b]\smallsetminus E)<\varepsilon$.
So let $\psi =\sum _{i=1}^{n}c_{i}\mathbf {1} _{E_{i}}$ be a simple function and let $\varepsilon \in {\mathbb {R}}^{+}$.
As we proved in a previous lesson, each $E_{i}$ is approximately an open set. That is to say, there is an open set $E_{i}\subseteq U_{i}$ such that $\lambda (U_{i}\smallsetminus E_{i})<\varepsilon /n$.

### Measurable Functions Are Approximately Continuous and Step

We will now show that for any measurable function $f:[a,b]\to {\mathbb {R}}$ and $\varepsilon \in {\mathbb {R}}^{+}$, there exists a continuous function $g:[a,b]\to {\mathbb {R}}$ such that
    $|f-g|<\varepsilon$ on a set $E\subseteq [a,b]$
and $\lambda ([a,b]\smallsetminus E)<\varepsilon$. When $\varepsilon$ is "very small" then E is almost the whole interval [a,b], and g is very close to f.
We will also prove that there exists a step function $s:[a,b]\to {\mathbb {R}}$ such that
    $|f-s|<\varepsilon$ on a set $E\subseteq [a,b]$
and $\lambda ([a,b]\smallsetminus E)<\varepsilon$.
First we prove that there is an M such that $|f|\leq M$ except on a set of measure less than $\varepsilon /3$.
To do so, consider the sequence of sets
    $E_{n}=\{x\in [a,b]:|f(x)|\leq n\}$

#### Exercise 5. Measurable Approximately Bounded

First show that $E_{n}$ is measurable for each $1\leq n$.
Next show that $[a,b]=\bigcup _{n=1}^{\infty }E_{n}$.
Then use the continuity of measure to show that there is some M for which $\lambda \left(\bigcup _{n=1}^{M}E_{n}\right)>b-a-\varepsilon$. Define $F=\bigcup _{n=1}^{M}E_{n}$.
Infer that this is the desired M.
Next we will show that there is a simple function $\varphi$ such that $|f-\varphi |<\varepsilon$ except on F.
To do so, set $n\in {\mathbb {N}}$ such that ${\frac {M}{n}}<\varepsilon$ and define the sets
    ${\begin{aligned}E_{n,i}&=\left\{x\in [a,b]:{\frac {M(i-1)}{n}}\leq |f(x)|<{\frac {Mi}{n}}\right\}\\&=(|f|)^{-1}([M(i-1)/n,Mi/n)),\quad {\text{ for }}1\leq i\leq n\end{aligned}}$
and then define the function
    $\varphi =\sum _{i=1}^{n}\left(\inf _{E_{n,i}}f\right)\mathbf {1} _{E_{n,i}}$

#### Exercise 6. Simple Approximation Confirmation

Show that $\varphi$ is simple and, except on F, $|f-\varphi |<\varepsilon$.
Finally, use all of the above (with the help of results proved in earlier exercises) to prove the desired result.