Unusual properties of hyperbolic squares

...or how a silly meme inspired complex calculations regarding non-Euclidean geometry 😅

Everything started with the meme below:

I assume it doesn't require an explanation, but I'll explain it just in case. If we put 4 people in the corners of a square with a side of 6 feet (about 1.8 meters), then the distances along the diagonals won't be 6 feet, but about 8.4 feet (6√2, to be precise). It follows from the geometry of a square and the Pythagorean theorem (and hence the reference to Pythagoras in the bottom of the image).

And we could just stop at "haha, of course, it can't be like that", but it turns out that there is a deeper issue here. An acquaintance of mine who goes by "Nerd Alert" on the internet made the following comment: "Any normal person would say to himself: Hey, this – approximately – works fine on the hyperbolic plane." - and this sparked my interest.

See, my first reflex wouldn't have been to consider a hyperbolic plane, but simply putting the people in the vertices of a regular tetrahedron. Then the distances between each pair of people would be equal. But this requires either expanding the problem into 3 dimensions, or - if we want to stick to 2 dimensions - using spherical geometry, not hyperbolic. (The vertices of the tetrahedron can be placed on a sphere, and then the sphere can be treated as a "plane" in spherical geometry.)

When I mentioned this, Nerd Alert elaborated a bit. According to his calculations, in large squares on a hyperbolic plane, the ratio between the diagonals and sides tends to 1 - so in a large enough square, the sides can be almost as long as the diagonals. Which means that if the curvature of the hyperbolic plane were significant enough for 6 feet to be large in comparison with the radius of curvature, the diagonals in such a square would also be approximately 6 feet long.

But I wouldn't be myself if I just took his word for it 😉 I decided to calculate this myself, and I'll show you how I did it in this blog post.

An introduction to hyperbolic geometry

One can think about hyperbolic geometry in many ways. A very popular one is Poincaré's disc model. For the purposes of this exercise, though, I thought like this:

Imagine a regular, Euclidean plane and a point on it. Let's start drawing circles centered on this point. Each circle has some radius and some circumference. And on a Euclidean plane, it so happens that a circle with radius r has a circumference of l(r) = 2\pi r.

But it doesn't have to be like that. If we started to draw larger and larger circles on the surface of the Earth, for example, it would turn out that the larger the circle, the more its circumference differs from 2\pi r - in fact, it would be smaller. To be more precise, it would turn out that the correct expression for the circumference of a circle on Earth is 2 \pi R \sin \frac{r}{R}, where R is about 6371 km - specifically, it is the radius of the Earth as a ball. A circle with a radius of 10000 km would have a circumference equal not to 62832 km, but rather approximately 40000 km - which is quite a significant difference.

Well, but the surface of the Earth is governed by spherical geometry and it has a positive curvature. Hyperbolic geometry is the geometry of a surface with a negative curvature. So what would be the circumference of a circle with a radius of 10000 km on a surface that has the same radius of curvature as the Earth, but is negatively curved?

The circumference of a circle on a hyperbolic plane can be expressed as l(r) = 2\pi R \sinh \frac{r}{R}. The regular sine function from the spherical expression is replaced here with a hyperbolic sine (I described what hyperbolic functions are in slightly more detail here). If we substitute 6371 km for R and 10000 km for r, we will get a circumference of 92000 km - significantly more than the Euclidean 62832 km! And this circumference grows with the radius very quickly, almost exponentially. A 3 times greater radius - so 30000 km - would yield a circumference of about 2.2 million km! There is a lot of "additional" space on a hyperbolic plane...

And this is roughly how you can imagine a hyperbolic plane. Just like the circles grow slower in spherical geometry than Euclidean circles, hyperbolic ones grow faster. There are a lot of interesting problems related to that, but it's not quite what this post was supposed to be about. We were supposed to calculate some stuff related to hyperbolic squares, so let's move on to that topic now.

Hyperbolic squares

We will consider a hyperbolic square to be 4 points located symmetrically around some center, connected with lines that are "straight" in the sense of the geometry of our hyperbolic plane - ie., geodesics.

How do we define those points? There are many possible ways. I decided to use polar coordinates, ie. the distance from the origin and the angle around the origin as counted from some specific direction. Such coordinates are typically defined on Euclidean planes, but there is nothing to prevent us from introducing them on a hyperbolic plane, too.

There will be a small difference between a Euclidean plane and a hyperbolic plane, though, and that will be the metric in those coordinates. On a Euclidean plane, the metric is:

 ds^2 = dr^2 + r^2 d\varphi^2

