1Q is 1 on the rationals and 0 on the irrationals of [0,1] — every subinterval holds both, so the upper sum is always 1 and the lower sum always 0. The canonical non-Riemann-integrable function: no refinement closes the gap.
U(f,P)=1,L(f,P)=0∀P
f=1Q
Examples & Exercises
Let f=1Q be the Dirichlet function on [0,1]. Using that every subinterval of [0,1] contains a rational, prove completely that U(f,P)=1 for every partition P.
U(f,P)=i=1∑nMiΔxi=1∀P
n=8: all 8 subintervals carry an upper rectangle (light red, height 1) — U(f,P8)=8⋅81=1.Show proof
First, density of Q: if u<v then (u,v) contains a rational. Pick N∈N with N1<v−u (Archimedean property) and set m=⌊Nu⌋+1; then Nm−u=N⌊Nu⌋+1−Nu≤N1<v−u, so u<Nm<v.
Take a partition P={x0<x1<⋯<xn}. Each subinterval [xi−1,xi] contains a rational ri by the above, so Mi=sup[xi−1,xi]f≥f(ri)=1. But f≤1 always, so Mi=1.
Hence U(f,P)=∑i=1nMiΔxi=∑i=1n1⋅(xi−xi−1)=xn−x0=1. However the partition is chosen, the upper sum is always 1 — the red dots (rationals) sit in every interval.
Using that every subinterval of [0,1] contains an irrational, prove completely that L(f,P)=0 for every partition P.
L(f,P)=i=1∑nmiΔxi=0∀P
n=8: the lower bars (blue) draw as thin zero-height lines — L(f,P8)=8⋅0=0.Show proof
Irrationals are dense too: if u<v then (u,v) contains an irrational. Density of Q gives a rational q in (u−2,v−2), and then q+2 is an irrational in (u,v) (since 2 is irrational, rational + irrational is irrational).
For a partition P={x0<⋯<xn}, each subinterval [xi−1,xi] contains an irrational si, so mi=inf[xi−1,xi]f≤f(si)=0. Since f≥0, mi=0.
Hence L(f,P)=∑i=1n0⋅Δxi=0. Together with the previous problem, U(f,P)−L(f,P)=1 for every partition — the gap never closes, so f is not Riemann integrable.
Prove completely, using sequences, that the Dirichlet function f=1Q is discontinuous at every point of [0,1].
rk→x,f(rk)=1sk→x,f(sk)=0
n=8: red dots (rationals, f=1) alternate with the gaps between them (irrationals, f=0) in every interval — at no point do the nearby function values settle on one number.Show proof
Fix any x∈[0,1]. By density of rationals and irrationals, for each k≥1 we can pick a rational rk and an irrational sk in (x−k1,x+k1)∩[0,1]. Since ∣rk−x∣<k1 and ∣sk−x∣<k1, we have rk→x and sk→x.
But f(rk)=1, so f(rk)→1, and f(sk)=0, so f(sk)→0. If f were continuous at x, sequential continuity would force both limits to equal f(x) — impossible since 1=0.
Hence f is discontinuous at every point of [0,1] — "too discontinuous" for the Riemann integral. The Lebesgue integral instead uses that the rationals have measure 0 to get ∫f=0 (see the Lebesgue scene).