The sight of murmurating starlings is pretty awe-inspiring. But the science behind the mass, orchestrated bird dance is even more so.

Mathematical analysis has shown that the spectacle is a result of every starling’s movement affecting and being affected by the movement of every other starling. In other words, it’s as if the many operate as one. Remarkably, this is true regardless of the size of the group. Every bird hangs close to its neighbor, and mimics his or her activity. This means that when one starling goes its own way, the others immediately surrounding it follow, and fluid, swirling patterns result. The phenomenon is called scale-free correlation.

By staying together in a flock, the starlings increase their chances of survival against an attack. By being “critical,” or capable of incredibly fast transformations and transitions, the birds employ a unique sort of armor. Their coordinated-yet-unplanned shape-shifting function resembles a phase transition—like a liquid turning to gas. It's also sort of like chaos theory at work in nature.

Experts are still trying to untangle how, exactly, starlings manage this intricate dance, and to understand the implications of such hardwiring. (Biological criticality in general is something researchers have yet to fully explain.) For now, it remains a scientific mystery—and a beautiful one at that.