But on a hyperbolic plane, it is:

 ds^2 = dr^2 + R^2 \sinh^2 \frac{r}{R} \, d\varphi^2

R, like before, plays the role of the radius of curvature of the surface. If we assume units of length such that the radius of curvature is 1 unit, the expression will simplify a lot:

 ds^2 = dr^2 + \sinh^2 r \, d\varphi^2

It resembles the metric of a unit sphere:

 ds^2 = d\vartheta^2 + \sin^2 \vartheta \, d\varphi^2

just with a hyperbolic sine instead of a regular one, and an r coordinate instead of \vartheta (which, as becomes quite obvious here, plays the role of the radial coordinate on a sphere in a sense).

Great, but what about the square? In such coordinates, we can define the vertices of the square as located at points: (\frac{d}{2}, \frac{\pi}{4}), (\frac{d}{2}, \frac{3\pi}{4}), (\frac{d}{2}, -\frac{3\pi}{4}), (\frac{d}{2}, -\frac{\pi}{4}). All 4 vertices are at a distance \frac{d}{2} from the center, which means that the diagonals of such a square will have lengths of d and they will intersect in the origin.

Let's denote the length of the sides by a. Aside from that, we will define one more value: I'll denote it by r_{min}, and it will be the minimum distance of each of the sides from the origin (see the image below).

In a Euclidean square, r_{min} would simply be \frac{a}{2}, but as we will see, it is not that easy on a hyperbolic plane.

The calculations

What we would like to obtain in order to check Nerd Alert's claim is an expression for the length of diagonals d as a function of the side length a. In order to get it, we need some equations that geodesics on such a plane satisfy - after all, the sides of the square are geodesics.

Let's assume, then, that our geodesic representing one of the sides has an affine parameterization of \tau \mapsto (r(\tau),\varphi(\tau)). Affine, meaning that the changes of the \tau parameter are equal to the length along the curve between the points corresponding to different values of the parameter. And this means that the vector tangent to such a geodesic v = (\dot{r}, \dot{\varphi}) is a unit vector, that is:

 g(v, v) = \dot{r}^2 + \sinh^2 r \, \dot{\varphi}^2 = 1

Besides, let's note that no coefficient in the metric depends on the coordinate \varphi - it means that the metric is rotationally symmetric and the vector field \partial_\varphi is a so-called Killing vector field. The important thing here is that along a geodesic, the inner product of the vector tangent to the geodesic and a Killing field is constant. In our case:

 g(\partial_\varphi, v) = \sinh^2 r \, \dot{\varphi} = L = \textrm{const}

Which means that we can write our previous equation in the following form:

 \dot{r}^2 = 1 - \sinh^2 r \, \dot{\varphi}^2 = 1 - \frac{L^2}{\sinh^2 r}

 \dot{r} = \sqrt{1 - \frac{L^2}{\sinh^2 r} }

And this is already a differential equation for r(\tau)! It's not very useful in this form yet, though, we still have to think a bit.

First, let's look at the point on the side of the square which is at the distance of r_{min} from the center. Since in such a point the radial coordinate r is at a minimum, the derivative of this coordinate \dot{r} will be zero. Thus:

 0 = \sqrt{1 - \frac{L^2}{\sinh^2 r_{min}}}

And hence we get that along the sides of the square, we have:

 L = \sinh r_{min}

So we can write the equation describing the sides like so:

 \dot{r} = \sqrt{ 1 - \frac{\sinh^2 r_{min}}{\sinh^2 r} }

This is an equation for r(\tau), but actually that function is of little interest to us. We are more interested in the shape of the curve that is the side of the square, and not in some specific parameterization of it, so we will look for the function r(\varphi) or \varphi(r) - and as it turns out, it is relatively easy to obtain the latter. Let's start by writing an expression for \frac{d\varphi}{dr}:

 \frac{d\varphi}{dr} = \frac{\dot{\varphi}}{\dot{r}} = \frac{\sinh r_{min}}{\sinh r \sqrt{ \sinh^2 r - \sinh^2 r_{min} } }

