Julius Henry Marx in 'Duck Soup,' 1933. He knew 'Groucho' was funnier. Mary Evans/Paramount Pictures/Ronald Grant/Everett Collection

"I just shot an elephant in my pajamas," goes the old Groucho Marx joke. "How he got in my pajamas I don't know."

You've probably heard that one before, or something similar. For example, while viewing polling data for the 2008 presidential election on Comedy Central, Stephen Colbert deadpanned, "If I'm reading this graph correctly…I'd be very surprised."

Zingers like these aren't just good lines. They reveal something unusual about how the mind operates—and they show us how humor works. Simply put, the brain likes to jump the gun. We are always guessing where things are going, and we often get it wrong. But this isn't necessarily bad. It's why we laugh.

It turns out that humor is a form of mental exercise, and we benefit from it in the same way we benefit from a long run or a tough spin class. Scott Weems, author of "Ha! The Science of When We Laugh and Why" explains how humor increases mental stamina and flexibility. Photo: Getty.

Humor is a form of exercise—a way of keeping the brain engaged. Mr. Colbert's line is a fine example of this kind of mental calisthenics. If he had simply observed that polling data are hard to interpret, you would have heard crickets chirping. Instead, he misdirected his listeners, leading them to expect ponderous analysis and then bolting in the other direction to declare his own ignorance. He got a laugh as his audience's minds caught up with him and enjoyed the experience of being fooled.


The benefits of humor don't stop with increased intelligence and creativity. Consider the "cold pressor test," in which scientists ask subjects to submerge their hands in water cooled to just above the freezing mark.

This isn't dangerous, but it does allow researchers to measure pain tolerance—which varies, it turns out, depending on what we've been doing before dunking our hands. How long could you hold your hand in 35-degree water after watching 10 minutes of Bill Cosby telling jokes? The answer depends on your own pain tolerance, but I can promise that it is longer than it would be if you had instead watched a nature documentary.

Like exercise, humor helps to prepare the mind for stressful events. A study done in 2000 by Arnold Cann, a psychologist at the University of North Carolina, had subjects watch 16 minutes of stand-up comedy before viewing "Faces of Death"—the notorious 1978 shock film depicting scene after scene of gruesome deaths. Those who watched the comedy routine before the grisly film reported significantly less psychological distress than those who watched a travel show instead. The degree to which humor can inoculate us from stress is quite amazing (though perhaps not as amazing as the fact that Dr. Cann got his experiment approved by his university's ethical review board).

This doesn't mean that every sort of humor is helpful. Taking a dark, sardonic attitude toward life can be unhealthy, especially when it relies on constant self-punishment. (Rodney Dangerfield: "My wife and I were happy for 20 years. Then we met.") According to Nicholas Kuiper of the University of Western Ontario, people who resort to this kind of humor experience higher rates of depression than their peers, along with higher anxiety and lower self-esteem. Enjoying a good laugh is healthy, so long as you yourself aren't always the target.

Having an active sense of humor helps us to get more from life, both cognitively and emotionally. It allows us to exercise our brains regularly, looking for unexpected and pleasing connections even in the face of difficulties or hardship. The physicist Richard Feynman called this "the kick of the discovery," claiming that the greatest joy of his life wasn't winning the Nobel Prize—it was the pleasure of discovering new things.

By providing this sort of kick, humor lets our brains regularly experience the delight of discovery even if we aren't scientists—which is fortunate, because most of are about as likely to get a doctorate in physics as we are to write for "The Colbert Report."

—Dr. Weems is a researcher at the University of Maryland and the author of "Ha! The Science of When We Laugh and Why," published by Basic Books.