Visualizing Cantor’s Zig Zag

Published by MrHonner on

A famous and intriguing result in mathematics is that there are just as many points on a line as there are in a plane. This seems counterintuitive at first: planes contain infinitely many lines, so not only should a plane have infinitely many more points than a line, it should have infinitely times as many points as a line! But this is one of the many curious consequences of the mathematics of infinity.

Here, we’ll restrict ourselves to points in the plane with non-negative integer coordinates. Think about points of the form ( c), where c is a non-negative integer. Since there are infinitely many integers, this set of points is infinite, and the points all lie on the line y = 0. The set of points of the form ( c, ) is also infinite, and these points all lie on the line = 1. Notice that, since these two lines are parallel, every point on one matches up perfectly with a point on the other: (0,0) with (0,1); (1,0) with (1,1); (2,0) with (2,1), and so on.

This matching offers a reasonable argument that the two sets have the same number of points: Every point in each set has a unique partner in the other, so counting the points in one is equivalent to counting the points in the other. In this case, we say that the two sets are in one-to-one correspondence. And if anything, this only seems to bolster the argument that there are more points in the plane than on a line: There are infinitely many lines of the form y = k in the plane, and each one contains as many points as the line = 0. So the plane should contain infinitely times as many points as the line! But the mathematics of infinity is tricky business.

Even though it seems like there are far more points in the plane than on the line, it’s possible to match the two sets up in a one-to-one correspondence. It’s not obvious how to do that, but thanks to Georg Cantor and his famous zig zag, we know it can be done. Here’s a visualization I created in Desmos to demonstrate this matching.

This animation shows how each point in the quarter-plane can be paired up with exactly one point on the half-line, and vice versa. The zig-zag pattern enumerates the points in the plane, showing that they could be rightly imagined as though all lying in order on a straight line. This one-to-one correspondence shows that the sets are the same size. And while this demonstration is limited to only part of the plane, the argument can be extended: for example, skipping every other point on the line y = 0 would create space to accommodate the points with negative y-coordinates.

The animation above is an extension of an earlier version shared on Twitter.

Thanks to Chris Long (@octonion) for inspiring this journey into the infinite by linking to this great paper on Cantor packing polynomials, which I used to create the above Desmos demonstrations. And Kelsey Houston-Edwards also recently shared a fun and related problem. I guess infinity is in the air!

Related Posts


1 Comment

Michael Pershan · May 28, 2018 at 9:31 pm

Really cool — thanks for sharing!

Leave a Reply

Your email address will not be published. Required fields are marked *


Get every new post delivered to your Inbox

Join other followers: