In 1923, Sir Francis Walshe, a British neurologist, noticed something interesting while testing the reflexes of patients who were paralyzed on one side of their bodies. When they yawned, they would spontaneously regain their motor functions. In case after case, the same thing happened; it was as if, for the six or so seconds the yawn lasted, the patients were no longer paralyzed. What’s more, Walshe reported that some of his patients had noticed “that when the fingers are extended and abducted during a yawn, they are able to flex and extend them rapidly, a thing they were unable to do at any other time. Indeed, one man added that he always waited for a yawn so that he might exercise his fingers in this way.”

Walshe concluded that yawning was activated by a primal center of the brain that fell outside conscious control. One’s ability to yawn could thus remain completely intact, even when “cortical control is more or less completely abolished over the musculature of one half of the body.” Yawning, then, was one of our most primitive, fundamental behaviors—a conclusion that echoed Charles Darwin’s observation, in 1838, that “seeing a dog & horse & man yawn, makes me feel how much all animals are built on one structure.”

Yawning is one of the first things we learn to do. “Learn” may not even be quite the right word. Johanna de Vries, a professor of obstetrics at Vrije University Amsterdam, has discovered that the human fetus yawns during its first trimester in the womb. And, unless we succumb to neurodegenerative disease, yawning is something we keep doing throughout our lives. “You don’t decide to yawn,” Robert Provine, a neuroscientist and the author of “Curious Behavior: Yawning, Laughing, Hiccupping, and Beyond,” told me. “You just do it. You’re playing out a biological program.” We yawn unconsciously and we yawn spontaneously. We can’t yawn on command—and we sometimes can’t stop ourselves from letting out a big yawn, even at the most inopportune times. (Case in point: Sasha Obama’s infamous yawn during her father’s 2013 Inaugural Address.) But what, precisely, are we accomplishing with all this yawning? If it’s so evolutionarily old, it must be doing something important to have survived.

In 400 B.C., Hippocrates speculated that yawning was somehow related to fever: we yawned to expel the bad air that had accumulated inside our bodies, making us ill, much like “the large quantities of steam that escape from cauldrons when water boils.” That intuition has proved remarkably resilient. As recently as 2011, the psychologist Gordon Gallup argued that the yawn is a cooling mechanism for the brain and the body. But the evidence for those theories has been decidedly mixed, and, for now, the physiological function of the yawn remains elusive. As Provine puts it, “Yawning may have the dubious distinction of being the least understood, common human behavior.”

A more reliable clue to why we yawn may come from when, precisely, we do so. We usually think of yawning as a signal of sleepiness or boredom—one of the reasons Sasha Obama’s yawn seemed so inappropriate. Indeed, fatigue and boredom do reliably elicit yawns. While yawning isn’t actually related to the amount of sleep we get—how physiologically tired we are—or the time of day we choose to wake up and go to bed, it does seem to grow more intense when we’re feeling subjectively sleepy. In a series of studies conducted in the eighties and nineties, Provine demonstrated that people report yawning more frequently when they are feeling tired. They are especially prone to yawning in the hour immediately after waking and the hour preceding their usual bedtimes. Yawning also increases with boredom. In one experiment, Provine’s subjects yawned far more frequently when looking at static than when watching music videos. We also yawn when we’re getting hungry—a tendency we appear to share with other primates.

Boredom, hunger, fatigue: these are all states in which we may find our attention drifting and our focus becoming more and more difficult to maintain. A yawn, then, may serve as a signal for our bodies to perk up, a way of making sure we stay alert. When the psychologist Ronald Baenninger, a professor emeritus at Temple University, tested this theory in a series of laboratory studies coupled with naturalistic observation (he had subjects wear wristbands that monitored physiology and yawning frequency for two weeks straight), he found that yawning is more frequent when stimulation is lacking. In fact, a yawn is usually followed by increased movement and physiological activity, which suggests that some sort of “waking up” has taken place.

“You yawn when you’re obviously not bored,” Provine points out. “Olympic athletes sometimes yawn before their events; concert violinists may yawn before playing a concerto.” Provine once had a lab member who had been part of the Army Special Forces. As part of his research, he decided to look at soldiers who were preparing to jump from an airplane for the first time. The incidence of yawning went up just before they made their way to the cabin door. A yawn, Provine believes, may simply signal a change of physiological state: a way to help our mind and body transition from one behavioral state to another—“sleep to wakefulness, wakefulness to sleep, anxiety to calm, boredom to alertness.” So, rather than condemn poor Sasha, we may be better off praising her: in yawning, her body may have been making an effort to reëngage itself rather than succumb to fatigue or hunger.

Yet the idea that we yawn when we’re about to change states is unlikely to be the whole story, for one simple reason: we yawn, most reliably of all, when we see or hear others yawning—whether or not we happen to be feeling particularly drowsy or bored or anxious or hungry ourselves. It’s a phenomenon known as contagious yawning. We also yawn when we so much as think about yawning: in one of Provine’s studies, eighty-eight per cent of people who were instructed to think of yawns yawned themselves within thirty minutes. We yawn when we read about it. “One reason my enthusiasm for studying contagion diminished is because everything causes yawning,” Provine says. (Are you yawning yet?)

Why are yawns so contagious? Does the fact that we catch them from one another shed light on their underlying function? One possibility is that contagious yawning serves as a way of showing empathy. While all vertebrate mammals experience spontaneous yawning, only humans and our closest relatives, chimpanzees, seem to experience the contagion effect—a sign that there may be a deeper social meaning to the experience. What’s more, while spontaneous yawning occurs in the womb, contagious yawning develops only later in life, as does empathy. Children younger than five don’t yawn any more often when watching videos of yawns than they would normally.

Proponents of the empathy theory cite evidence from studies of closeness: how close we feel to someone affects how likely we are to yawn when they do. We’re more likely to catch a yawn from a family member versus a friend, a friend versus an acquaintance, and an acquaintance versus a stranger. Recent evidence suggests that the effect extends to race: we catch yawns more easily from members of our own race than from members of different races. Chimpanzees and bonobos share this pattern of favoritism. In one recent study, Frans de Waal and Matthew Campbell had two groups of chimpanzees watch a series of videos. In some videos, they saw familiar chimpanzees either yawning or resting, and in others they saw unfamiliar chimpanzees doing the same thing. Both groups yawned more frequently when watching their own group members yawn. A similar pattern was observed in bonobos, who yawned more frequently the stronger their social bond with the yawner. Some scientists cite further evidence from studies of subjects with schizophrenia and autism: in both cases, contagious yawning is diminished, though spontaneous yawning remains intact.