A large-scale animal study has revealed something rather interesting about yawning: Vertebrates with larger brains and more neurons tend to have longer-lasting yawns.

Researchers collected data on 1,291 separate yawns from zoo trips and online videos, covering a total of 55 mammal species and 46 bird species, and found "robust positive correlations" between how long an animal yawns for and the size of its brain.

"We went to several zoos with a camera and waited by the animal enclosures for the animals to yawn," says ethologist Jorg Massen from Utrecht University in the Netherlands. "That was a pretty long haul."

The study could fill in some of the gaps in our knowledge about yawning – including why it happens in the first place, and why animals such as giraffes have no need to bother with yawning at all.

"Although the pattern of yawning is fixed, its duration has co-evolved with brain size and neuron numbers," write the researchers in their new paper.

"Moreover, this function seems to be conserved across a diverse range of animals, such that its evolutionary origin may be traced back to at least the common ancestor of birds and mammals and potentially even further."

The analysis was set up to test a hypothesis put forward in 2007 by one of the researchers that worked on this study: that yawning is an essential way of cooling down the brain. It therefore follows that bigger brains need longer yawns to properly cool them.

That would seem to be backed up by this data, which also shows that mammals yawn longer than birds. Birds have a higher core temperature than mammals, which means a greater temperature difference with the surrounding air, which means a shorter yawn is enough to drag in some cooler air.

Similar conclusions were reached in a 2016 study involving humans, though in that case only 205 yawns and 24 species were measured. It found the shortest yawns (0.8 seconds) came from mice, with the longest yawns (6.5 seconds) coming from humans.

"Through the simultaneous inhalation of cool air and the stretching of the muscles surrounding the oral cavities, yawning increases the flow of cooler blood to the brain, and thus has a thermoregulatory function," explains ethologist Andrew Gallup from the State University of New York (SUNY).

The researchers don't make any link to intelligence, only the size of the brain and the number of neurons it packs in; nor is there any reference to the frequency of yawning. For example, we humans tend to yawn between 5-10 times a day.

It's contagious too, as you might have noticed. One hypothesis for this is that it serves a social function, getting a group into the same state of mind and perhaps helping to synchronize sleeping patterns. (More research will be needed to figure out that one, though.)

"Getting video footage of so many yawning animals requires quite some patience, and the subsequent coding of all these yawns has made me immune to the contagiousness of yawning," observed biologist Margarita Hartlieb from the University of Vienna, Austria.

While there's more research to be done to tease out the reasons for why we yawn at all, the study authors conclude that "these findings provide further support for distinct predictions derived from the brain cooling hypothesis."

The research has been published in Communications Biology.