Why do we need Lebesgue Integration and what are the limits to Riemann Integrals? I am studying Lebesgue integrals, or to be more general, Measure Theory. I am really having difficulties with understanding why we would go over to the Lebesgue measure. The books I'm studying are maybe to technical. Could you please elaborate a bit on the need for measure theory. Why would we want functions to be measurable? Why do we need Lebesgue Integrals? What are the limits of Riemann Integrals, and why wouldnt you maybe introduce Lebesgue Integrals first, if they are better?
Thanks in advance.
 A: What I’m about to present is an answer, from only one perspective (which is the version I tell myself, but keep in mind there are several other ways of answering your question), taking hindsight into account, not Lebesgue’s original motivations.

The ”Riemann integral is bad with Limits” route:
One of the common responses to this is that Riemann integrals cannot handle functions like $\chi_{\Bbb{Q}\cap[0,1]}$ (the function defined on $[0,1]$ which is $1$ on the rationals and $0$ otherwise). And sure, this function is not Riemann-integrable, but I wouldn’t consider this alone as a true failure. So what if we can’t handle a pathological case, maybe it’s just so bad it doesn’t deserve to be handled.
I’d say the more significant reason is that various function spaces equipped with integral norms are not complete. For instance, the space $C([a,b])$ (similar issue with $C^k([a,b])$) of continuous real-valued functions on $[a,b]$ equipped with say the inner product $\langle f,g\rangle=\int_a^bfg$ does not define a complete space. Likewise, the larger space of Riemann-integrable functions $\mathcal{R}([a,b])$ is not complete for this inner product. This was a huge issue in the study of PDEs, particularly the Laplace’s/Poisson’s equation; if you’re interested, you should read up on the history of the Dirichlet problem to see the various ups and downs (Dirichlet introduced the idea, Riemann used it in complex analysis, then I believe it was Weierstrass who pointed out a flaw in the argument which essentially boils down to lack of completeness, and then in the 20th century this was finally fully handled with I think Hilbert, and later on with Sobolev spaces etc).
The above historical illustration with PDEs is just an example. Another historical example where there used to be lots of handwaving was Fourier analysis (which I don’t want to get into now). Anyway, the general message is that completeness, and so taking one step further, good behavior under limiting processes, is EXTREMELY important in analysis. So much of higher level analysis explicitly relies on it. Even at the very basic level, we have recognized that the rational numbers are insufficient, and that’s why we came up with the concept of real numbers. If our very number system is expected to be complete, why not our fancy (actually not really fancy… they’re very naturally occurring) function spaces?
Ok, so at this stage, one might say that we could just consider the abstract completion of these spaces with respect to appropriate norms, but that is unsatisfactory because the completion is abstract, and not realized as a set of functions. Furthermore, it doesn’t fully address our concerns with the Riemann integral. The Riemann integral plays very poorly with pointwise convergence as the resulting function usually fails to be Riemann integrable. So, in this sense, widening the definition to Lebesgue integrals remedies this failure. So, with Lebesgue integrals, we get (relatively easily, thanks to the works of giants):

*

*The famous convergence theorems: monotone convergence, Fatou’s lemma, dominated convergence.

*Various complete function spaces, $L^p(\Bbb{R}^n)$ for $1\leq p\leq \infty$, and going a step further, the Sobolev spaces $W^{k,p}(\Bbb{R}^n)$ (an essential collection of spaces when studying PDEs)

*Lebesgue’s differentiation theorem, and hence the Lebesgue version of the two Fundamental theorems of Calculus (vast generalizations of those in the Riemann setting)

The first two bullet points address the previously mentioned defecits in the Riemann integral. The third says that the Lebesgue integral (with respect to the Lebesgue measure) is a strict generalization of the Riemann integral. So, anything Riemann’s integral can do, Lebesgue can do that and more. This is just the overview of the ‘main benefits’ of the Lebesgue integral with respect to Lebesgue measure, when we come at things from the perspective of ‘Riemann integral is bad with limits’.

The ”what is volume?” route:
Now, having arrived at the concept of the Lebesgue integral and measure, one can say hey the concept of Lebesgue measure can obviously be studied from a more abstract perspective. So, rather than focusing so much on the integral (a linear map which assigns to each suitable function, a number), one focuses on the measure itself. This is also a very natural starting point of investigation. This gives us measure theory. We just take some basic primitive notions as our starting point (a set, a sigma algebra so we can conveniently play around with the sets, and a measure so we can assign numbers to these sets).
This untethers us from the real line or $\Bbb{R}^n$, and allows us to ask about volumes in a more general context. And soon, we can realize that the concept of ‘measure’, while it may have initially been motivated as a generalization of ‘volume’, it is far from limited to that interpretation. Very natural things like mass/charge density all behave like (signed) measures. So, many natural things which people have always been interested in can be studied more formally, precisely, systematically and generally once measure theory is introduced. The entirety of modern probability is built on this foundation: sample spaces, probability measures etc.

