# Measure Theory/Length-integration Defined
## Length-integration Defined

Now that we have a good understanding of measurable functions, we are in a position to formally define the length-measure integral. Still this must be built up in stages.
To begin with we define characteristic functions, then simple functions, and then the integral of simple functions.
We can then take a nonnegative function, f, and approximate it by simple functions. We then use the integral of the simple functions, to approximate the integral of f.

### Simple Functions

Definition: characteristic function
Let X be any set. Define the characteristic function for X by
    $\mathbf {1} _{X}(a)={\begin{cases}1&{\text{ if }}a\in X\\0&{\text{ if }}a\not \in X\end{cases}}$
We will call the set X the characterized set.
Definition: simple function
Let $c_{1},c_{2},\dots ,c_{n}\in {\mathbb {R}}$ and $E_{1},E_{2},\dots ,E_{n}\in {\mathcal {M}}$. If the sets $E_{1},...,E_{n}$ are disjoint then the function
    $\psi (x)=\sum _{i=1}^{n}c_{i}\mathbf {1} _{E_{i}}$
is called a simple function. If all of the $c_{1},\dots ,c_{n}$ are distinct and nonzero then we further say that $\sum _{i=1}^{n}c_{i}\mathbf {1} _{E_{i}}$ is written in canonical [simple function] form. We often omit the "simple function" part when it is clear from context.
Definition: function less-than
For any two real-valued functions $f,g:E\to {\mathbb {R}}$ we will say that $f\leq g$ if for every $x\in E$, we have $f(x)\leq g(x)$.

#### Exercise 1. Simple Simple Function Example

Consider the function $f(x)=x^{2}$ on the interval [0,2], and the simple function $psi=\mathbf {1} _{[1,1.5]}+(1.5^{2})\mathbf {1} _{(1.5,2]}$.
Graph both functions and prove that $\psi \leq f$.

#### Exercise 2. Make It Simple

The function $\psi =\mathbf {1} _{[0,1]}+\mathbf {1} _{[0,2]}$ doesn't look like a simple function because the characteristic functions are not disjoint (or, rather, their sets are not disjoint). However, it is a simple function.
Write the function $\psi$ in the form of a characteristic function. Hint: It takes a constant value on [0,1] and a different value on the set (1,2].

#### Exercise 3. Simple Functions Have Canonical Form

Prove that every function of the form $\sum _{i=1}^{n}c_{i}\mathbf {1} _{E_{i}}$, for real numbers $c_{1},\dots ,c_{n}$ and measurable sets $E_{1},\dots ,E_{n}$, is a simple function which has a canonical form.
Hint: First prove that one can always replace the terms of $\sum _{i=1}^{n}c_{i}\mathbf {1} _{E_{i}}$ with new terms such that the coefficients are all distinct. Do so by considering any two terms, $c_{i}\mathbf {1} _{E_{i}}$ and $c_{j}\mathbf {1} _{E_{j}}$, with $i\neq j$ but $c_{i}=c_{j}$, and showing that these can be condensed into a single equivalent term.
Next prove that, if all the coefficients are distinct in $\sum _{i=1}^{n}c_{i}\mathbf {1} _{E_{i}}$, then for any overlapping sets $E_{i},E_{j}$ with $i\neq j$, the terms $c_{i}\mathbf {1} _{E_{i}},c_{j}\mathbf {1} _{E_{j}}$ may be replaced by three terms which have mutually disjoint characterized sets.
Finally, prove that if one iteratively applies the following algorithm, the result will be a simple function in canonical form:
1. Take the term $c_{1}\mathbf {1} _{E_{1}}$ and pairwise apply the above result to all other terms, resulting in $\sum _{i=1}^{n_{1}}c_{i,1}\mathbf {1} _{E_{i,1}}$.
2. Take the term $c_{2}\mathbf {1} _{E_{2}}$ and pairwise apply the above result to all other terms in $\sum _{i=1}^{n_{1}}c_{i,1}\mathbf {1} _{E_{i,1}}$, resulting in $\sum _{i=1}^{n_{2}}c_{i,2}\mathbf {1} _{E_{i,2}}$.
3. Proceed likewise until, and including, the term $c_{n}\mathbf {1} _{E_{n}}$.

#### Exercise 4. Sums of Simple Functions

