The Riemann Integral

Every calculus course draws the same picture: a curve, a shaded region, and the words "the area under the graph". Here is the question that picture quietly dodges: which functions actually have an area under them? The answer is not "all of them" — and it is not "the nice ones", either, until you say precisely what nice means. This page is where analysis draws that line, and the way it draws it is a courtroom drama.

Two adversaries testify about the area. The upper sums are the prosecution: they always overstate the case, covering the region completely and swearing "the area is at most this". The lower sums are the defence: they always understate, hiding entirely beneath the curve and insisting "the area is at least this". Neither ever lies in its own direction. If, under relentless cross-examination — finer and finer partitions — the two testimonies converge on a single number, the court accepts it: the function is integrable and that number is its integral. If prosecution and defence stay a fixed distance apart no matter how hard you press, the case collapses: the function has no Riemann integral at all.

This is how Bernhard Riemann made the definite integral rigorous in 1854, in the streamlined form Gaston Darboux gave it in 1875 — which is why the sums below are usually called Darboux sums. Chop [a, b] with a partition P = \{a = x_0 < x_1 < \dots < x_n = b\}, with widths \Delta x_i = x_i - x_{i-1}. On each subinterval record the worst case in each direction — and note it is \inf and \sup, not min and max, because a bounded function need not attain either:

m_i = \inf_{[x_{i-1}, x_i]} f, \qquad M_i = \sup_{[x_{i-1}, x_i]} f.

The lower sum stacks rectangles at the floor of f on each piece; the upper sum stacks them at the ceiling:

L(f, P) = \sum_{i=1}^{n} m_i\,\Delta x_i, \qquad U(f, P) = \sum_{i=1}^{n} M_i\,\Delta x_i.

Since m_i \le M_i on every piece, always L(f, P) \le U(f, P): whatever "the area" ought to be, it is trapped between the defence's floor and the prosecution's ceiling. Everything else on this page is about when — and whether — the trap closes.

Watch the staircases close

For f(x) = 1 + x - \tfrac14 x^2 on [0, 4], the outlined rectangles are the upper sum — each raised to its subinterval's ceiling M_i — and the filled ones are the lower sum, each dropped to the floor m_i. Drag the slider to refine the partition and watch the readout: the gap U - L is exactly the total area of the thin sleeves between the two staircases, the strip of "undecided" area hugging the curve.

Two things are worth noticing before we prove anything. First, the gap only ever shrinks as you add points — refining a partition never hurts either testimony, a fact we establish below as Step A. Second, the gap here visibly heads to 0, which is precisely because this f is continuous: on tiny subintervals a continuous function barely wiggles, so floor and ceiling nearly agree. For a wilder function the sleeves need not thin out at all — you will meet the star witness for that failure shortly.

Centrepiece: refinement, the criterion, and why continuity suffices

Step A — refining a partition raises L and lowers U

Add one new point c inside a subinterval [x_{i-1}, x_i], splitting it into a left piece [x_{i-1}, c] and a right piece [c, x_i].

A1 — the infimum can only go up on a smaller set. The inf over a sub-piece is \ge the inf over the whole, so writing m', m'' for the two pieces' infima, m' \ge m_i and m'' \ge m_i. Hence the lower sum's contribution can only increase:

m_i\,\Delta x_i = m_i(c - x_{i-1}) + m_i(x_i - c) \le m'(c - x_{i-1}) + m''(x_i - c).

A2 — symmetrically, the supremum can only go down, so the upper sum's contribution can only decrease. Since any refinement is reached by adding points one at a time, induction gives

