Stop me if you’ve heard this one. Want to see a picture of a space-filling curve? Here you go!

It’s a real knee-slapper! A space-filling curve is basically what it sounds like: a line that gets squiggled around and bent until it fills a 2-dimensional region, in this case a square. (There are 3-dimensional space-filling curves as well, and 4-dimensional and so on. A line can fill as much space as you give it!)

Space-filling curves are not very illuminating in their complete form. What can you learn from a solid black square? Instead, like other fractals, we generally imagine space-filling curves as an infinite version of a finite construction.

There are several ways to make a space-filling curve using an iterative process. Here’s one in animated form.

At every stage, each line segment is replaced by a figure consisting of four line segments. None of the intermediate curves are space-filling, but if we imagine continuing the process forever, that infinite version is our space-filling curve.

Space-filling curves challenge my intuition dimension. A space-filling curve is the image of a line, a fundamentally 1-dimensional object, that fills a plane, a fundamentally 2-dimensional object. It feels like a well-behaved function shouldn’t be able to turn something 1-dimensional into something 2-dimensional. It’s comforting to me that it only works at infinity, but it’s still a bit unsettling.

(If you’re in a topology class, you should be very nervous. The line and the plane are not topologically equivalent, but a space-filling curve is a continuous function that takes a line to a plane. What’s the matter with it? Have we broken all of mathematics?!)

It’s hard to imagine that something as abstract as an infinitely kinked line could possibly have any relevance to the real world, but the fact that space-filling curves take something 1-dimensional to something 2- or more-dimensional has practical applications in data processing. In this excellent video, Grant Sanderson explains how the Hilbert curve, one example of a space-filling curve, helps us find an optimal way to convert, say, the 2-dimensional visual data of an image into 1-dimensional sound data.

If you want to play along at home, there are lots of ways to make your own space-filling curves. If you want to be cheeky, just start coloring in some squares. If you’re more interested in pondering the infinite iterative process of making the curve, Vi Hart is your guide to drawing dragon curves, and Andrea Hawksley, inspired by Kyle Calderhead, will help you crochet your own Hilbert curve afghan.

As for me, I found my space-filling curve zen in Patterns of the Universe, a math-themed coloring book by Alex Bellos and Edmund Harriss. There are two space-filling curve pages in their book. One is the feature image on this post, and one is the connect-the-dots below.

I spent the first part of the week yelling at people for their bad arguments about math education, and coloring in a flowsnake was the perfect soothing antidote.