← Back to Paradoxes

The Space-Filling Curve Paradox

A one-dimensional line that passes through every point in two-dimensional space

The Hilbert Curve

Hilbert
Peano
Moore
Gosper
4
0
Line Segments
0
Total Length
0%
Square Coverage

The Paradox

1D Line
2D Square

How can a line fill a square?

A curve is parameterized by a single number t ∈ [0, 1].

Yet the Hilbert curve passes through every single point in the unit square!

As recursion depth → ∞, the curve visits all (infinitely many) points in 2D space.

1D → 2D Mapping

Move your mouse over the line to see where that point maps in 2D:

The Mathematical Shock

In 1890, Giuseppe Peano proved that a continuous curve could pass through every point of a square. This was scandalous!

Mathematicians had assumed that a 1D object could never "fill" 2D space. Peano showed their intuition was wrong.

The curve is:

  • Continuous — no jumps or breaks
  • Surjective — hits every point in the square
  • Nowhere differentiable — infinitely "crinkly"
  • Self-intersecting — must cross itself (not 1-to-1)

Construction: Watch Dimensions Blur

n=1 (4 pts)
n=2 (16 pts)
n=3 (64 pts)
n=4 (256 pts)
n=5 (1024 pts)
n=6 (4096 pts)

At each iteration, points increase by 4×. At n=∞, the curve visits uncountably many points.

History & Modern Applications

1878
Cantor shows |ℝ| = |ℝ²|
(same cardinality!)
1890
Peano's curve:
first space-filler
1891
Hilbert's variant:
simpler, visual
1904
Moore curve:
closed loop version
1966
Morton code (Z-order)
for databases
Today
Used in image processing,
parallel computing, maps

Why This Matters

Databases: Google's S2 Geometry library uses Hilbert curves to index geographic data. Nearby points in 2D remain nearby on the 1D curve!

Image Processing: JPEG2000 uses space-filling curves for cache-efficient image traversal.

Parallel Computing: Load balancing across processors uses Hilbert curves to keep related work together.

Dithering: Ordered dithering patterns follow space-filling curves for visual uniformity.

The Deep Insight

Space-filling curves prove that dimension is stranger than it seems. A single coordinate can specify any point in any dimensional space—if you're willing to accept a continuous but non-smooth mapping.

This challenges our intuition that "2D requires 2 numbers" and laid groundwork for fractal geometry, where dimension can be fractional.

First described by Giuseppe Peano (1890) and David Hilbert (1891).