L(f, P) \le L(f, P') \quad\text{and}\quad U(f, P') \le U(f, P) \qquad (P' \text{ a refinement of } P).

A3 — every lower sum is below every upper sum. Given any two partitions P_1, P_2 — even totally unrelated ones — refine to their common refinement P_1 \cup P_2 and chain the inequalities:

L(f, P_1) \le L(f, P_1 \cup P_2) \le U(f, P_1 \cup P_2) \le U(f, P_2).

So the entire set of lower sums sits below the entire set of upper sums: no defence estimate ever exceeds any prosecution estimate. The two sets then have a clean gate between them.

Step B — the definition: \sup L = \inf U

Define the lower integral and upper integral by taking the best testimony from each side — and note that both exist for any bounded f, by the completeness of \mathbb{R}, since A3 makes each set bounded by the other:

\underline{\int_a^b} f = \sup_P L(f, P), \qquad \overline{\int_a^b} f = \inf_P U(f, P).

By Step A3 always \underline{\int} f \le \overline{\int} f. We call f Riemann integrable exactly when these agree, and then their common value is the integral:

\underline{\int_a^b} f = \overline{\int_a^b} f =: \int_a^b f.

Cauchy criterion (the practical test). Squeezing the two integrals together is the same as making a single upper–lower gap small: if U(f,P) - L(f,P) < \varepsilon, then the two integrals — trapped between L(f,P) and U(f,P) — differ by less than \varepsilon too. So f is integrable iff for every \varepsilon > 0 there is a partition P with

U(f, P) - L(f, P) = \sum_{i=1}^{n} (M_i - m_i)\,\Delta x_i < \varepsilon.

This single inequality is the workhorse of the whole subject: to prove a function integrable you never need to find the integral — you only need to exhibit, for each \varepsilon, one partition whose sleeves have total area under \varepsilon.

Step C — a continuous f on [a,b] is integrable

C1 — upgrade continuity to uniform continuity. By Heine–Cantor, a function continuous on the closed bounded interval [a, b] is uniformly continuous: given \varepsilon > 0, there is one \delta > 0 with |x - y| < \delta \Rightarrow |f(x) - f(y)| < \dfrac{\varepsilon}{b - a}.

C2 — pick a fine enough partition. Choose P with every \Delta x_i < \delta. On each subinterval the oscillation is small: because f is continuous it attains its max and min there (EVT), at points no more than \delta apart, so

M_i - m_i = f(\text{argmax}) - f(\text{argmin}) < \frac{\varepsilon}{b - a}.

C3 — assemble the Cauchy gap. Sum the oscillations against the widths:

U(f, P) - L(f, P) = \sum_i (M_i - m_i)\,\Delta x_i < \frac{\varepsilon}{b - a} \sum_i \Delta x_i = \frac{\varepsilon}{b - a}\,(b - a) = \varepsilon.

The Cauchy criterion is met for every \varepsilon, so a continuous function on [a, b] is Riemann integrable. Uniform continuity is precisely the lever: it makes the oscillations M_i - m_i small everywhere at once, which is what lets one \delta tame every subinterval simultaneously.

Let f be bounded on [a, b]. Then:

Riemann's own 1854 definition uses tagged sums: pick any sample point t_i \in [x_{i-1}, x_i] in each piece and form \sum f(t_i)\,\Delta x_i; the integral is I if every tagged sum lands within \varepsilon of I once the mesh \max_i \Delta x_i is small enough. Darboux's inf/sup version looks different but is equivalent: since m_i \le f(t_i) \le M_i, every tagged sum is sandwiched between L(f,P) and U(f,P) — and by choosing tags near the infima or suprema you can push a tagged sum arbitrarily close to either bound. So the tagged sums are pinned iff the Darboux sums pinch. Analysts prove things with Darboux's version (no quantifier over tags, and refinement is monotone); numerical folk compute with Riemann's. Same integral, two costumes.

Three trials from the definition

Trial 1 — f(x) = x on [0,1]: the full ritual, once in your life

Everyone should integrate one function straight from the definition, with no fundamental theorem, no antiderivatives — just partitions. Take the uniform partition P_n = \{0, \tfrac1n, \tfrac2n, \dots, 1\}, so x_i = \tfrac{i}{n} and every \Delta x_i = \tfrac1n. Since f(x) = x is increasing, on [x_{i-1}, x_i] the floor is the left endpoint and the ceiling is the right one:

m_i = \frac{i-1}{n}, \qquad M_i = \frac{i}{n}.

Now sum, using 1 + 2 + \dots + n = \tfrac{n(n+1)}{2}:

L(f, P_n) = \sum_{i=1}^{n} \frac{i-1}{n}\cdot\frac1n = \frac{1}{n^2}\cdot\frac{(n-1)n}{2} = \frac{n-1}{2n}, \qquad U(f, P_n) = \frac{1}{n^2}\cdot\frac{n(n+1)}{2} = \frac{n+1}{2n}.

The gap is U(f,P_n) - L(f,P_n) = \tfrac1n, which drops below any \varepsilon once n > 1/\varepsilon — the Cauchy criterion holds, so f is integrable. And since \tfrac{n-1}{2n} \le \underline{\int} \le \overline{\int} \le \tfrac{n+1}{2n} for every n, with both ends converging to \tfrac12, the squeeze forces

\int_0^1 x\,dx = \frac12.

The area of a triangle, recovered by pure order-theoretic bookkeeping. Notice the division of labour: the criterion proved existence, and the squeeze identified the value.

Trial 2 — the Dirichlet function: the clean villain

Now the case for the prosecution never closing. Consider Dirichlet's indicator of the rationals on [0, 1]:

\mathbf{1}_{\mathbb{Q}}(x) = \begin{cases} 1, & x \in \mathbb{Q}, \\ 0, & x \notin \mathbb{Q}. \end{cases}

Every subinterval, however microscopically thin, contains both a rational and an irrational — both sets are dense in \mathbb{R}. So on each piece of every partition, m_i = 0 and M_i = 1, giving

L(f, P) = 0 \;\text{ for all } P, \qquad U(f, P) = 1 \;\text{ for all } P.

Refinement, the tool that saved us in Trial 1, is powerless: the defence is stuck at 0, the prosecution at 1, forever. Hence \underline{\int} = 0 \ne 1 = \overline{\int}, and \mathbf{1}_{\mathbb{Q}} is not Riemann integrable. This is not a pathology for its own sake — it is the sharpest possible demonstration that "bounded" is nowhere near enough, and it marks the exact spot where a bigger theory will one day break through the wall.

Trial 3 — a step function: the criterion earns its keep

Between the saint and the villain, a discontinuous function that is nonetheless innocent. On [0, 2] let

f(x) = \begin{cases} 0, & 0 \le x < 1, \\ 1, & 1 \le x \le 2. \end{cases}

f jumps at x = 1, so the continuity theorem says nothing. But the Cauchy criterion only asks for one good partition per \varepsilon — so build one that quarantines the jump. Given \varepsilon > 0, pick \delta < \varepsilon (with \delta < 1) and take P = \{0,\; 1 - \delta,\; 1,\; 2\}. Then:

U(f,P) - L(f,P) = 0 + (1 - 0)\cdot\delta + 0 = \delta < \varepsilon.

Integrable — and the same quarantine trick, one thin box per jump, handles any finite number of jump discontinuities. It also powers the proof that every monotone function is integrable: for increasing f on the uniform n-piece partition, m_i = f(x_{i-1}) and M_i = f(x_i), so the gap telescopes:

U - L = \sum_{i=1}^{n} \bigl(f(x_i) - f(x_{i-1})\bigr)\,\frac{b-a}{n} = \bigl(f(b) - f(a)\bigr)\,\frac{b-a}{n} \;\longrightarrow\; 0.

Remarkable: a monotone function can have a jump at every rational — countably many discontinuities — and still be integrable, no continuity used anywhere.

Three standard traps around integrability:

Exactly this discontinuous, said Henri Lebesgue in 1902, closing the case Riemann opened: a bounded f on [a,b] is Riemann integrable iff its set of discontinuities has measure zero — i.e. can be covered by countably many intervals of arbitrarily small total length. Finite sets, and even countable sets like \mathbb{Q}, have measure zero; a full interval does not. The verdicts all line up: continuous functions (no discontinuities) pass, step and monotone functions (at most countably many) pass, and Dirichlet's function — discontinuous everywhere, a full-measure set — fails.

The strangest witness: Thomae's "popcorn" function, which is 1/q at each rational p/q in lowest terms and 0 at each irrational. It is discontinuous at every rational — infinitely many points, densely packed — yet continuous at every irrational, so its discontinuity set is countable, measure zero, and it is Riemann integrable (with integral 0). Discontinuous on a dense set, and the integral doesn't blink.

Lebesgue himself explained his own upgrade with a shopkeeper's image: to total a pile of coins, Riemann counts them in the order they sit on the counter — pocket by pocket, left to right along the domain — while Lebesgue first sorts them by value, then counts each denomination: "I have a certain sum in my pocket; I can count it either way." Sorting the range instead of slicing the domain is precisely what lets his integral handle \mathbf{1}_{\mathbb{Q}} (answer: 0, since the rationals have measure zero) — the twentieth-century sequel to this page.

See it explained