The picture at the link below finally helped me to understand the simple function construction of Lebesgue and how one can approximate a real function using simple functions.
https://www.geogebra.org/m/PRKqaF3Y
But I still don't understand how the constructions solves the standard bad function example where $f(x) = 0$ if $x$ is irrational and $1$ if $x$ is rational?
Can someone explain this? It seems to me like one will still have a rational between every irrational so why does slicing the function horizontally instead of vertically solve the issue? Thanks.
The integral is defined as 1*y(Q)+0*y(R/Q) which is 0, since the rationals are countable and therefore have measure 0. (in measure theory 0*inf is usually defined as 0). Therefore there is no issue with this function. To elaborate: It works, because you can seperate the rationals from the irratioanls in the calculation. If you slice vertically, each slice will contain a rational and a irrational number, therefore creating problems.