The popcorn function f(p/q)=1/q (reduced), f(x)=0 (irrational): continuous at every irrational, discontinuous at every rational. Given ε, only finitely many dots reach height ε — so near an irrational a δ can always be found.
f(x)={1/q0x=p/q in lowest termsx∈/Q
{x:f(x)≥ε}={p/q:q≤1/ε} finite
Examples & Exercises
Prove completely that Thomae's function f (f(p/q)=1/q in lowest terms, f=0 at irrationals) is discontinuous at every rational x0.
x0=qp(lowest terms)⇒f(x0)=q1>0,ε=2q1
View centered at the rational x0=1/2: f(1/2)=1/2, yet irrationals with f=0 sit arbitrarily close, so no δ works for ε=1/4.Show proof
Write x0=p/q in lowest terms, so f(x0)=1/q>0. Set ε=1/(2q)>0. By density of the irrationals, for every δ>0 the interval (x0−δ,x0+δ) contains an irrational x.
At an irrational x, f(x)=0, so ∣f(x)−f(x0)∣=1/q>1/(2q)=ε. That is, for every δ>0 there is an x with ∣x−x0∣<δ but ∣f(x)−f(x0)∣≥ε; by the ε-δ definition, f is not continuous at x0.
Since x0 was an arbitrary rational, Thomae's function is discontinuous at every rational. In the scene, centering on a rational (e.g. 1/2) gives δ=0, exhibiting this argument directly.
Prove completely, by an ε-δ argument, that Thomae's function is continuous at every irrational x0.
Sε={x∈[0,1]:f(x)≥ε}={qp:q≤ε1}finite
View centered at the irrational x0≈0.618: only finitely many dots (those with q≤10) reach height ε=0.1, and δ is the distance to the nearest one.Show proof
Let x0 be irrational and ε>0 arbitrary. Consider Sε={x∈[0,1]:f(x)≥ε}. By the definition of f, members of Sε are only lowest-terms fractions p/q with 1/q≥ε, i.e. q≤1/ε; hence Sε is a finite set.
Since x0 is irrational, x0∈/Sε. Thus δ=minx∈Sε∣x−x0∣, the minimum of finitely many positive numbers, is strictly positive. If ∣x−x0∣<δ then x is at distance at least δ from every member of Sε, so x∈/Sε — i.e. f(x)<ε (for x=x0 this is trivial since f(x0)=0<ε).
Since ∣f(x)−f(x0)∣=∣f(x)−0∣=f(x)<ε, f is continuous at x0. As x0 was an arbitrary irrational, Thomae's function is continuous at every irrational — the δ shown in the scene is exactly this minimum.
Show that Thomae's function is a pointwise limit of continuous functions — i.e. prove completely that it is of Baire class 1.
Q=30, ε=0.05: a pointwise limit of continuous tent functions draws these popcorn dots — a Baire-1 function must have a dense set of continuity points, and Thomae's is the irrationals (a dense Gδ).Show proof
For each n≥1 let Sn={p/q:1≤q≤n,gcd(p,q)=1} (a finite set) and define fn(x)=maxr∈Snmax(0,1/q(r)−n∣x−r∣), where q(r) is the denominator of r=p/q. Each tent x↦max(0,1/q−n∣x−r∣) is continuous, and a finite maximum of continuous functions is continuous, so each fn is continuous.
Let x=a/b in lowest terms. For n≥b, the tent at r=x itself gives the value 1/b, while for any other r′=p/q=x with q≤n we have ∣x−r′∣≥1/(bq) (distinct rationals with denominators b,q differ by at least 1/(bq)), so n∣x−r′∣≥n/(bq)≥1/q — the tent value is 0. Hence fn(x)=1/b=f(x) for n≥b.
If x is irrational, f(x)=0. Fix M≥1: tents with denominator q≤M all vanish for large n (there are only finitely many rationals with denominator ≤M, each at positive distance from the irrational x), and tents with q>M are worth at most 1/q<1/M. Hence limsupn→∞fn(x)≤1/M; since M is arbitrary, fn(x)→0=f(x). So fn→f at every x: Thomae's function is Baire class 1.