Apollonian Gasket

Three touching circles leave a curved triangular gap. Put the largest circle that fits into that gap, which touches all three circles and leaves three smaller gaps, then repeat in those gaps.

The picture below starts with a large circle of radius 1, with two circles of radius 1/2 and one of radius 1/3 inside it. The number on each circle is its curvature, which is one divided by its radius, so a smaller circle gets a larger number. The large circle counts as −1 because it bends the other way:1 the small circles bulge into a gap, and the large circle curves around it.

Click or tap a gap to add its circle.

Fill the gaps

Choose a gap.

4 circles. Largest curvature 3.

Every new number is whole.1 Press Fill every gap five times and you get 488 circles, the smallest with curvature 927, so its radius is exactly 1/927 of the large circle's.

To see where these numbers come from, press Start over and point at or tap the gap in the middle. The three gold circles, 2, 2 and 3, touch the circle that fits in that gap, and they also touch the large circle, shown in blue. Any three touching circles have exactly two other circles that touch all of them.

If you know one of those two circles, you can calculate the other by adding the three curvatures, doubling the result and subtracting the one you know: 2×(2+2+3)−(−1)=152 \times (2 + 2 + 3) - (-1) = 15. It works in the other direction too: 2×(2+2+3)−15=−12 \times (2 + 2 + 3) - 15 = -1. The demo shows both lines for any gap or circle.

Every gap has three circles around it and a fourth circle that touches those three, so all four numbers are already on the picture. Doubling, adding and subtracting whole numbers can't make a fraction, so four whole numbers at the start make every later number whole.1

The same rule checks the minus sign. The bottom half of the picture is a mirror image of the top half, so the circle in the bottom gap has to be another 3. With −1, the rule gives 2×(−1+2+2)−3=32 \times (-1 + 2 + 2) - 3 = 3. With +1, it gives 7, a circle far too small for that gap.

The rule comes from an equation Descartes found in 1643, in a different form.1, 3

The first four numbers matter, and the explorer on this page starts with different ones: three equal circles. Choose Three equal circles to see them with the large circle at −1. The others are about 2.15, and every number after the −1 has a 3\sqrt{3} in it.2

Further exploring

Videos

Reading

Sources and notes

  1. Apollonian Circle Packings: Number Theory.
  2. Calculation. With the large circle at −1 the equal circles have curvature x=1+2/3x = 1 + 2/\sqrt{3}. The rule writes every later curvature as m+nxm + nx with whole numbers mm and nn, and nn stays at least 1, so the 3\sqrt{3} never cancels. Rescaling multiplies every curvature by the same number, and −1 and xx can't both become whole because xx is not a fraction.
  3. Calculation: four circles that all touch each other satisfy (a+b+c+d)2=2(a2+b2+c2+d2)(a+b+c+d)^2=2(a^2+b^2+c^2+d^2). Solving for dd gives d=a+b+c±2ab+bc+cad=a+b+c\pm2\sqrt{ab+bc+ca}, one answer for each of the two circles. The two answers total 2(a+b+c)2(a+b+c), which is the rule. For three equal circles of curvature 1 the answers are 3±233\pm2\sqrt3.