An infinite fractal of mutually tangent circles, generated recursively using Descartes' Circle Theorem. Starting from three touching circles, new circles are packed into every gap — forever.
k4 = k1+k2+k3 ± 2√(k1k2+k2k3+k3k1)(k1+k2+k3+k4)² = 2(k1²+k2²+k3²+k4²)k4 = k1+k2+k3 ± 2√(k1k2+k2k3+k3k1)k4·z4 = k1z1+k2z2+k3z3 ± 2√(k1k2z1z2+k2k3z2z3+k3k1z3z1)
When the first four curvature values are integers, every circle in the gasket has an integer curvature. The famous "-1, 2, 2, 3" gasket has this property. The Hausdorff dimension of an Apollonius gasket is approximately 1.3057.
What is an Apollonius gasket?
An Apollonius gasket (also called an Apollonian gasket) is a fractal generated by starting with three mutually tangent circles, finding the circle that fits in the gap between them using Descartes' Circle Theorem, then recursively filling every new gap indefinitely. The result is an infinitely complex arrangement of tangent circles that never overlap and leave no gaps.
What is Descartes' Circle Theorem?
Descartes' Circle Theorem states that if four circles are mutually tangent, their curvatures k1, k2, k3, k4 satisfy (k1+k2+k3+k4)² = 2(k1²+k2²+k3²+k4²). Given three tangent circles, this lets us solve for the curvature of a fourth circle tangent to all three. The theorem was discovered by Rene Descartes in 1643 in a letter to Princess Elisabeth of Bohemia.
What is curvature in circle packing?
Curvature k equals 1/r where r is the circle's radius. A large curvature means a small, tightly curved circle. The outer bounding circle is assigned negative curvature because the other circles are packed inside it — this sign convention makes the Descartes theorem work correctly. Flat lines can be treated as circles with curvature zero (infinite radius).
The complex extension of Descartes' theorem gives the centre. If z = x + iy encodes each circle's centre as a complex number, then k4·z4 = k1z1 + k2z2 + k3z3 ± 2√(k1k2z1z2 + k2k3z2z3 + k3k1z3z1). The two sign choices yield the two circles that can be tangent to the triplet — one nestled inside the gap, one enclosing everything.
Yes. The gasket has Hausdorff dimension approximately 1.3057, independent of the initial configuration. It is self-similar in the sense that every interstice (gap) contains a scaled copy of the whole pattern, and the circles become arbitrarily small. The total area of the circles converges to less than the area of the bounding circle, leaving a Cantor-like residual set.
When the four initial curvatures are integers, every subsequent curvature in the gasket is also an integer. These are called Apollonian integer packings. The classic example starts with curvatures -1, 2, 2, 3. The negative -1 denotes the large enclosing circle. Number theorists study which integers appear as curvatures in Apollonian packings — it is an active research area connected to the theory of quadratic forms.
Apollonius of Perga (c. 262–190 BC) studied tangent circles in ancient Greece. Rene Descartes rediscovered the curvature relation in 1643. The modern mathematical study was formalised by Frederick Soddy (who also published Soddy's circles), and later by Graham, Lagarias, Mallows, Wilks and Zannier, who proved deep results about integer Apollonian packings in the 21st century.
The recursion is theoretically infinite, but circles quickly become smaller than a pixel. The simulation stops when a circle's radius in screen pixels falls below the minimum radius threshold (default 1 px). Increasing the threshold gives faster rendering; decreasing it reveals finer fractal detail. The depth slider provides an additional hard limit on recursion levels regardless of radius.
Yes. Use the mouse scroll wheel or the zoom slider in the HUD to zoom in, and click-drag to pan. The fractal detail visible depends on the minimum radius threshold — set it lower to see finer circles when zoomed in. On touch devices, pinch-to-zoom and swipe gestures are supported. The zoom factor is shown live in the HUD.
Circles are coloured by their generation depth in the recursion. Generation 0 circles (the initial triplet) use one hue; deeper generations shift hue along the selected palette gradient. This makes the fractal hierarchy visually clear — older, larger circles have distinct colours from the tiny nested ones. Four palettes are available: Violet, Spectrum, Ember, and Ice.
Apollonian circle packings have deep connections to number theory, hyperbolic geometry, and group theory. The set of tangency points of an Apollonian gasket is a limit set of a Kleinian group — a group of Mobius transformations of the Riemann sphere. The curvatures in integer packings satisfy congruence conditions studied via the theory of quadratic forms and the Local-Global principle for thin groups.