Hilbert's Curve: Is infinite math useful?
Based on 3Blue1Brown's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.
Stable perception across resolution upgrades requires a mapping where nearby positions in 1D correspond to nearby locations in 2D.
Briefing
Hilbert’s curve earns its keep by solving a practical mapping problem: turning a 2D image grid into a 1D sequence of frequencies in a way that stays stable as resolution increases. That stability matters because a naive “snake” ordering forces many pixel-to-frequency associations to jump around when the camera resolution changes—effectively resetting users’ learned intuition. A Hilbert-curve-style ordering, built from increasingly fine “pseudo-Hilbert” patterns, keeps each point on the frequency line moving less and less, so upgrades refine perception rather than break it.
The setup starts with a sound-to-sight thought experiment. Software takes low-resolution images (like 256×256 pixels), assigns each pixel a unique frequency, and plays louder tones for brighter pixels. If the mapping from pixel space (2D) to frequency space (1D) is arbitrary, the result is chaotic. The key design goal is continuity in a human sense: nearby frequencies should correspond to nearby locations in the image, so that small hearing errors don’t scatter the meaning across the grid.
A “snake curve” achieves this by weaving through pixels row by row, but it has a fatal upgrade problem. When the grid doubles to 512×512, the same position along the frequency line can land in a very different place in the image—especially in the left-right direction—so users would have to relearn which tones correspond to which spatial features. The pseudo-Hilbert construction fixes that by recursively subdividing the square. At order one, the curve connects quadrant centers in a specific pattern. At order two, each quadrant contains a smaller order-one curve, with lower-left and lower-right pieces flipped to avoid awkward discontinuous jumps. Higher orders repeat the idea: subdivide, place smaller curves, flip where needed, and connect tip to tail.
For a 256×256 grid, the relevant order is eight; increasing resolution corresponds to increasing the order. The crucial property is that as the order grows, a fixed point along the curve approaches a specific location in the square rather than wandering erratically. In the finite, pixelated setting, pseudo-Hilbert curves approximate this behavior; in the continuous setting, the true Hilbert curve is defined as the limit of these approximations.
That infinite origin traces back to late-19th-century work on space-filling curves. After Peano’s first discovery in 1890, Hilbert produced a simpler curve in 1891. The goal was counterintuitive: construct a line-like object with zero area that nevertheless passes through every point of a 2D region. The modern definition hinges on continuity and on the convergence of the pseudo-Hilbert mappings for each input value between 0 and 1. Once the limit exists, the resulting function can be shown to be continuous and to fill the unit square.
The broader takeaway is philosophical but grounded in math: patterns developed to handle infinite objects often have finite analogs that become directly useful. Stability under refinement in the Hilbert construction mirrors the formal notion of limits, and similar correspondences appear elsewhere—such as how binary representations relate to infinite series of powers of 2. The practical lesson is to look beneath the surface of “infinite” results; the same machinery that proves them can often power finite tools people can actually use.
Cornell Notes
Hilbert’s curve provides a stable way to map a 1D parameter (like a position along a frequency line) onto a 2D space (like an image grid). In a sound-to-sight scenario, a snake-like pixel ordering would force many associations to jump when camera resolution increases, breaking users’ learned intuition. Pseudo-Hilbert curves avoid that by recursively subdividing the square and flipping sub-curves so that points on the curve move less and less as the order increases. The true Hilbert curve is defined as the limit of these pseudo-Hilbert approximations, relying on continuity and convergence for every input in [0,1]. This infinite construction traces back to Peano and Hilbert’s late-1800s quest to build space-filling curves that pass through every point of a region.
Why does mapping pixels to frequencies become tricky when moving from 2D to 1D?
What goes wrong with a “snake curve” when camera resolution increases?
How do pseudo-Hilbert curves improve stability across resolution upgrades?
What makes the true Hilbert curve different from pseudo-Hilbert curves?
What late-19th-century problem motivated Hilbert’s space-filling curve work?
Review Questions
- In the sound-to-sight mapping, what property of the pixel-to-frequency association prevents users from needing to relearn after resolution changes?
- Describe how pseudo-Hilbert curves are constructed at order two, including what gets flipped and why.
- What three properties must be proved to justify defining the Hilbert curve as a limit of pseudo-Hilbert curves?
Key Points
- 1
Stable perception across resolution upgrades requires a mapping where nearby positions in 1D correspond to nearby locations in 2D.
- 2
A snake-style traversal fails because doubling resolution can relocate the left-right position associated with the same point along the frequency line.
- 3
Pseudo-Hilbert curves use recursive subdivision and targeted flipping of sub-curves to keep connections short and neighborhood relationships intact.
- 4
The true Hilbert curve is defined as the limit of pseudo-Hilbert curves, relying on convergence for every input in [0,1].
- 5
Continuity is essential to treat the mapping as a “curve” rather than an arbitrary association between numbers and coordinates.
- 6
Space-filling curve research grew from the late-1800s effort to map a 1D line through every point of a 2D region despite the curve having zero area.
- 7
Infinite constructions often have finite analogs: the same limit/stability ideas that define infinite objects can guide practical finite designs.