How a tree builds itself from one rule
2026-05-06
A tree is not designed branch by branch. It is built from a single instruction, repeated. Draw a trunk. At its tip, draw two smaller trunks at angles. Then do that again, on each new trunk, forever.
Drag depth. Each notch is one more generation of branching. Drag angle to change the species.
branches - · 2d+1−1
That's the whole rule. Two children for every parent, each one a little shorter, each one rotated. The complexity is not in the rule; it is in the repetition.
A tree contains two trees
Look closely at any branch. The shape it carries is a smaller, rotated version of the whole tree. Each child branch is a tree. Two trees, joined at a trunk, make a tree.
That is what recursion means: an object defined in terms of smaller copies of itself. The whole hides inside its own parts. Each part is a whole. You don't need to describe every leaf - you describe the rule, and the rule describes itself.
Why the count doubles
One trunk at depth 0. Two children at depth 1. Four grandchildren at depth 2. The branch count at depth d is exactly 2d. Add up every level and you get the total:
1 + 2 + 4 + ... + 2d = 2d+1 − 1
At depth 10, that's 2047 branches drawn from a recipe that fits in two lines. The drawing scales exponentially with the depth slider; the rule does not change.
Why the angle changes the species
Slide angle. At small angles, the branches barely diverge - the tree becomes a feather, all going up. At large angles, branches lay sideways and the tree opens into a fan or a coral. Real trees are tuned by light, gravity, and water; this one is tuned by a slider, and the same fingertips appear in all of them.
The angle is the tree's DNA. One number, plus the rule, picks a species.
Where else this hides
A folder contains files and folders.
A sentence contains clauses, which contain sentences.
A list is an item plus another list.
A fraction's denominator can be another fraction.
A function can call itself.
A reflection contains the reflection of the reflection.
Every one of these is the same shape as the tree. Two halves, each defined in terms of the whole. You build infinity by repeating yourself.
A small honesty about infinity
The rule is infinite; the picture is not. We stop at depth 10 because beyond that the branches are thinner than a pixel and the browser starts hating you. Real trees stop because of physics: a branch can't get arbitrarily thin and still hold its twig up. A function call can't recurse forever or it runs out of memory.
The pattern doesn't terminate. The realisation always does.
One trunk. Two children. Repeat. Watch a forest fall out.