Assuming that \varphi(r_{min}) = 0, we can obtain \varphi(r):

 \varphi(r) = \int\limits_{r_{min}}^{r} \frac{d\varphi}{dr'} dr' = \int\limits_{r_{min}}^r \frac{\sinh r_{min} \, dr'}{\sinh r' \sqrt{ \sinh^2 r' - \sinh^2 r_{min} } }

(I used r' in the integral instead of r in order to avoid a collision of symbols.)

This integral can be computed analytically. Wolfram Alpha helped me in that, and the result is:

 \varphi(r) = \frac{\pi}{2} - \arctan \frac{\sinh r_{min} \, \cosh r}{\sqrt{\sinh^2 r - \sinh^2 r_{min}}}

Because one of the vertices of the square is located at a point (\frac{d}{2}, \frac{\pi}{4}), we get the condition:

 \varphi\left( \frac{d}{2} \right) = \frac{\pi}{4}

which is satisfied when the expression inside the arc-tangent is 1:

 \frac{\sinh r_{min} \, \cosh \frac{d}{2}}{\sqrt{\sinh^2 \frac{d}{2} - \sinh^2 r_{min}}} = 1

From this, we get:

 d = 2 \, \textrm{arcosh} \, \sqrt{ \frac{ 1 + \sinh^2 r_{min} }{ 1 - \sinh^2 r_{min} } }

Let's note that this expression only makes sense as long as \sinh r_{min} < 1 - we will take a closer look at that later.

For now, let's compute a. If we integrate the length of the curve over the radius from r_{min} to \frac{d}{2}, we will get a half of a side's length, which is \frac{a}{2}:

 \frac{a}{2} = \int\limits_{r_{min}}^{\frac{d}{2}} \sqrt{ dr^2 + \sinh^2 r \, d\varphi^2 } = \int\limits_{r_{min}}^{\frac{d}{2}} \sqrt{1 + \sinh^2 r \, \left( \frac{d\varphi}{dr} \right)^2 } dr

Since we already know \frac{d\varphi}{dr}, we can substitute the appropriate expression and get:

 \frac{a}{2} = \int\limits_{r_{min}}^{\frac{d}{2}} \frac{\sinh r \, dr}{\sqrt{\sinh^2 r - \sinh^2 r_{min}}}

This integral can also be computed analytically, and again with some help from Wolfram Alpha I got:

 a = 2 \, \textrm{artanh} \, (\sinh r_{min})

From this, we can extract:

 r_{min} = \, \textrm{arsinh} \, \left( \tanh \frac{a}{2} \right)

Which, after substituting it into the expression for d, yields:

 d = 2 \, \textrm{arcosh} \, (\sqrt{ \cosh a })

Phew! There was a bit of a mess with the hyperbolic functions (which shouldn't be surprising - after all, we're dealing with hyperbolic geometry here), but eventually, we have a result.

Conclusions

What conclusions can we draw from that result?

First, we can ask what the ratio \frac{d}{a} is in small squares:

 \lim\limits_{a \to 0} \frac{d}{a} = \lim\limits_{a \to 0} \frac{2 \, \textrm{arcosh} \, (\sqrt{\cosh a})}{a} = \sqrt{2}

So, for small squares we get the same ratio as in Euclidean geometry. Which shouldn't be surprising, since a hyperbolic plane is a differentiable manifold, and such manifolds locally - ie. in small neighborhoods of points - are approximately Euclidean.

How about large squares?

 \lim\limits_{a \to \infty} \frac{2 \, \textrm{arcosh} \, (\sqrt{\cosh a})}{a} = 1

For large squares, the ratio of diagonals to sides tends to 1 - so Nerd Alert was right! Indeed, the larger the square, the less the difference between a side and a diagonal. So the meme would make sense in a hyperbolic space... with a radius of curvature much smaller than 1.8 meters (since - let's remind ourselves - the lengths expressed in units of the radius of curvature must be large) 😅

Finally, let's revisit the expression for d, which only made sense when \sinh r_{min} < 1. What is this about?

Assume that we start from the point (r_{min}, 0) such that \sinh r_{min} > 1. We start a geodesic in a direction in which \dot{r} = 0 - so we are de facto trying to build a side of a hyperbolic square, like earlier, only with an excessively large r_{min}. It turns out that... such a geodesic will never reach \varphi = \pm \frac{\pi}{4}! In other words, if we create four such geodesics which we'd like to become four sides of a square, they... will never intersect. A square will simply not appear. And in the edge case of \sinh r_{min} = 1, the intersection points, so the vertices of the square, would be... at infinity. In Poincaré's model, those sides would intersect on the edge of the disc.

It is a result of one of the properties of hyperbolic planes: having a "straight" line and a point not on that line, there are infinitely many lines through that point that never intersect our initial line. On a Euclidean plane, there would be exactly one and we would call it "parallel" to the original line. On a spherical plane, there would be no such lines. Such considerations about lines actually once led to the discovery of non-Euclidean geometries.

So, this is where I'll end this blog post. All those considerations inspired by one meme were a fascinating journey into the world of hyperbolic geometry for me - and I hope that I managed to share it with you, at least to some degree!