There’s a lot of maths — and a bit of astronomy — behind the sideways swing of a ponytail.

If you go for a run, your head bobs up and down a little bit as you move forward. But if you’ve got a ponytail, something weird happens. As you run forward, and your head bobs up and down, the ponytail attached to it swings from side-to-side.

Where does this sideways movement come from? The mystery of the swinging ponytail was solved in 2010 by one of the great mathematicians of the last century, Joseph B Keller.

### A mathematician for all seasons

Keller saw mathematics in everything.

He worked out how to reduce the dripping of tea from a teapot — you simply pour the tea more rapidly. (It’s easier to do this if you only partly fill the pot).

He used the theory of queues to explain why adding just a few extra airline flights per hour could cause massive delays.

He even worked out why an earthworm could easily move across your favourite fluffy bedspread, while a snake could not. (The snake has a backbone and it needs friction to move forward — which it can’t find on a fluffy bedspread. But an earthworm has no backbone and can move forward just by sending waves of expansion and contraction along its body).

Keller also did lots of work for the military.

During World War II, he developed his geometrical theory of diffraction. It explored how to use sonar to find submarines and explosive mines underwater.

More importantly, his theory showed how waves — whether they were acoustic or electromagnetic — could bounce off objects and even bend around corners.

He then used this knowledge to design antennas for sonar and radar, and even showed how to optimise the shape a vehicle to avoid detection — what today we call stealth technology.

But Keller also did stuff just for fun — why ponytails swing from side to side.

To solve the ponytail problem he had to go back to the work of the American astronomer G W Hill.

Hill’s work wasn’t hair-based at all. He was trying to work out if the orbit of the moon around the Earth was stable.

So in 1886 he derived what is now known as Hill’s equation. This equation was essential to understanding the ponytail’s sideways moves.

### Ponytail swings: The old 1-2

So let’s think about the ponytail as being a swinging pendulum, which has its own natural frequency.