Recursion: the generator of complexity¶
Self-similarity keeps showing up where nobody invited it. Koch snowflakes and fern leaves. Mandelbrot sets and coastlines. A Buddhist metaphor about Mount Sumeru fitting inside a mustard seed, and a strand of DNA that packs the blueprint of an entire organism into every one of its trillions of cells.
But noticing that self-similarity exists is different from understanding why it exists.
A fern and a snowflake curve are separated by billions of years of evolution and entirely different physics. Why do they converge on the same kind of structure? Self-similarity is not the signature of any single domain — it appears independently in mathematics, biology, and computation, each time without borrowing the pattern from elsewhere. That independence is what makes the question sharp: what mechanism causes self-similar structures to emerge over and over again?
Mathematics: iterated function systems¶
In 1968, the Hungarian-born botanist Aristid Lindenmayer published a paper in the Journal of Theoretical Biology describing a formal grammar for the growth patterns of filamentous organisms like blue-green algae. His starting point was not geometry — it was developmental biology. He wanted a mathematical language precise enough to express "one cell divides into two, two into four" and nothing more.
The system that emerged, now called the L-system, has a core idea that is almost aggressively simple: take a rule, apply it to its own output, repeat.
L-system rules: a concrete example
An L-system consists of three things: an initial string (the axiom), a set of replacement rules, and an iteration count.
Here is a classic tree-like L-system:
At each step, every F in the string is simultaneously replaced by F[+F]F[-F]F.
The symbols are drawing instructions:
F— draw a line segment forward+— turn left by 25.7°-— turn right by 25.7°[— save the current position and heading (push onto a stack)]— restore the last saved position and heading (pop from the stack)
Step 0: F — a single vertical stroke.
Step 1: F[+F]F[-F]F — a trunk with two short branches splitting left and right.
Step 2: Every F gets replaced again. The string explodes in length — each line segment sprouts its own pair of branches.
By step 4, the string is thousands of characters long. But when you render it, you see a tree with dozens of branching levels. A complete, recognizable tree.
Notice what is absent from the rules: the word "tree." There is no concept of trunk, canopy, or branch hierarchy. The rule says exactly one thing — "replace each segment with a branching pattern." The tree is a side effect of iteration, not the goal of design.
Pay attention to what just happened. A single replacement rule, applied to its own output, iterated four or five times, and a visually recognizable tree structure crystallized out of pure string manipulation. The rule contains zero knowledge of trees. No "trunk" variable. No "canopy" parameter. Just "replace F with a branching pattern." Yet when that rule is recursively applied to its own products, macroscopic structure emerges from microscopic grammar.
Lindenmayer himself probably did not foresee that a grammar invented for blue-green algae would become the standard tool for generating virtual plants in computer graphics. Change the branching angle and the replacement pattern, and the same mechanism produces shrubs, ferns, flowers — all from the same engine: a rule feeding on its own output.
The Mandelbrot set runs on the same logic, just in a different branch of mathematics. Pick a complex number \(c\), start with \(z_0 = 0\), and iterate:
Track whether \(z\) escapes to infinity or stays bounded. Different values of \(c\) lead to different fates — some points flee immediately, some are trapped near the origin forever, some dance along the boundary in extraordinarily intricate trajectories. The set of all \(c\) values that never escape forms the famous black shape.
One iteration rule. Different initial conditions. The result is a structure that reveals new detail at every magnification. Zoom into the boundary of the Mandelbrot set by a factor of ten thousand, a million, a billion — you do not find pixels and blur. You find new, elaborate patterns that echo the whole. Miniature copies of the full Mandelbrot set are scattered across the boundary, each surrounded by still smaller copies. Five characters — \(z^2 + c\) — encode a finite amount of information. But the structure that iteration extracts from them is infinite.
L-systems and the Mandelbrot set come from completely different mathematical traditions — one from formal language theory, the other from complex dynamical systems. Yet they converge on the same conclusion: simple rule + repeated iteration = emergent self-similarity.
There is an important distinction to be honest about here. L-systems produce exact self-similarity — every level of branching is a precise scaled-down copy of the level above, because the replacement rule is identical at every step. Natural plants exhibit statistical self-similarity — the branching angles, length ratios, and branch counts are consistent in their statistical properties across scales, but no two branches are ever identical. An L-system is a mathematical abstraction of plant growth, not a faithful reproduction of it. Real biological systems are buffeted by wind, uneven sunlight, soil nutrient gradients, and competition with neighboring plants — randomness that smears exact self-similarity into the statistical kind. The mathematical model reveals the underlying mechanism; nature adds noise on top.
L-systems appeared in 1968. The Mandelbrot set was first rendered by computer in 1978. A decade apart, from different research traditions, both pointing at the same core mechanism. Mathematics has given its answer: iteration is the generator of self-similarity.
But has nature ever built a real iteration machine — one that has been running for billions of years?
Biology: DNA and cell division¶
It has. And it is almost as old as life on Earth.
The earliest fossil evidence places cellular life on Earth roughly 3.5 billion years ago. From that point forward, DNA replication coupled with cell division has constituted a recursive engine that has never stopped running. Each time a cell divides, the entire genome is copied and handed to the daughter cell. This process has continued unbroken from the first single-celled organisms to the present moment — the retinal cells you are using to read this sentence, and every cell in your liver, bones, and skin, are all products of approximately 37 trillion divisions descending from a single fertilized egg.
This machine has several structural features worth examining closely.
Every part carries the blueprint of the whole. Each cell in your body (with a handful of exceptions, such as mature red blood cells) carries the complete genome — roughly 3.2 billion base pairs encoding all the information needed to construct the entire organism. A liver cell contains the full instructions for building an eye. A skin cell contains the complete code for assembling a brain. The reason a liver cell is a liver cell and not a neuron is not that it lacks certain information — it is that specific genes have been activated while others have been silenced. The information is complete; the expression is selective.
This is not a metaphor. It is molecular biology. The ancient image of the whole contained within the part — Sumeru in a mustard seed — finds its most literal biological instantiation here.
Encoding consistency across levels. From base pairs to codons, from codons to amino acids, from amino acids to proteins — the encoding mechanism obeys the same grammar at every level. Triplet combinations of four bases (A, T, G, C) translate into twenty amino acids, and this translation table is nearly universal across all known life. Whether the code runs inside E. coli or in a blue whale's neurons, the codon AUG encodes methionine, and UAA means "stop translating." The rule does not change with scale. It does not change with species.
A cell is not a passive container. A common misconception treats cells as inert storage devices — biological hard drives waiting to be read. But a single cell is a complete functional unit. It has its own energy metabolism (mitochondria), its own sensory and signaling apparatus (receptor proteins and signal transduction pathways), its own channels for material exchange with the environment (ion channels, endocytosis, exocytosis), and its own quality-control machinery (proteasomes that degrade misfolded proteins). A cell is not a cog in a larger machine — it is itself a complete, independently viable machine. Single-celled organisms proved this point long ago: one cell is one complete life.
Temporal self-similarity. Heredity introduces a dimension that neither L-systems nor Koch snowflakes possess: time. The Koch snowflake's self-similarity is spatial — zoom in on a portion and you see the same pattern as the whole. An L-system's self-similarity is across iteration levels — each replacement step produces the same branching motif. But biological heredity's self-similarity spans generations. Parent and offspring share the same genome. Grandparent and grandchild share the same encoding grammar. Humans and yeast share substantial numbers of homologous genes. Life's self-similarity is not only "zoom in and see the same pattern" — it is also "at every generation along the time axis, the same fundamental architecture is re-executed." And that time axis stretches back four billion years.
A clear disclaimer is needed here. Later articles in this series will discuss a structural mapping between the genome and the system prompt — both are "encoded information written into a system before runtime that shapes the system's subsequent behavior." But this mapping operates at the structural level, not the mechanistic level. The genome is read and executed by molecular machinery inside the cell — ribosomes, RNA polymerase, spliceosomes — physical entities that are themselves products of the genome but are distinct from it. A prompt, by contrast, is processed by the LLM itself — the same model is both reader and executor. The identity and mechanism of execution are entirely different; only the abstract pattern of "encoded information shaping downstream behavior at system initialization" is shared. Mistaking structural similarity for mechanistic equivalence is one of the most common and most dangerous traps in analogical reasoning.
Mathematics gave us the principle — iteration generates self-similarity. Biology gave us a real-world instance that has been running for four billion years, and this instance exhibits features absent from the mathematical models: every part carrying the complete blueprint of the whole, encoding grammar that is invariant across species, and generational self-similarity along the time axis.
Computation: Conway's Game of Life¶
In 1970, Martin Gardner introduced a cellular automaton invented by the British mathematician John Conway in his "Mathematical Games" column in Scientific American. The rules fit on the back of a napkin:
| Condition | Result |
|---|---|
| Live cell, fewer than 2 live neighbors | Dies (underpopulation) |
| Live cell, 2 or 3 live neighbors | Survives |
| Live cell, more than 3 live neighbors | Dies (overcrowding) |
| Dead cell, exactly 3 live neighbors | Becomes alive (reproduction) |
An infinite two-dimensional grid. Each cell is either alive or dead. Every tick, all cells update simultaneously according to those four rules. No player input. No random events injected. No external intervention. Set the initial state, press "go," and the system evolves on its own.
Start from a random initial configuration and the first few steps look like noise — cells dying and birthing in great swathes with no discernible pattern. But run it for a few dozen steps and something strange begins to happen. Chaos settles. Order condenses out of it.
First come stable static structures: 2x2 blocks, six-cell beehives. Under the B3/S23 rules, they are perfectly balanced — every live cell has exactly two or three live neighbors, so nothing changes. Then come periodic oscillators: the three-in-a-row "blinker" that alternates between horizontal and vertical forever; the "toad" that flips between two states every tick. Nobody designed these structures. They are natural stable solutions that arise wherever local conditions happen to satisfy the rules.
More remarkable still are the moving structures. The "glider" is a pattern of just five live cells that shifts one square diagonally every four ticks, indefinitely. It is not literally sliding — every tick, cells are dying and being born. But after four ticks, the original shape reappears, displaced by one unit. The entire movement is a precisely choreographed sequence of deaths and births, and that choreography is produced entirely by four local rules.
Later, people discovered the "glider gun" — a stable structure that periodically emits gliders. With guns and gliders, you have signal emission and transmission. With signals, you can build logic gates. With logic gates, you can in principle build any computer.
Conway's Game of Life was subsequently proven to be Turing complete. Four rules about life and death on a two-dimensional grid can, in principle, compute anything that is computable. Paul Rendell's 2016 monograph Turing Machine Universality of the Game of Life provides the full constructive proof.
But the story does not end there. There is a deeper fact, one directly relevant to self-similarity.
Through an ingenious construction called the OTCA metapixel, roughly two thousand Game of Life cells can be assembled into a "metacell." The cells inside this metacell obey the standard B3/S23 rules — the same rules as every other cell on the grid. But viewed from a distance, the metacell as a whole behaves exactly like a single Game of Life cell: when exactly three of its neighboring metacells are "alive," it switches from "dead" to "alive"; when fewer than two or more than three neighbors are alive, it "dies."
In other words, you can build a Game of Life inside the Game of Life. Each "pixel" in the inner game is not a single grid cell but a vast cluster of cells functioning as a unit — yet from far enough away, it follows the same four rules and produces the same gliders, oscillators, and still lifes. Everything is just a few thousand times larger and a few thousand times slower.
And in theory, the inner Game of Life can use metacells to build yet another Game of Life inside itself. The third layer's pixels are second-layer metacells, whose pixels are first-layer metacells. Layer after layer, each running the same B3/S23 rules, each producing the same emergent structures. There is no theoretical limit to the depth of nesting.
This is the simplest known instance of "computation within computation." A system uses its own fundamental elements to construct a complete copy of itself, running the same rules at a larger scale, producing the same emergent behavior.
Three lines converge¶
Step back and look at the three territories we just visited:
- Mathematics: L-system string replacement rules iterate into tree structures; \(z \to z^2 + c\) iterates into the Mandelbrot set. The mechanism is formal. The results are deterministic.
- Biology: DNA replication plus cell division has been iterating for four billion years, producing self-similarity in both space and time. The mechanism is molecular. The results are statistical.
- Computation: Four local rules on a two-dimensional grid iterate into self-organizing structures — and can even reconstruct themselves inside themselves. The mechanism is discrete. The results are emergent.
Three independent domains. Three entirely different substrates — symbolic systems, organic molecules, discrete grids. The same pattern: a simple rule, applied to its own output, executed repeatedly. No master architect required to lay out the global design. No carefully curated initial conditions. No step-by-step human intervention. Just a recursive process running long enough, and complex self-similar structures grow out of simple rules.
This also explains why self-similarity is so pervasive in nature: recursion is nature's cheapest construction strategy. Encoding a single rule requires far less information than encoding a complete complex structure. Growing complexity through iterated application of a simple rule is orders of magnitude cheaper, in information cost, than designing a complex system from scratch. Natural selection favors economical solutions — which is why a fern grows its shape through recursion rather than describing every leaf pixel-by-pixel in its genome.
But here we must add an honest footnote.
Recursion does not always produce self-similarity. Some recursive systems produce chaos — the Lorenz attractor is driven by three coupled differential equations where each step's output feeds into the next, which is unambiguously recursive. But its trajectory is exquisitely sensitive to initial conditions; while the overall motion is confined to a butterfly-shaped region, the internal structure does not repeat itself at every scale. Some recursive systems produce uniformity — the heat equation is recursive too (each moment's temperature distribution is determined by the previous moment's), but its iteration erases all local differences, converging toward the featureless equilibrium of thermal death. And some recursive systems produce simple periodicity — under certain initial conditions, the logistic map settles into a fixed-point cycle, neither chaotic nor self-similar.
Self-similarity is a common outcome of recursion, but not a guaranteed one. Recursion is a necessary condition, not a sufficient one.
So under what conditions does recursion produce self-similarity? Go back to the three examples and look for what they share.
The answer: self-similarity emerges when the recursive rule maintains structural consistency across levels. The L-system's replacement rule is identical at every iteration — the first replacement and the hundredth use the same rule — so every level of branching exhibits the same motif. DNA's encoding grammar is the same in E. coli and in every cell of a blue whale, so every cell carries the blueprint of the whole. The Game of Life's four rules apply identically to individual grid cells and to entire metacells, so metacells can reproduce single-cell behavior.
Rule invariance across scales — it sounds simple, but it is precisely the critical condition. Remove it and everything changes. Give an L-system a different replacement rule at each level, and the output is no longer a self-similar tree but an unpredictable hybrid.
Cross-scale rule invariance is the true generator of self-similarity.
Fractal dimension: measuring self-similarity¶
So far, "self-similarity" has been a qualitative description — we say a structure "looks similar at different scales," but how similar? Is a fern "more" self-similar than a coastline? Is there a ruler that can quantify the property?
There is. It is called fractal dimension.
Recall the British coastline from the previous article: fractal dimension \(D \approx 1.25\). We said that number means "the coastline's complexity lies somewhere between one-dimensional and two-dimensional," but we did not explain where the number comes from.
Box-counting dimension: the intuition
Imagine covering a geometric object with square boxes of side length \(\varepsilon\), and counting the minimum number \(N(\varepsilon)\) of boxes needed to cover it completely. Then shrink the boxes and count again. Repeat, and watch how \(N\) grows as \(\varepsilon\) shrinks.
- If the object is a straight line segment: \(N \propto \varepsilon^{-1}\). Halve the box size, double the count. The signature of a one-dimensional object.
- If the object is a filled square: \(N \propto \varepsilon^{-2}\). Halve the box size, quadruple the count. The signature of a two-dimensional object.
- If the object is a Koch snowflake: \(N \propto \varepsilon^{-1.26}\). Halve the box size, and the count increases by a factor of about \(2^{1.26} \approx 2.4\) — more than a line, less than a surface.
The fractal dimension \(D\) is the exponent of that growth rate:
For the Koch snowflake, the dimension can be computed exactly. Each iteration replaces a line segment with 4 segments, each \(1/3\) the length of the original (the middle third is replaced by two sides of an equilateral triangle). The self-similarity ratio is \(r = 1/3\), the number of self-similar pieces is \(N = 4\), so:
What does \(D = 1.25\) for the British coastline mean in practice? It is more complex than a smooth curve (\(D = 1\)) — there is a wealth of detail and irregularity, and halving the measurement scale reveals more than a linear increase in new features. But it is not complex enough to fill an area (\(D = 2\)). It sits between one dimension and two — at precisely 1.25 dimensions.
The engineering value of fractal dimension is this: it is a cross-domain complexity fingerprint.
The British coastline has \(D \approx 1.25\). The Koch snowflake has \(D \approx 1.26\). Nearly identical — yet these two structures come from completely different origins. One is an ideal curve constructed by a mathematician with a deterministic rule. The other is a natural landform sculpted by millions of years of wave erosion and geological process. On the dimension of "how does complexity grow with measurement precision," they behave almost identically. Fractal dimension maps structurally diverse objects onto a single scale, making cross-domain structural comparison possible.
The branching pattern of a fern and the branching pattern of a river network may share a similar fractal dimension. The frequency fluctuations of a musical signal and the price fluctuations of a stock may share a similar fractal dimension. This does not mean their physical mechanisms are related — ferns do not care about stock prices, and rivers do not follow musical scales. But it does mean that the recursive processes generating these structures share a common abstract property: the degree to which they maintain structural consistency across scales.
That is the real power of fractal dimension as an engineering tool: it does not describe content. It describes the shape of complexity. When you measure similar fractal dimensions in two seemingly unrelated systems, you have a lead worth pursuing — perhaps the generative mechanisms behind them share some structural feature, even if on the surface they have nothing in common. Fractal dimension is a probe for discovering hidden connections, not merely a label for cataloguing known complexity.
From the generator to worlds within worlds¶
Recursion is the generator of complexity. A simple rule applied repeatedly to its own output, under the right conditions — particularly when the rule remains invariant across scales — produces emergent self-similarity. Mathematics proved it with L-systems and the Mandelbrot set. Biology confirmed it with four billion years of cell division. Computation pushed it to its logical extreme with four rules and a two-dimensional grid — the Game of Life running another Game of Life inside itself.
That last example is worth pausing on.
A system uses its own elements to construct a complete copy of itself, running the same rules at a larger scale, producing the same emergent behavior. This is not merely "the part looks like the whole" — this is the whole being fully re-implemented inside the part. The outer Game of Life has no idea that another Game of Life is running inside it. The inner Game of Life has no idea that each of its pixels is actually a vast colony of cells in the outer game. Two levels, each independently obeying the same rules, each independently producing the same structures.
A world within a world. And the inner world follows the same laws.
This structure — not just resemblance, but complete re-implementation from the inside — is what the next article explores. When recursive nesting goes deep enough, "the part contains the whole" stops being a figure of speech. It becomes an operational engineering fact.