Summary: Pros and the one Con of Lebesgue Integrals.
So, we now have a trifecta:

*

*measures: a vastly generalized notion of volume, and can be applied in a whole bunch of situations which previously we had to handle in an adhoc manner.

*Lebesgue integral with respect to arbitrary measures: this gives us the three famous convergence theorems

*Lebesgue function spaces defined using the Lebesgue integral: we now have complete spaces. So this first of all gives us a vast collection of examples of Banach spaces, and secondly, it means that many practical problems one might face in analysis can be reformulated in the Banach space context, where we can appeal to the spectacularly powerful theorems of functional analysis.

And, contrary to what many people might say, the concept behind Lebesgue and Riemann integrals are nearly identical. For Lebesgue, you take your simple functions, define their integral in the obvious manner, and then by taking an appropriate limit, define it for a much broader class of functions. For Riemann/Darboux integrals: partition your interval, consider upper/lower/Riemann sums, and then take a suitable limit (supremum of upper sums or infimum of lower sums). If one talks about Riemann integrals rigorously, then one necessarily has to introduce $\epsilon,\delta,\sup,\inf$ etc so in that regard the Riemann integral isn’t really that easy either.
The main technical difficulty with Lebesgue integrals on the real line is that because we’re allowing for a much larger collection of sets (Lebesgue/Borel measurable sets, which arise from a $\sigma$-algebra) we have a lot more stuff to deal with. As such, one of the main technical difficulty there lies in proving the existence of the Lebesgue measure (or more generally, it is in Caratheodory’s extension theorem). It is this bit of technicality (and also its vast generality) that (very understandably so) prevents us from introducing Lebesgue integrals first.
The Lebesgue integral (and the accompanying measure theory) is better than the Riemann integral in every mathematical regard; the only thing holding it back is that student’s usually aren’t ready for it yet. One has to understand that as a first year calculus student, they are not yet mature enough to appreciate the need for general measures, and completeness (in fact it is only after a full year of my calculus course using Spivak that I started to get glimpses of the importance of limits and completeness). This difficulty is compounded immensely by the fact that some students don’t even understand Riemann integrals (a thing whose sole purpose is to ‘add many things’): they conflate the Riemann integral with the FTC which facilitates its computation, thinking that “$\int_a^bf(x)\,dx$ is defined as $F(b)-F(a)$ where $F’(x)=f(x)$”.
A: Analysts would like to interchange the order of limits and integration as often as possible, so they want practical conditions that can tell them it is legitimate to say
$$
\lim_{n \to \infty} \int_S f_n(x)\,dx = \int_S \lim_{n \to \infty} f_n(x)\,dx,
$$
where $S$ is the domain of integration (maybe $S = [a,b]$, maybe $S$ is more complicated).  There are two issues that occur when asking if the above equation is true.
(1) Even if each $f_n$ is integrable, $\lim_{n \to \infty} f_n$ might not be integrable. (There are many notions of limit for functions: pointwise limits, uniform limits, etc., but back in the 19th century people only cared about limits that made sense as pointwise limits, even if they were also uniform limits.) A pointwise limit of continuous functions need not be continuous, a pointwise limit of piecewise continuous functions need not be piecewise continuous, and a pointwise limit of Riemann integrable functions need not be Riemann integrable. But if $f(x) = \lim_{n \to \infty} f_n(x)$ for all $x$ and each $f_n$ is measurable, then $f$ is measurable. That's fantastic! So even if a pointwise limit of continuous functions is not continuous, at least we can say it is measurable.
(2) Before measure theory was developed, the only general criterion known that justified the interchange of a limit and integral was uniform convergence, and that might be hard to verify or might not even be true in cases where we want to make that interchange. Even when all $f_n$ and their pointwise limit are Riemann integrable, it could be hard to justify that  interchange in the setting of Riemann integrals without assuming uniform convergence.  Lebesgue integration gives us powerful convergence theorems: under conditions weaker than uniform convergence that are also easy to verify in practice, the interchange of limit and integral is justified. The dominated convergence theorem is a great example of this, and it has no analogue for Riemann integration. As a concrete example, suppose each $f_n \colon [0,1] \to \mathbf [0,1]$ is continuous and $\lim_{n \to \infty} f_n(x) \to 0$ for all $x$ in $[0,1]$: does $\int_0^1 f_n(x)\,dx \to 0$? It is trivial to show the answer is "yes" using the dominated convergence theorem, but I don't know if this can be done using Riemann integrals alone (if it can, I think it is quite challenging).
