← Back to Paradoxes

The Devil's Staircase

A function that rises from 0 to 1 while being flat almost everywhere

The Cantor Function

6
99.9%
Flat Segments
0.1%
Rising Segments
1
Total Rise

The Paradox

How can a flat function rise?

At every iteration, the function is constant on more and more intervals.

In the limit: derivative = 0 on a set of measure 1 (almost everywhere).

Yet the function still increases from f(0) = 0 to f(1) = 1!

All the "rising" happens on the Cantor set — a set of measure zero.

The Cantor Set

Cantor Set

0
Measure (length)

Removed Gaps

1
Measure (length)

Uncountably many points... with zero total length!

Construction: Removing Middle Thirds

Step 0
Start with [0, 1]
Step 1
Remove (1/3, 2/3)
Step 2
Remove middle thirds
Step 3
Continue...
Step ∞
Cantor set

At each step, we remove 1/3 of what remains. Total removed: 1/3 + 2/9 + 4/27 + ... = 1

Remarkable Properties

  • Continuous everywhere — no jumps or breaks
  • Monotonically increasing — never goes down
  • Derivative = 0 almost everywhere — flat on measure 1
  • Not absolutely continuous — breaks FTC!
  • Total variation = 1 — concentrated on measure 0
  • Arc length = 2 — not the diagonal!

Breaks the Fundamental Theorem

Normally: if f'(x) = 0 for all x, then f is constant.

But the Devil's Staircase has f'(x) = 0 almost everywhere, yet is NOT constant!

The Fundamental Theorem of Calculus requires f' to be defined everywhere, not just almost everywhere.

The Mathematics

Explicit Construction

For x ∈ [0, 1], write x in base 3:

x = 0.d₁d₂d₃... (ternary)

Find the first digit 1, replace it with 2, and delete everything after:

x = 0.d₁...dₖ2... → 0.d₁...dₖ1

Replace all 2's with 1's, interpret in base 2:

f(x) = 0.b₁b₂b₃... (binary)

Measure Theory

Cantor set measure:

μ(C) = 1 - Σ(2/3)ⁿ⁻¹ · (1/3)ⁿ = 1 - 1 = 0

Yet it has the cardinality of the continuum:

|C| = |ℝ| = 2^ℵ₀

The Cantor set is an example of an uncountable set with measure zero.

History & Applications

1883: Georg Cantor introduces the Cantor set while studying trigonometric series.

1884: Cantor defines the function now called the "Devil's Staircase" — Scheeffer identifies it as a counterexample to extensions of the Fundamental Theorem of Calculus.

1904: Lebesgue's measure theory provides the framework to understand why this function is so strange.

Today: The Devil's Staircase appears in physics (phase transitions, quasicrystals), dynamical systems (mode-locking), and probability theory (singular distributions).

The Deep Insight

The Devil's Staircase shows that "almost everywhere" isn't everything.

A set of measure zero can still carry all the action — all the increase, all the variation, all the structure.

This is why modern analysis requires careful attention to null sets and singular measures.

First described by Georg Cantor (1884). See also: Math Fun Facts.