All Together Now
or, why ten thousand fireflies agree
There is a riverbank in Thailand — or Malaysia, or Borneo, take your pick — where, on the right kind of warm humid night, you can watch a thing that should not be possible.
The trees along the river are home to many thousands of fireflies, the species Pteroptyx malaccae. Each firefly has a small light organ in its abdomen, and each firefly flashes that organ on and off in a regular rhythm, roughly once a second. So far, this is the firefly behavior anyone who grew up near a hayfield has seen.
But these fireflies do not flash on their own. They flash together. Every firefly in the riverbank trees, as far as the eye can see, lights up at the same instant, goes dark at the same instant, lights up again together, all night, for hours. The trees pulse. Whole sections of riverbank wash from black to dim green to bright green to black again, like a kilometer-long organism breathing. The first European to publish an account of this, the American naturalist Hugh Smith, wrote it up in Science in 1935. Most of his colleagues did not believe him. They suggested he had seen fireflies in a single tree, or that the wind had moved branches in the same way at the same time, or that he had misjudged what synchrony actually was. It took until the 1960s, when the entomologist John Buck went to Thailand and filmed it, before the phenomenon was admitted into the textbooks.
The fireflies are not pretending to be one organism. There is no leader. There is no signal-master sending out the timing pulse. There is no shared clock. Every firefly is producing its own beat from a chemistry inside its own abdomen, and yet ten thousand of them — many of which cannot even see each other directly — manage to find a single phase together and stay in that phase, for hours, without anyone in charge.
fireflies.mp4.This is synchronization. It is showing up in a lot of places at once, and we mostly do not notice.
The first written observation of synchronization that I know of belongs to Christiaan Huygens, the Dutch physicist who invented the pendulum clock in 1656 and spent the rest of his life thinking about how to make timekeeping accurate enough to navigate at sea. In February of 1665 he was sick in bed, and he had two of his pendulum clocks hanging on the same wooden beam in his bedroom. He noticed, idly, that the pendulums were swinging in opposite directions but with exactly the same period — perfectly anti-synchronized, the way two children on swings can be if they push off at the right moment. Huygens did the obvious experiment. He stopped one pendulum, restarted it out of phase, and watched. Within thirty minutes the two pendulums had drifted back into anti-sync and locked there again.
He called the effect, in a letter to the Royal Society, an odd kind of sympathy. He understood roughly what was happening: tiny vibrations from each clock traveled through the wooden beam and nudged the other clock’s pendulum, and over time those nudges accumulated into a stable phase relationship. He had discovered, sitting in bed with the flu, that two oscillators coupled even very weakly will tend to lock together rather than drift apart.
This turns out to be a deep fact about the universe. It is not a quirk of pendulum clocks. It is not a quirk of fireflies. It is a quirk of oscillators — of any system that has a regular rhythm, when you couple two or more of them with even the weakest connection.
The list of consequential cases is long. Pacemaker cells in your heart are oscillators; they sync via electrical signaling, and the result is a single coordinated heartbeat where dozens of independent cells could otherwise be firing chaotically. (When that synchronization fails, the failure is called fibrillation. It kills people.) Neurons in your brain are oscillators; their group synchronization produces brain waves, and the loss or excess of synchronization shows up in seizures, in anesthesia, in different states of consciousness. Audiences clap into rhythm without anyone telling them to. Menstrual cycles in some species (less so in humans, despite a famous old paper) have weak sync tendencies. The moon’s rotation has tidally locked to its orbit around the Earth, which is why we always see the same face. The world’s electrical grids are vast forests of synchronized AC oscillators, and the reason your toaster works in California while it was cooked up in a power plant a hundred and fifty miles away is the same odd kind of sympathy Huygens noticed in his sickbed.
And, beautifully — embarrassingly — in the year 2000 the city of London opened a brand-new pedestrian bridge across the Thames, the Millennium Bridge, and within a few hours of its first day of public use the bridge began to sway sideways disturbingly. The reason was synchronization. Pedestrians, walking at slightly different rates, had spontaneously coupled with each other through the small lateral oscillations of the bridge surface itself. Each pedestrian’s footfall rocked the bridge a tiny amount, the bridge’s rocking nudged the next pedestrian to step in time, the next pedestrian’s footfall added to the rocking, and within a few minutes hundreds of strangers were marching in lockstep without realizing it, swaying the bridge so violently they had to grab the railings. The bridge was closed within two days. It cost five million pounds and two years to fix. The fix was to add dampers to break the coupling.
Nobody on the bridge wanted to march in lockstep. Nobody told them to. The bridge made them.
millennium_bridge.mp4.The math of this was finally tidied up in 1975 by the Japanese physicist Yoshiki Kuramoto, who was studying chemical oscillations and decided to see what would happen if you wrote down the simplest possible model of N coupled oscillators with slightly different natural rhythms. His model, which is now one of the cleanest pieces of mathematical physics in the literature, says this:
Each oscillator i has its own preferred rate ωi, slightly different from its neighbors’. Each oscillator’s phase φi ticks forward at that rate, plus a coupling term: a sum, over all the other oscillators, of the sine of the phase difference. The factor K in front controls how strong the coupling is.
And here is the surprising thing. If you start with all the oscillators out of phase, and you set K to zero, they stay out of phase forever — each one drifts at its own rate, and the population looks like a heap of unrelated metronomes. If you raise K above some critical threshold, suddenly — not gradually, suddenly — the population locks in. They find a single common rhythm and stay in it, even though every individual has a slightly different preferred rate. The fast ones slow down a bit. The slow ones speed up a bit. The whole population finds a compromise, and once they find it, they hold it.
This is a phase transition. It is the same kind of mathematical event as water freezing into ice. There is a critical coupling strength, and below it you have liquid disorder; above it, a solid coordinated rhythm. There is no design in any of this. There is no leader. There is only the sine of phase differences and the math doing what the math does.
Synchronization is the temporal cousin of flocking. In Three Rules you can see what happens when many independent agents follow simple local rules to coordinate their positions in space; you get a flock. Here, you see what happens when many independent oscillators follow simple local rules to coordinate their phases in time; you get a heartbeat, a brain wave, an evening of fireflies, a swaying bridge, an electrical grid that lights a continent. Different domain. Same trick.
And once you see this, you can start asking the deeper question: how much of what looks coordinated in the universe is really designed, and how much is just oscillators with weak coupling getting their math? Most of it, I would guess. The universe seems to want sync the way it wants flocking: not because anyone wills it, but because the equations describing very general physical systems make it extremely cheap to find. Coordination is a free lunch the universe keeps eating.
The Experiment
Below is a grid of fireflies. Each one is an oscillator with its own slightly different natural rhythm and its own initial phase. Each one is influenced by its neighbors via the Kuramoto coupling term — the sum of sines of phase differences — and you control how strong that coupling is.
The brightness of each firefly is determined by its current phase: it lights up when the phase passes through its peak, then fades as the phase moves on. Underneath the grid is a real-time trace of the population’s order parameter, a number between 0 and 1 that measures how synchronized the population is. Order 0 is total disagreement, every firefly doing its own thing. Order 1 is perfect synchrony, every firefly flashing at exactly the same instant.
Things to try:
Start with K = 0. The fireflies all twinkle at their own rates; the grid is glittery static. The order parameter stays low, near zero, drifting between roughly 0.05 and 0.20.
Slowly raise K. Up to about K = 1.0 with default settings, you should see partial synchronization beginning — clumps of fireflies in the same phase, drifting in and out of agreement. The order parameter ticks up.
Push K past about 2 and you should see the phase transition: the entire grid locks. You see waves of brightness propagating across it, and within thirty seconds the grid is pulsing as one. Order parameter climbs above 0.85. This is the moment Smith and Buck saw on the riverbank in Thailand.
Now slowly drop K back. The locked rhythm decays gracefully — the grid de-syncs in roughly the reverse of how it synced. Notice that you have to drop K below the threshold you needed to reach lock; the system has hysteresis, the way a magnet does.
Crank the frequency spread to its maximum. Even with high K, the grid struggles to lock, because the natural rhythms differ too much — every firefly is fighting harder against the consensus. There is a Goldilocks band where coupling beats spread; outside it, no sync.
Set the coupling reach to 1, so each firefly only sees its closest neighbors. With high K you get patches of local sync but no global lock — a tiled pattern of small synchronized neighborhoods that can’t talk to each other. Now set reach to 6 (full coupling); the whole grid locks easily. The reach of an individual’s influence determines whether the whole population can find each other or only its immediate company.
Hit Scramble phases while sync is locked. The grid loses its rhythm momentarily, then re-locks within seconds. Hit Reroll frequencies to give each firefly a new natural rhythm and watch the population search for a new compromise.
If you sit with this for a few minutes — especially the moment when the grid abruptly locks — you will feel something I find difficult to describe in any other way: the system reaches a decision. Nobody decided. The decision was already in the math.
For the spatial cousin of this phenomenon, see Three Rules. They are the same kind of trick, played in different registers. A flock is many agents agreeing in space. A synchrony is many agents agreeing in time. The universe, as far as we can tell, finds both of them irresistible.