math, science

Life in Hyperbolic Space 1: Primer

It’s rare that weird, brain-bending ideas and video games meet, but in my experience, when they do, it’s pretty glorious. Portal, Prey, Antichamber, The Stanley Parable, and SUPERHOT are examples I’ve played personally. Also Miegakure (if it ever comes out, grumble grumble) will probably land instantly in that category, being a 4D puzzle game. But my most recent weird-game obsession has been HyperRogue. HyperRogue is awesome. Like Dwarf Fortress, it’s got a bit of a retro look with clean, minimalist graphics. And like Dwarf Fortress, it’s pretty obvious that a lot of love has gone into it. Here’s what the game looks like:


Like many roguelikes (modeled after the ancient ASCII game Rogue), it’s played on a sort of chessboard. It looks at first glance like one of those board wargame or D&D-type hexagonal chessboards, but instead of being just hexagons, it’s got heptagons (7-sided polygons) too. You know what? That reminds me of the description of another geometric object:

Truncated Icosahedron

(Screenshot from the awesome polyhedron program polyHédronisme)

That is a truncated icosahedron, but I’d wager that most people know it better as either A) a soccer ball/football, or B) a molecule of C60: a fullerene, a buckyball.

Don’t worry. It’ll be clear in a moment what the hell I’m going on about. You see, HyperRogue takes place in the hyperbolic plane. A flat piece of paper is a Euclidean plane. The surface of a globe (or the Earth, or a buckyball) is a sphere. The hyperbolic plane is the third brother in the trio, so to speak, and it’s the weird brother. Their relationship makes more sense to me if I think in terms of polygons. Here’s another picture:


(From the Wikimedia commons.)

The Euclidean plane (the hexagonal tiling above) consists of hexagons, each of which is bordered by six hexagons. The buckyball (football/soccer ball) farther above, representing spherical geometry, consists of pentagons, each of which is bordered by five hexagons. And at the very top of the page, the world of HyperRogue, representing the hyperbolic plane, consists of heptagons (7-sided polygons), each of which is bordered by seven hexagons. The hyperbolic plane is what would happen if you tried to sew up a soccer ball using heptagonal and hexagonal pieces of leather, rather than the usual pentagonal and hexagonal ones. Here’s what that looks like:


(From the page of Frank Sotille, who has awesome templates so you can make your own hyperbolic football. I would’ve done it myself, but all of my Scotch tape has vanished.)

The only buckyball-type tiling that lays flat is the one with hexagons surrounded by hexagons. Pentagons surrounded by hexagons curves into a sphere, and heptagons surrounded by hexagons curls up into what HyperRogue’s creator calls a hypersian rug.

But here’s a more intuitive (though less precise) way to understand the hyperbolic plane. Consider the flat Euclidean plane. Pick a point. Draw a circle centered on that point. Measure the circumference of that circle. Draw another circle with the same center, but twice the radius. Measure the circumference of that circle. The farther you get from your starting point, the larger the circumference, but the increase is very predictable and linear. As a matter of fact, the circumference (the “amount of space”) you cover as you increase the radius of your circle increases exactly like this:

save (1)(1)

