On the horizontal integration of the Lebesgue integral

In your example, $\mu$ would represent the base of the rectangle. But that's not the important part. The important part is the definition of the set you are taking the measure of.

Let's look at your image. Imagine each rectangle is height of exactly 1 unit. We might define the sets like this:

$$E_n = \{ x : n \le f(x) < n+1\}.$$

We look at the measure of each of these sets.

For $n = 1$, the set of numbers in $E_1$ is exactly the bottom-most rectangle projected onto the $x$-axis. It has measure $\mu(E_1)$. The second rectangle from the bottom is $E_2$, and so forth.

Each of these rectangles has height $1$, so we can approximate the integral as

$$\int f\, d\mu = \sum 1\cdot \mu(E_n).$$

What might be stumbling you up is that you are expecting that the location of those horizontal slices, as shown in the picture, is somehow embedded within the sum. It is not; rather, the rectangles are essentially sets, pulled upwards by steps of $1$.

Of course, we need not choose height $1$, and it need not be uniform. Instead, we can choose height $a_n$.


The correspondence you are talking about is imaginable in terms of the so-called layer-cake decomposition of a (positive) function as $$ f(x) = \int_0^{\infty} 1_{\{y:f(y) \geqslant t\}}(x) \, dt $$ This is easy to understand: the function is $1$ until $f(x)=t$, and $0$ thereafter, and $$ \int_0^{f(x)} \, dt = f(x). $$ Now, consider $$ \int_{\mathbb{R}} f(x) \, dx = \int_{\mathbb{R}} \left( \int_0^{\infty} 1_{\{y:f(y) \geqslant t\}}(x) \, dt \right) \, dx $$ The function here is positive, and (through a Lebesgue integral calculation using Tonelli's theorem), you can interchange the order of integration to find $$ \int_{\mathbb{R}} f(x) \, dx = \int_0^{\infty} \left( \int_{\mathbb{R}} 1_{\{y:f(y) \geqslant t\}}(x) \, dx \right) \, dt = \int_0^{\infty} \mu\{y: f(y) \geqslant t\} \, dt $$ Now, the integrand of this is a positive, non-increasing function of $t$, so it can be understood as a Riemann integral: in particular, the integrand evaluates the size of the sets on which $f$ is larger than $t$, which you can think of as approximated by horizontal rectangles (the distinction the Lebesgue integral has is that we don't have to use rectangles to approximate these sets any more). This integral can then be viewed as going "upwards" along the $y$ axis, the horizontal rectangles of length $\mu\{y: f(y) \geqslant t\}$ being precisely a Riemann sum!