The Hilbert Curve
The Paradox
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
At each iteration, points increase by 4×. At n=∞, the curve visits uncountably many points.
History & Modern Applications
(same cardinality!)
first space-filler
simpler, visual
closed loop version
for databases
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.