A Visual Solution to the Apollonian Problem

Martha Edwards
7 min readAug 23, 2021

--

by Lael Costa and Martha Edwards

We’ve always been drawn to fractals, perhaps none more so than the Apollonian Gasket, which we both learned about from different sources early in our mathematical lives.

To illustrate constructing one of these fractals, we can start with three tangent circles:

Three pairwise-tangent circles
made by Lael & Martha in Geogebra

There are exactly two circles that are tangent to all three: one surrounding the group, the other nestled in the “triangular” space between.

The same three circles, with a small tangent circle in the space between, and a large tangent circle surrounding all.
made by Lael & Martha in Geogebra

There will also be exactly two tangent circles if one of the starting circles surrounds the other two.

One large circle encircling four other circles, with five of the six interior pairs being tangent
made by Lael & Martha in Geogebra

Put a little more precisely, the trick to constructing Apollonian Gaskets is that any three pairwise-tangent circles always define two additional circles, both tangent to all three original circles.

So, to construct an Apollonian Gasket, our procedure is:

  1. Start with three pairwise-tangent circles.
  2. Find the two tangent circles.
  3. Pick three pairwise-tangent circles from among all circles now on the page.
  4. Go to step 2.

And we’ve generated a fractal that looks something like this:

An Apollonian gasket fractal
generated by Lael with the code linked below

What makes the Apollonian Gasket fractal especially fun and beautiful to us is that it’s so simple to describe, yet holds so much complexity. Some fractals are unvaryingly self-similar, like Sierpinski triangles — perhaps the most famous example of a fractal — and Koch snowflakes.

A Sierpinski triangle fractal.
https://en.wikipedia.org/wiki/Sierpi%C5%84ski_triangle#/media/File:Sierpinski_triangle.svg

Others are rough and unpredictable — keep zooming in, and you keep seeing new scenery. Examples include the coastline of England and the Mandelbrot set.

https://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/37813/versions/1/screenshot.gif
https://users.math.yale.edu/public_html/People/frame/Fractals/Panorama/Nature/Coastlines/CoastZoom.gif

The Apollonian Gasket falls somewhere in between: it has a visual regularity without having strict self-similarity. Another cool thing about it is that there are infinite variations! Any 3 pairwise-tangent circles generate a fractal of this type.

Another Apollonian gasket
generated by Lael with the code linked below

Finding the circles in an Apollonian Gasket fractal

So given our three starting circles, how can we find the next two circles in our Gasket? When you’re doodling in the margins of your notebook, it’s easy to see where the next circle should go — the hard part is freehanding near-perfect circles. But if we want to computationally generate a fractal, in order to zoom in forever and see more and more detail, we can’t use pen and paper for this. It isn’t, as you might imagine, a simple proposition with a compass and a straightedge.

There is a way to precisely compute the next circles in the fractal, given the centers and the radii of the three starting circles. The canonical solution relies on a theorem of Descartes to obtain the radius of the next circle, and then a little bit of geometry to find its center.

(k1 + k2 + k3 + k4)² = 2(k_1² + k_2² + k_3² + k_4²).
https://en.wikipedia.org/wiki/Apollonian_Gasket

To us, this solution is concise, but it’s opaque and boring! It feels like “plug and chug”: the equation leads to the right answer, but it isn’t intuitive, and doesn’t really give any insight into the fractal’s relationship with other parts of the mathematical world. We were interested in finding another, more visually intuitive way to solve this problem.

We realized that with some sets of 3 starting circles, the 2 subsequent circles are easy to compute. For example, if all the circles have the same radius and they are centered around the origin — which we can call our “unit fidget spinner”:

Illustration of the “unit fidget spinner” described above
made by Lael & Martha in Geogebra

then, computing the inner and outer tangent circles is straightforward with a little help from Pythagoras.

But, not all sets of starting circles make it this straightforward. If we’re working towards a Gasket fractal from an arbitrary trio of starting circles, the dream would be to have some way of taking the circles from the “unit fidget spinner” case and deforming them into our arbitrary circles. If we could do that, while preserving their tangencies, then applying the same deformation to the inner and outer circles in the “unit fidget spinner” case would give us the next two tangent circles in our Gasket that we are trying to construct.

We’re looking for a class of transformation that preserves circles, but allows us the flexibility to take any 3 tangent circles to any other 3 tangent circles.

Möbius transformations

Luckily such a class of transformations exists! They are called Möbius transformations, and yes they are named after that same guy.

Image of a Möbius strip
https://static.scientificamerican.com/sciam/cache/file/44DAA5B1-8418-4D55-BCA2359C8C87915E_source.jpg

A Möbius transformation is a well-known type of plane deformation that preserves circles. One cool way to think about Möbius transformations is to imagine taking the plane, projecting it onto a sphere, rolling the sphere around, and then projecting back onto the plane. It’s like drawing a Mercator projection map, but from a tilted globe.

Google Maps heavily distorted
https://flowingdata.com/2014/06/09/mercator-projection-pole-shifts-to-where-you-live/

Thinking about it this way, it makes intuitive sense that circles are preserved as circles — unless they get turned into lines, if they happen to intersect with the new point of projection, just as lines of latitude and longitude are round on a globe but straight lines on a map. So, Möbius transformations send circles and lines to circles and lines, but don’t ever deform circles into ellipses or other weird shapes. This is exactly what we want for our Apollonian Gasket quest.

One important caveat that will be relevant shortly: The contents of the circle may get severely jostled around. This means that the center of the original circle is not necessarily mapped to the center of the deformed circle. The point that the original center gets mapped to — its image — may not even be inside the image of the circle!

What makes Möbius transformations useful to us, as you might learn in an introductory complex analysis course, is that for any 3 distinct starting points, you can pick any 3 ending points that you want, and find a Möbius transformation that sends the given starting points to the ending points you picked. That is, for any points a, b, c, d, e, and f, there exists a Möbius transformation m for which m(a) = d, m(b) = e, and m(c) = f.

But does this property allow us to reliably deform one trio of pairwise-tangent circles into another? If a particular Möbius transformation is fully specified by its behavior on three points, we would need to encode a trio of circles in just three points. The centers won’t work, as we noted above.

The trick is to use the points of tangency. Fact: three distinct points in the plane exactly specify the three circles whose tangencies lie at those points. If we wish to deform one trio of circles onto another, we can use the Möbius transformation that sends the points of tangency of the first trio to those of the second.

Now, we have everything we need: If the first trio is the simple “fidget spinner” case described above, and the next two tangent circles are easy to compute, then because the Möbius transformation preserves circles, the images of two tangent circles under the transformation will (a) be circles and (b) be tangent to each of the circles in the second trio — making them easy to compute too. Hooray!

Conclusion

If we were to write out this solution as an algebraic expression, it would certainly be longer and more difficult to read than Descartes’ theorem. But it’s beautiful to us because it is motivated by a visually intuitive sense of how the circles are related. And it gives us an interesting result. We learned that a Gasket is made up of circles, and is specified by its three starting circles, which are themselves uniquely specified by their three points of tangency. We also learned that Möbius transformations can map any three points onto any three other points. This lets us actually map any Gasket onto any other Gasket using a Möbius transformation!

generated by Lael with the code linked below

Möbius transformations are not just a convenience for us, they are intimately related to the structure of this fractal.

Source code for demo images and gifs: http://laelcosta.com/demo3.js

--

--