Let $\varphi =\sum _{i=1}^{m}c_{i}\mathbf {1} _{E_{i}},\quad \psi =\sum _{i=1}^{n}d_{i}\mathbf {1} _{F_{i}}$ be two simple functions in canonical form.
Add to the collection of sets $E_{1},\dots ,E_{m}$ the set $E_{0}$ which is the set of points on which $\varphi (x)=0$. Also add to $F_{1},\dots ,F_{n}$ the set $F_{0}$ where $\psi (x)=0$.
Now let $G_{k}$ be all the sets which result from any intersection $E_{i}\cap F_{j}$ for $0\leq i\leq m,\ 0\leq j\leq n$. Also, if $1\leq k\leq (m+1)(n+1)$ and $G_{k}=E_{i}\cap F_{j}$, then define $c'_{k}={\begin{cases}0&{\text{ if }}i=0\\c_{i}&{\text{ if }}1\leq i\leq m\end{cases}}$. Likewise define $d'_{k}={\begin{cases}0&{\text{ if }}j=0\\d_{j}&{\text{ if }}1\leq j\leq n\end{cases}}$.
Now show that $\varphi =\sum _{k=1}^{(m+1)(n+1)}c'_{k}\mathbf {1} _{G_{k}}$, and likewise for $\psi$.
Infer that $\varphi +\psi =\sum _{k=1}^{(m+1)(n+1)}(c'_{k}+d'_{k})\mathbf {1} _{G_{k}}$.

#### Exercise 4. Simple Measurable

Prove that every simple function is measurable.

### Integral of a Simple Function

Definition: integral simple function
Let $\psi =\sum _{i=1}^{n}c_{i}\mathbf {1} _{E_{i}}$ be a simple function with disjoint character sets $E_{1},\dots ,E_{n}$. Then the simple integral of $\psi$ is defined by
    $\int \psi =\sum _{i=1}^{n}c_{i}\lambda (E_{i})$
We also define the notation, for any characteristic function on a measurable set E,
    $\int \psi \mathbf {1} _{E}=\int _{E}\psi$
Notice a few things about this. For one thing, integrating a simple function turns a $\mathbf {1}$ into a $\lambda$. This helps one to see that the integral of the simple function is a number, because it is a linear combination of numbers.
Also you probably noticed the lack of a differential. Some authors will write the integral as $\int \psi \ d\lambda$ to express that the integral is taken "with respect to length-measure". However, it is also common to simply drop the differential, since everything we see for many sections to come will all use the length-measure.

#### Exercise 5. Simple Integral

Compute $\int \left(\chi _{[0,1]}+2\chi _{[0,2]}\right)$.

### Integral of a Bounded Function

Finally, that elusive definition is at hand!
Definition: bounded integral
Let $f:E\to {\mathbb {R}}$ be a bounded measurable function, and assume $\lambda (E)<\infty$. We will call $\psi$ a simple under-approximation of f if $\psi$ is a simple function and $\psi \leq f$. We let ${\mathfrak {S}}$ be the set of all simple under-approximations of f.
Then define the bounded integral of f by
    $\int _{E}f=\sup \left\{\int _{E}\psi {\Bigg |}\psi \in {\mathfrak {S}}\right\}$

### Integral of a Nonnegative Function

In the following definition we relax the conditions of boundedness, both on E and f. However, we impose the condition of nonnegativity.
Notice that in each definition of integration, it is built on the back of the previous definition.
Definition: integral nonnegative measurable function
Let $f:E\to {\mathbb {R}}^{\geq 0}$ be a nonnegative measurable function. Let ${\mathfrak {B}}$ be the set of all measurable functions $g:E\to {\mathbb {R}}$ which are bounded, and $\lambda (\{x\in E|g(x)\neq 0\})=0$. Then define the nonnegative integral of f by
    $\int _{E}f=\sup \left\{\int _{E}g{\Bigg |}g\in {\mathfrak {B}}\right\}$
If this quantity is finite then we say that f is integrable.

### General Length-measure Integral

Finally, we remove all conditions and obtain the most general definition of integration that we will discuss in this course.
Definition: integral of a measurable function
Let $f:E\to {\mathbb {R}}$ be a measurable function.
We define the length-measure integral of f by $\int _{E}f=\int f^{+}-\int f^{-}$.
If this number is finite and not of the form $\infty -\infty$ then we say that f is integrable.
Recall that $f^{+},f^{-}$ refer to the positive and negative parts of a function, as defined in a previous lesson. We proved that if f is measurable then so are the parts, and therefore these integrals are well-defined.
By the way, you may notice the lack of bounds of integration. All integrals are assumed to take place over the entire domain of f. If we ever need to restrict an integral to a subset $F\subseteq E$, then we may do so by instead integrating $\int _{E}f\mathbf {1} _{F}$.
In fact, this is the same as merely restricting f to F and then integrating $\int _{F}f$. We will prove this claim later when we have more tools to do so.