# Apollonian Gasket

> Circles packed inside a circle without end, each new one touching three others; Descartes' theorem gives its size, and every curvature is a whole number.

Start with three circles that touch each other inside a fourth, larger circle. Each of the four curved triangles between them holds exactly one more circle that touches all three of its sides; each of those makes three new triangles, and so on without end. The result is an Apollonian gasket, named after Apollonius of Perga, who studied circles tangent to three given circles around 200 BC.

The size of each new circle comes from Descartes' theorem of 1643, which Frederick Soddy restated in 1936 as the poem "The Kiss Precise". When four circles all touch each other, their curvatures (1 over the radius, negative for the outer circle, which touches the others from inside) satisfy $(k_1 + k_2 + k_3 + k_4)^2 = 2(k_1^2 + k_2^2 + k_3^2 + k_4^2)$. Given three of them, the fourth is $k_4 = k_1 + k_2 + k_3 \pm 2\sqrt{k_1 k_2 + k_2 k_3 + k_3 k_1}$, and the same relation, applied to each curvature times the centre written as a complex number, gives its position. This gasket starts from the curvatures $-1$, $2$, $2$ and $3$, and then every curvature is a whole number: 6, 11, 14, 15, 18, 23, and so on. The document holds the 224 circles of radius at least 0.008, computed by that formula and coloured by generation.

The gasket is a fractal. The circles never fill the disc, and what is left over has dimension about 1.3057, between a curve and a surface. The document keeps the circles of each generation on its own row, so a generation can be hidden or recoloured on its own.

After a JSXGraph example by The Center of Mobile Learning with Digital Technology.

- [Open the interactive version](https://graph-paper.io/showcase/en/apollonian-gasket)
- [Learn more on Wikipedia](https://en.wikipedia.org/wiki/Apollonian_gasket)