(Graphed with

Now do the same thing on a sphere: centered on the north pole, draw a very small circle with a given radius (with the radius measured across the curved surface of the sphere, not straight from point to point). Draw another circle with twice the radius. Up until you hit the equator, the circumference will increase, but eventually it maxes out and goes back down:

save (3)

(Circumference in the Euclidean plane in black, circumference on the sphere in red)

There’s another important effect to consider here: the sphere’s radius matters. That plot assumed a sphere of radius 1. Here’s what it would look like with a sphere of radius 2:

save (2)

It doesn’t make much sense to ask for the “scale” or “radius” of the Euclidean plane, because the answer is “infinity.” Any Euclidean plane is indistinguishable from any other, no matter how you swell or shrink it. Spheres, though, are distinguished by their radii: each has an inherent positive curvature.

Of course, on a sphere, the largest circle you can draw has a radius (measured across the surface of the sphere) of ½πR. the circumference of that circle lies right on the sphere’s equator. After that, the circumference decreases as the radius increases, because your circle’s shrinking as it approaches the opposite pole. It reaches zero when the radius is πR, and your radius-line stretches from one pole to the other.

The Euclidean plane has zero curvature. The sphere has positive curvature. The hyperbolic plane has negative curvature. The “radius” of a hyperbolic plane is defined as 1 / sqrt(-K), where K is a measurement called “Gaussian curvature.” (For comparison, the Gaussian curvature of a sphere is 1/(R²) ). K is the thing that’s zero for the plane, positive for the sphere, and negative for the hyperbolic plane. For a hyperbolic plane of K = -1, with a “radius” of 1, the circumference increases like this:

save (1)

(Hyperbolic circumference is the green line. The red line for a sphere with R = 1 (K=1) is included for comparison.)

That’s the weird thing about hyperbolic geometry: a sphere of infinite radius behaves exactly like the Euclidean plane (it is the Euclidean plane). But as the radius shrinks, the sphere contains less and less space (so to speak). To put it another way: if you were knitting a Euclidean plane (which people do, because mathematical knitting is a thing, which is awesome), then you’d need to knit in twice as much thread at radius 2 than you’d needed at radius 1. To knit a sphere, you’d need to knit less than twice as much thread in at twice the radius. And to knit a hyperbolic plane, you’d need to knit in more than twice as much yarn at twice the radius (according to the formula 2 * pi * R * sinh(r/R), where R = 1/sqrt(-K), and r is the radius measured through the plane; the equivalent relation for the sphere is 2 * pi * R * sin(r/R)). Where the Euclidean knit would give you a flat circular rug, and the spherical knit would give you a hacky-sack ball, the hyperbolic knit would give you something like this:


(Knitted by Daina Taimina, exhibited on the website of the Institute for Figuring.)

But the weird thing is that you can still do almost exactly the same geometry on the hyperbolic plane that you can do in the Euclidean plane. In fact, that’s why hyperbolic geometry is interesting: apart from a couple of weird quirks, it behaves just like a plane. That means you can make rigorous, valid, geometric proofs in the hyperbolic plane.

The Euclidean plane gets its name from Euclid of Alexandria, who is responsible for the infinite misery of people (like me) who just couldn’t get along with high-school geometry. But he condensed many centuries of Greek (and other) geometry into a set of postulates (axioms) from which you can prove pretty much anything that’s true in geometry. Here they are:

  1. You can draw a straight line between any two points.
  2. You can extend an existing straight line as far as you like.
  3. Using a compass, you can draw a circle with any center and any radius you want.
  4. All right angles are the same.
  5. If you’ve got two lines running alongside each other and another line running through both of those, and the angles on the insides of the intersections add up to less than a right angle, then the lines will intersect if you extend them far enough, and they’ll intersect on the side where the angle-sum is less than two right angles.

That last one, called the parallel postulate was a thorn in geometry’s side for a long time, because it seems a lot less elegant than the others, and it seems like the kind of thing you might be able to prove from the other axioms, which would mean it’s not an axiom, since axioms are your starting rules and theorems are what you prove using them. A less messy way to write the parallel postulate is:

5. Given any straight line, and given a point which doesn’t lie on that line, there is exactly one straight line through that point which never intersects the first line (the second line being the parallel).

Spherical geometry and hyperbolic geometry are both based on changing the parallel postulate. In spherical geometry, it becomes:

5. Given any straight line, and given a point which doesn’t lie on that line, there are zero straight lines through that point which never intersect the first line.

Or, to put it in simpler terms: because you’re on a sphere, lines that should be parallel (that is, lines which form a total of two right angles when intersected by a third line), inevitably intersect. Think of the north and south poles as two points. Draw the prime meridian from North to South. Now draw another line passing through the equator at 1° East longitude, 0 ° North latitude. At that point, the two lines are as parallel as lines get: they form ninety-degree intersections with the equator, and therefore, the interior angles on either side form exactly two right angles. But keep drawing those lines, and they’re going to intersect at the south pole, even though they should, according to Euclidean intuition, have stayed parallel.

In hyperbolic geometry, the parallel postulate is modified to the other extreme:

5. Given any straight line L, and given a point P which doesn’t lie on that line, there are an infinite number of straight lines through P which do not intersect L.

Poincare Parallels

That’s the Poincaré disk model, which fits the infinite hyperbolic plane into a finite circle. It’s elegant and simple, and it’s the model HyperRogue uses, so I’m going to stick with it. The red lines are the boundaries of the infinite set of lines which pass through P but never intersect L. It looks like the red lines intersect L at one end each, but the Poincaré disk model distorts distances more and more the closer you get to the edge. A picture’s worth a thousand words, so here’s a series of circles of equal radius starting from the center of the disk and moving outward:


(Both images rendered with the awesome (and free) geometry software GeoGebra)

I know they don’t look like circles of equal radius, but that’s just an artifact of the projection. The same way a Mercator map distorts Greenland so that it looks like it’s bigger than North America (when in reality it’s not much bigger than Quebec or Mexico), the Poincaré disk model distorts distances the closer you get to the edge of the circle. As a matter of fact, that bounding circle, as measured within the hyperbolic plane, is infinitely far from the center. You can’t ever reach it: it’s infinitely far from everywhere. So those intersections that seem to exist in the picture with the red and blue lines, they don’t actually exist, because you’d have to go infinitely far to get there. And keep in mind that, from any given point, it feels like you’re at the center of a Poincaré disk, so those lines don’t actually get closer to the line L the way the projection makes it seem. The projection is a necessary evil. You can do spherical geometry on an ordinary globe and remove all distortion, but you saw how messy and rumpled the hyperbolic version of a globe became: just look at the red crochet thing above. That’s not gonna happen. You have to live with the distortion.

The cool thing about the Poincaré disk model, though, is that it preserves angles, which makes it easy to do the kind of straightedge-and-compass geometry that’s so handy for geometric proofs.

And guess what? Just like we experience the world an almost-flat Euclidean space (relativity says it’s not perfectly flat, but it’s very close in our neighborhood, which I have to say to stop the nitpickers from yelling at me), there are three-dimensional spaces with spherical curvature, and there are three-dimensional spaces with hyperbolic curvature. In the next part, I’m going to talk about life in a highly-curved hyperbolic space. But before I go, let me leave you with a picture of something. In the Euclidean plane, you can only pack six equilateral triangles (all angles and edge-lengths the same) around a single point. The result looks like this:



In the hyperbolic plane, though, you can fit seven equilateral triangles around a vertex, and it looks like this (and don’t forget, those triangle are just as perfect and equilateral as the ones above; it just doesn’t look like it, because of the projection):



You can actually fit eight triangles around a vertex too, although the triangles have to be larger (largeness being a slightly complicated concept in hyperbolic geometry, but we’ll get to that next time):



And actually, it’s perfectly allowable to fit an infinite number of equilateral triangles around every vertex. That looks like this:



And remember, those triangles are still perfect and equilateral and regular. Hyperbolic space is weird. Remember that thing Christopher Lloyd said in Back to the Future? Get ready: we’re gonna see some serious shit.


Approaching Infinity

One of the cool (and terrifying) things about math is that it’s almost a trivial task to construct a number which is not only larger than any number a human being will ever be able to use, but is also larger than any number that occurs in the Universe, even if you measure its mass in electron masses or its volume in Planck volumes.

The average human’s mathematical circuits are not that hard to overload. If I give you a deck of one hundred photographs and give you one hour to memorize all of them, you might very well be able to do it, but odds are you’ll miss some details. If I ask you to remember a 500-digit number, unless you’re a savant (like Daniel Tammet, who once recited pi to over 22,000 digits from memory, and who allegedly has a distinct mental image for every integer from 1 to 10,000), you’ll need some sort of fancy technique to do it. When it comes to counting objects, human beings don’t need very many numbers. I am one person. You (the reader), and I are two people having a sort of conversation. When I’m talking to a friend and somebody annoying butts in, that’s three people. If I have three apples, and I can ford a river to get to a tree with four apples, at the cost of dropping the ones I already have, I’ll do it. Numbers like three, five, and seven show up in most of the world’s myths and superstitions. Occasionally, you’ll get to seven or nine or even eleven, but rarely much farther than that. On a basic hunter-gatherer level, one hundred is a bit excessive. It’s only science, mathematics, and economy that have made a hundred of anything meaningful.

Take the number one trillion. That’s 10^12, or 1,000,000,000,000. (According to the American number scale, anyway.) It’s a big number. Draw a square. Divide it with ten vertical and ten horizontal lines. Divide each of those boxes with ten pairs of lines. Do this eight more times, and you’ve got a trillion squares. I should, of course, point out that, if you’re working on regular letter-size paper, by the time you get to a trillion boxes, the lines will be so close together that a virus will take up more than one square. Even if you drew your grid in the heart of Asia, where there’s a nice big squarish landmass 3,780 kilometers on an edge (stretching from the coast of China to the Caspian Sea along the east-west axis and from Siberia to the Himalayas on the north-south axis), the squares would be the size of a small closet.

But I already talked about a trillion at length in a previous post. A trillion green peas would just about fit on a football field (for most reasonable definitions of “football”). It’s a lot, but it’s a sensible, comprehensible number.

And a trillion is the largest number you’ll see mentioned frequently in serious astronomy, although there’s also the pleasant-sounding number “ten sextillion.” It sounds like something Lewis Carroll would’ve come up with. Ten sextillion is 10,000,000,000,000,000,000,000. That’s how many stars there are in the visible universe, according to Carl Sagan’s estimation. If you took the heart of Asia from before and divided it into ten sextillion squares, the lines would be separated by less than a hair’s breadth: about 30 microns. Cramped lodgings even for an amoeba.

But with nothing but digits and a few symbols, we can effortlessly construct numbers so massive that there’s no sensible way to describe how massive they are. Consider one trillion again. One trillion is 10^12. That’s the number 10 to the 12th power: 10 multiplied by itself 12 times. Here’s a number that will hurt your head: 10^(10^12). Simple: just take 10, and multiply it by itself one trillion times. I thought I’d be able to actually copy-and-paste that number, but it turns out that, in a 12-point font, I’d need almost 218 million pages (printed both sides). That’s a whole library’s worth of dictionary-sized books, just to hold the digits of a number I described using ten characters a second ago. If you divided the diameter of the observable universe into 10^(10^12) pieces, the distance between them would be 999,999,999,938 orders of magnitude smaller than the Planck length, which is just about the smallest length that makes sense, according to our current physics.

It’s easy as pie to create a scarier number. I’ll do it right now! (10^12)^(10^12). That is, (1,000,000,000,000)^(1,000,000,000,000). Multiply a trillion by itself a trillion times. This is where things not only get horrifying and migraine-inducing, but where they start to get strange: (10^12)^(10^12) isn’t really all that much larger than 10^(10^12). A trillion to the trillionth power is only 10^(12,000,000,000,000), or ten to the twelve trillionth power. That’s because of the way exponents work: the twelve in the first exponent gets multiplied by the trillion in the second exponent. Simple.

Don’t worry, though. With hardly any work, we can construct a function which will generate numbers as scary as you like with almost no effort.

Let’s say that the function M[1](a,b) is just a * b. Simple multiplication (which is really just adding a to itself b times, or vice versa). Let’s extend the concept by saying that M[2](a,b) is a^b, or a multiplied by itself b times. There’s no reason we can’t define M[3](a,b). It would just be a nested series of M[2] being applied over and over, exactly b times. For example, M[3](2,8) is 2^(2^(2^(2^(2^(2^(2^2)))))). You know you’ve wandered into the weird part of mathematics when you get a headache just from dealing with the damn parentheses…

There is no way to write M[3](2,8) out. As a matter of fact, there’s no way to write out its number of digits (which, after all, is only ten times smaller than the number itself). Here’s the closest I can get to writing M[3](2,8). Prepare for an absolutely horrific number-salad. I PROMISE this is the only time in this article that I’m going to do this:


If you’re mad at me right now, I understand. But if it makes you feel better, trying to work out that formatting has both given me a headache and made me physically nauseous. And I still screwed it up.

Nope. Couldn’t do it. It was just too damn hard to look at. Suffice to say, most of the article would have been digits, if I’d pasted that ugly bastard in.

But even the M[3](2,8) thing is unwieldy. We need better notation. Thankfully, Donald Knuth (who, at the age of nineteen, created an entire system of measurement based partly on the thickness of Mad magaizne, issue 26) provided a more elegant solution.

(I should, at this point, mention that the enormous number I copy-and-pasted above was so big that it was making the WordPress text editor lag, so I had to copy it into a Notepad file so that I can continue writing. You’ll never see it, but up above, I’ve written “[HUGE NUMBER GOES HERE]”. I have a headache.)

Knuth’s up-arrow notation is just like my M-notation, but it’s (slightly) easier on the eyes. No easier on the brain, though. In Knuth notation, a ^ b is replaced by a↑b, that is, a multiplied by itself b times. For example: 2↑8 is 256.

Things get scary very, very fast. a↑↑b is defined as a↑(a↑(…↑a)), where a is repeated a total of b times, with all the associated symbols. That’s too damn abstract for me, so let’s compute 2↑↑3. That’s 2↑2↑2, or 2^(2^(2)), which is only 16. 2↑↑4 is 2^(2^(2^(2))), or 65,536.

We can go further, though, although my headache is telling me to stop. a↑↑↑b is just a↑↑a↑↑a…↑↑a, with a repeated b times. 3↑↑↑2 is 3↑↑3 or 3^(3^(3)), which is about seven and a half trillion. 3↑↑↑3, on the other hand, is a number so large that I can’t express it in decimal notation. Hell, I can’t even express it using exponentials or up-arrows. It’s equal to 3↑↑3↑↑3, which is equal to 3↑↑(3^(3^3)), which is equal to 3↑3↑…↑3, where there are over seven trillion threes. That means a tower of exponents seven trillion threes tall. My word processor tells me that a superscript is 0.58 times the size of a regular letter, and by the time we get to the 7.6 trillionth three, it’ll be infinitely smaller than a proton.

That’s the level we’re at. Even trying to describe the typography of this ridiculous number is impossible.

What about a↑↑↑↑b? Well, 3↑↑↑↑2 is 3↑↑↑3, which we just saw was the most horrible thing in the world. 3↑↑↑↑3 is 3↑↑↑(3↑↑↑3). That is to say, 3↑↑↑3↑↑↑…↑↑↑3, with 3↑↑↑3 threes.

But I’m not letting you get off that easy. Let’s say that a↑[c]b means a↑…↑b, with c arrows in total. So a^b would be a↑[1]b. 3↑↑↑3 would be 3↑[3]3.

You know what I’m going to do. I can’t stop myself. If I knew any Medusas, I’d be a statue by now, because I wouldn’t be able to resist sneaking a peek.

There’s no turning back. It’s too late for you now. Too late for me.

Consider the number 3[3↑↑↑3]3. That’s 3↑…↑3, with seven trillion arrows. Think of the endless eternities of parentheses and arrows and evaluations, and that wouldn’t even get you close to the number of digits in this horror. Let’s call this horror X.

Now consider 3↑[X]↑3. Call it Y.

I imagine that my punishment in Number Hell will be evaluating 3↑…↑3, with Y arrows. And that’s infinitely smaller than 3↑[3↑…↑3 with Y arrows]↑3.

I’m not exaggerating for dramatic effect: I am genuinely smelling rotten eggs right now. I think I might have given myself a stroke. But before the aphasia sets in, let me introduce you to the Devil Incarnate: the Ackermann Function.

The Ackermann Function is the kind of thing they must’ve tortured Winston Smith with in 1984. It’s the reason some mathematicians walk around with that horrified thousand-yard stare. It’s an honest-to-goodness nightmare.

The Ackerman function is dead-simple. You write it A(a,b), for positive integers a and b. Here’s how you evaluate it.

If = 0, then A(a,b) = b+1

If a > 0 and b = 0, then A(a,b) = A(a-1,1)

If > 0 and b > 0, then A(a,b) = A(a-1,A(a,b-1)).

Simple rules. Not simple to apply. For instance, A(2,2) = A(1,A(2,1)) = A(1,A(1,A(2,0))) = … a horrifying mess of parentheses that ultimately gets you to 7. At least it’s a sensible number. So is A(3,2). It’s 29. A(4,2), on the other hand, is over 19 thousand digits long. When I typed Ackermann(4,4) into WolframAlpha, it actually told me “(too large to represent).” It’s always nice when a computation engine built by one of the masters of symbolic computation says “Hell with this. I give up.”

You know how evil I am. You know what I’m going to do. You know how psychotic and depraved I’ve become after looking at unfathomable numbers for an hour.

The Number of the Devil isn’t 666. It’s Ackermann(666↑↑↑↑↑↑666,666↑↑↑↑↑↑666).

Sleep well. I know I won’t.