When we are bored or sleepy, we yawn or sometimes when we see someone yawn, and you feel like yawning yourself. But what really is yawning? There hasn't been a very conclusive answer yet, but scientists have found a surprising link between the length of a yawn and the size of the brain.
Scientists from the State University of New York came to this realization by first considering such animals as gorillas and elephants - they are bigger than us and yet have smaller brains. And interestingly, they all yawn for shorter times than humans. Researchers hypothesized that brain size (rather than body size) is linked to the yawn length.
Importantly, neither the size of the body nor the anatomical structures specific to yawning (cranium and mandible) are driving these effects, because gorillas, camels, horses, lions, walruses, and African elephants all have shorter average yawns than humans.
Psychologist Andrew Gallup, one of the researchers in the study that the purpose of yawning may be to cool the brain. If you (as an animal) did have a larger brain, it makes sense that it would take longer to cool it (by yawning).
Gallup has some data to prove his idea. He implanted temperature probes in rats brains and showed that yawning does, in fact, seem to cool their brains. Another experiment he performed showed that people who hold something cooling like a cold pack to their heads, are less likely to start yawning (even if others are yawning away).