# Measure Theory/Length-integration and Measurable Functions
## Length-integration and Measurable Functions

Recall the entire project, with the ultimate goal of developing a new theory of integration which will allow for the swaparoo.
This new system of integration first partitions the range of the function and then determines preimages of the function for each cell of the partition.
We then built the measurement function, $\lambda$, in order to assign to these preimages a measurement.
But of course, the big drama of that section was the fact that not all subsets of real numbers can have a measurement. Therefore this system of integration will not work if any one of those preimages happens to be non-measurable.
Whence the following definition.
Definition: measurable function
Let $E\in {\mathcal {M}}$ and $f:E\to {\mathbb {R}}$. We say that f is a measurable function if for every open ray $(a,\infty )$ we have
    $f^{-1}((a,\infty ))\in {\mathcal {M}}$
That is to say, measurable functions are those for which every preimage of an open ray is a measurable set.

#### Exercise 1. Linear Measurable

Show that every linear function is measurable.

### Closure Properties

Just as closure properties were very useful for measurable sets, there are useful closure properties for measurable functions.
Linear Combinations
We will first prove that all linear combinations of measurable functions are measurable.
Let $f,g:E\to {\mathbb {R}}$ be two measurable functions, and we will first show that f+g is measurable. This means that we must consider any open ray $(a,\infty )$, and prove that $(f+g)^{-1}((a,\infty ))\in {\mathcal {M}}$.
Notice that
    $(f+g)^{-1}((a,\infty ))=\{x|(f+g)(x)>a\}=\{x|f(x)+g(x)>a$
Having two varying quantities is a struggle -- can we somehow fix f and then seek values for g?
We could consider the set $\{x|f(x)\geq 0{\text{ and }}g(x)>a\}$ which is some portion of the set that we want. And
    $\{x|f(x)\geq 0{\text{ and }}g(x)>a\}=\{x|f(x)\geq 0\}\cap \{x|g(x)>a\}$
which is the intersection of two measurable sets, and therefore is measurable.
Of course this isn't the entire set $(f+g)^{-1}((a,\infty ))$ because it considers only nonnegative values of f.
However, it does give a hint as to a more complete proof.

#### Exercise 2. Measurable Functions Closed under Sum

Find a countable sequence of measurable sets such that their union equals $(f+g)^{-1}((a,\infty ))$.

#### Exercise 3. Measurable Functions Closed under Scalar Multiples

Show that if $c\in {\mathbb {R}}$ then with f as above, $cf$ is a measurable function.
Conclude from the above exercises that the measurable functions are closed under linear combinations.

### Products

We will prove, with f and g as above, that fg is measurable. As before, it is a struggle to have two parameters varying at the same time. However, this time it is not so easy to merely fix one and look for values of the other.
But we can employ a different trick. We can relate the product fg to the sum f+g by the square formula
    $(f+g)^{2}=f^{2}+2fg+g^{2}$
If we can show that the square of any measurable function is measurable, then the above equation allows us to prove that $fg={\frac {1}{2}}[(f+g)^{2}-f^{2}-g^{2}]$ is a linear combination of measurable functions and hence is measurable.

#### Exercise 4. Measurable Functions Closed under Squares

Show that $f^{2}$ is measurable.
Then infer that fg is measurable.

### Suprema and Infima

Taking the suprema and infima of functions will be very important, and there are a couple of reasons why that is so.
For one thing, you will see that we need to construct the technical definition of the length-measure integral first only for nonnegative functions. Afterwards we will use that to extend to general measurable functions.
One thing that this will require is taking a function which is not positive and "making it positive", and taking the supremum between the function and 0 will do that.
For another thing recall that the plan for integration is to determine rectangle heights by taking the infimum of the function on an interval. Well, then it makes sense that perhaps we would want the result to be measurable.
Definition: supremum and infimum of functions
Let $f_{1},f_{2},\dots$ be a sequence of measurable functions $f_{i}:E\to {\mathbb {R}}$. Define $\sup\{f_{1},...,f_{n}\}=f$ where
    $f(x)=\sup\{f_{1}(x),...,f_{n}(x)\}$
and define $\sup\{f_{i}|1\leq i\}=g$ where
    $g(x)=\sup _{1\leq i}\{f_{i}(x)\}$
Further define ${\overline {\lim }}\{f_{i}|1\leq i\}=h$, called the limsup of the sequence of functions, where
    $h(x)={\overline {\lim }}\{f_{i}(x)|1\leq i\}$
Define notions of infima in parallel ways.
In brief, what all of these definitions say, is that when we talk about the suprema of any set of functions, we take the suprema evaluated "pointwise".

#### Exercise 5. Prove Supremum

Show that $\sup\{f_{i}|1\leq i\}$ is a measurable function. Hint: Union each preimage for each function.

#### Exercise 6. Prove Limsup

First prove that for any set $X\subseteq {\mathbb {R}}$ and sequence $\langle x_{n}\rangle \subseteq X$, the limsup ${\overline {\lim }}x_{n}$ is equivalent to
    $\inf _{k}\{\sup _{k\leq n}x_{n}\}$
Use this to argue that the limsup of a sequence of measurable functions is measurable.

#### Exercise 7. Prove Absolute Value

Prove that $|f(x)|$ is measurable.

### Positive and Negative Parts

The following will become important when extending the definition of the integral from nonnegative functions to all functions.
Definition: positive and negative parts of a function
Let $f:E\to {\mathbb {R}}$ be any real-valued function. Define the positive part of f to be
    $f^{+}(x)=\max\{0,f(x)\}$
and the negative part of f to be
    $f^{-}(x)=\max\{0,-f(x)\}$
Notice that both the positive and negative parts are nonnegative functions. In particular, the negative part is positive, wherever the original function is negative.

#### Exercise 8. Graph sin

Graph the negative part of $f(x)=\sin x$.

#### Exercise 9. Measurable Positive Part

Prove that the positive part of a measurable function is measurable, and likewise for the negative part.