# Introduction
I'm trying to wrap my head around _Lebesgue integration_. Supposedly it's an alternative to _Riemann integration_ that's much more useful for analysis. I'm struggling to grasp it, and I'm getting the same feeling I get when I realize the paradigm I'm currently operating on has implicit assumptions that I am unable to see.
# Partitioning the Problem: Dirichlet Function
When I'm completely at a loss like this I find it helpful to use a problem where the non-generalized variation of the concept doesn't work, but the generalized variation does. This functions as a sort-of chisel with which I can partition my current understanding to evince those implicit assumptions I'm making.
Case in point, we're looking at the _Dirichlet function_, which is:
$f(x)= \begin{cases} 1 & \text{if } x \in \mathbb{Q} \\ 0 & \text{if } x \in \mathbb{R}\setminus\mathbb{Q} \end{cases}$
So, a discrete _piece-wise function_ that is not _Riemann integrable_ but **is** _Lebesgue integrable_. Ostensibly, anyway.
The non-_Riemann integrable_ part seems pretty intuitive to me. But let's start with the function itself. The function jumps discretely between 0 and 1 depending on if the $x$ value is irrational or rational. It's essentially an `is_rational(number) -> Boolean` function where 1 is true and 0 is false, if we were to code it up.
Now, when you apply a _Riemann integration_, you typically begin by partitioning the function along the x-axis and then create rectangles with the height (where you get the height from doesn't actually matter in a moment, but let's just say you get it from $f(x)$, plugging in the left-most abscissa of each interval). This approximates your area under the curve (this was originally very important for landowners and dividing up land inheritance, actually). As you subdivide into to smaller and smaller intervals, your approximation becomes more and more accurate. As you subdivide to infinity, your estimation approaches actuality.
That works because the function is _differentiable_, part of the definition of which is that the function is continuous. Because of this, we know that it doesn't matter where in any of the arbitrarily small x-axis partitions we take that measurement of the ordinate in order to construct the rectangle. Because it's continuous, as we approach smaller and smaller intervals along the x-axis, we'll approach the same ordinate value in the y-axis from any chosen beginning abscissa.
>Note: **This is not true unless the function is _differentiable_.**
Because the _Dirichlet function_ is not continuous, it's not _differentiable_. Therefore, it's not _Riemann integrable_, which intuitively makes sense when you think about it. No matter how small you make the individual partitions of the x-axis, every partition will include infinite _rational_ and _irrational_ numbers, as any interval $A = [a_1, a_2]$ or $A = (a_1, a_2)$ will be _dense_ (as in the mathematically rigorous term that describes the infinite capability to subdivide between any two elements within the set to find yet another element). Hence, any arbitrarily small partition will be infinitely toggling between 0 and 1, even as you approach an infinitely small interval size.
In short, you can make an approximation, but _your accuracy will not improve_ as you subdivide further and further, therefore _you cannot take a limit to infinity to go from an approximation to actuality_.
The question now becomes: **How _should_ one _integrate_ then**—if not by _Riemann integration_?
Well, supposedly by using the _Lebesgue integration_. Unfortunately, I don't know how that works just yet.
# Approach One
I just reread an explanation, and I think I have some sort of idea. I'm still confused on some points, but let's break it down. The key, I think, is that instead of summing the values of approximated rectangles, we simply see if we can separately integrate the pieces of the _piece-wise function_ separately and then sum them up.
We have two pieces, videlicet where the function returns zero and where it returns one. With regards to the former:
$f(x) = 0 \, \, \forall \, \, x \in \mathbb{R}\setminus\mathbb{Q}$
This piece very clearly integrates to a total of zero, as $f(x) = 0$ over any domain equals zero.
Subsequently, we have:
$f(x) = 1 \, \, \forall \, \, x \in \mathbb{Q}$
Now this is tricky. You might think this is integrates to infinity, as there are infinite rational numbers. _Countably infinite_, which may seem impertinent at the moment, but will become germane very quickly. So you might reason:
$\infty * 1 = \infty$
Okay so that's it then, right? One piece aggregates to zero, the other to infinity. Infinity plus zero is merely infinity. That's our answer, right? Well, no.
# Approach Two
I certainly thought that answer was valid, except apparently there's a small problem (mind you, I still do not know how to properly reconcile what I just said with what I'm about to say).
Let's imagine you cover every rational abscissa on the x-axis with an interval of some length. If you multiply each of those intervals by the ordinate produced using the corresponding latter function output of the abscissa, you essentially integrate an approximating rectangle at that point, similar to the _Riemann integration_ method. If you aggregate these, you will get an approximate integration.
**That aggregation will always be more than the actual area covered**, because the interval will always be larger than the point it's approximating, but it's an approximation, nonetheless.
Okay so here's where it gets interesting. Take some random epsilon, let's say $\epsilon = 1$. Remember those intervals we used to cover the abscissae? Well, now we want to know if we can curtail them in such a way as to construct a series of infinite intervals where they never converge to a value greater than $\epsilon$.
You may already see where this is going to become problematic.
The answer is: we can, in fact. Take a look at the following series where the intervals are enumerated as $x_i$:
$ \sum_{i=1}^{\infty} x_i|x_i = {\epsilon \over 2^{i+1}}$
All this series represents is the summation of a bunch of intervals, where each subsequent interval is shorter than the last by a power of 2. This is a common _Geometric series_ of the form where $\sum_{i=1}^{\infty} {\epsilon \over 2^{i}} = \epsilon$, except for ours we want to sum to something **less than epsilon**, and we simply choose $\epsilon \over 2$ (because it's easy). Accordingly, instead of dividing $\epsilon$ by $2^i$, which would sum to $\epsilon$, we divide $\epsilon \over 2$ by $2^i$, which when combined with that denominator of 2, simplifies to $2^{i+1}$.
Now, all this is to ask: since we can prove that we can cover every abscissa with a term within our series, and that series sums to half of epsilon, what's to stop us from choosing an arbitrarily small epsilon? **Is there some epsilon small enough where this relationship breaks down?** The answer is no. Apparently not.
We can squeeze down the total length of that series that, within which, we know the total length of rational numbers reside, into relative nothingness. Because as that arbitrary epsilon approaches zero, it consequently constrains our function.
**This is what is called the _Lebesgue Measure_ of 0**, apparently.
According to this paradigm, the integration along the set of irrationals is zero, as the outputs are all zero, yet so is the integration along the set of rationals, given that the sum length of rational numbers in the real numbers has a _Lebesgue measure_ of 0. Therefore, the _Lebesgue integration_ of the _Dirichlet function_ is literally zero.
So. We have a slight problem.
How does one reconcile this conclusion with the earlier position that if you have infinite rational numbers and multiply the cardinality of that set by 1 to get an area of infinity?
# What?
Why do I feel like it has to do with _Contiguity_? Or...perhaps _density_...