In 2004, Thomson met Paul Andrews, an evolutionary psychologist at Virginia Commonwealth University, who had long been interested in the depression paradox — why a disorder that’s so costly is also so common. Andrews has long dark brown hair and an aquiline nose. Before he begins to talk, he often writes down an outline of his answer on scratch paper. “This is a very delicate subject,” he says. “I don’t want to say something reckless.”

Andrews and Thomson struck up an extended conversation on the evolutionary roots of depression. They began by focusing on the thought process that defines the disorder, which is known as rumination. (The verb is derived from the Latin word for “chewed over,” which describes the act of digestion in cattle, in which they swallow, regurgitate and then rechew their food.) In recent decades, psychiatry has come to see rumination as a dangerous mental habit, because it leads people to fixate on their flaws and problems, thus extending their negative moods. Consider “The Depressed Person,” a short story by David Foster Wallace, which chronicles a consciousness in the grip of the ruminative cycle. (Wallace struggled with severe depression for years before committing suicide in 2008.) The story is a long lament, a portrait of a mind hating itself, filled with sentences like this: “What terms might be used to describe such a solipsistic, self-consumed, bottomless emotional vacuum and sponge as she now appeared to herself to be?” The dark thoughts of “The Depressed Person” soon grow tedious and trying, but that’s precisely Wallace’s point. There is nothing profound about depressive rumination. There is just a recursive loop of woe.

The bleakness of this thought process helps explain why, according to the Yale psychologist Susan Nolen-Hoeksema, people with “ruminative tendencies” are more likely to become depressed. They’re also more likely to become unnerved by stressful events: for instance, Nolen-Hoeksema found that residents of San Francisco who self-identified as ruminators showed significantly more depressive symptoms after the 1989 Loma Prieta earthquake. And then there are the cognitive deficits. Because rumination hijacks the stream of consciousness — we become exquisitely attentive to our pain — numerous studies have found that depressed subjects struggle to think about anything else, just like Wallace’s character. The end result is poor performance on tests for memory and executive function, especially when the task involves lots of information. (These deficits disappear when test subjects are first distracted from their depression and thus better able to focus on the exercise.) Such research has reinforced the view that rumination is a useless kind of pessimism, a perfect waste of mental energy.

That, at least, was the scientific consensus when Andrews and Thomson began exploring the depression paradox. Their evolutionary perspective, however — they see the mind as a fine-tuned machine that is not prone to pointless programming bugs — led them to wonder if rumination had a purpose. They started with the observation that rumination was often a response to a specific psychological blow, like the death of a loved one or the loss of a job. (Darwin was plunged into a debilitating grief after his 10-year-old daughter, Annie, died following a bout of scarlet fever.) Although the D.S.M. manual, the diagnostic bible for psychiatrists, does not take such stressors into account when diagnosing depressive disorder — the exception is grief caused by bereavement, as long as the grief doesn’t last longer than two months — it’s clear that the problems of everyday life play a huge role in causing mental illness. “Of course, rumination is unpleasant,” Andrews says. “But it’s usually a response to something real, a real setback. It didn’t seem right that the brain would go haywire just when we need it most.”

Imagine, for instance, a depression triggered by a bitter divorce. The ruminations might take the form of regret (“I should have been a better spouse”), recurring counterfactuals (“What if I hadn’t had my affair?”) and anxiety about the future (“How will the kids deal with it? Can I afford my alimony payments?”). While such thoughts reinforce the depression — that’s why therapists try to stop the ruminative cycle — Andrews and Thomson wondered if they might also help people prepare for bachelorhood or allow people to learn from their mistakes. “I started thinking about how, even if you are depressed for a few months, the depression might be worth it if it helps you better understand social relationships,” Andrews says. “Maybe you realize you need to be less rigid or more loving. Those are insights that can come out of depression, and they can be very valuable.”

This radical idea — the scientists were suggesting that depressive disorder came with a net mental benefit — has a long intellectual history. Aristotle was there first, stating in the fourth century B.C. “that all men who have attained excellence in philosophy, in poetry, in art and in politics, even Socrates and Plato, had a melancholic habitus; indeed some suffered even from melancholic disease.” This belief was revived during the Renaissance, leading Milton to exclaim, in his poem “Il Penseroso”: “Hail divinest Melancholy/Whose saintly visage is too bright/To hit the sense of human sight.” The Romantic poets took the veneration of sadness to its logical extreme and described suffering as a prerequisite for the literary life. As Keats wrote, “Do you not see how necessary a World of Pains and troubles is to school an intelligence and make it a soul?”

But Andrews and Thomson weren’t interested in ancient aphorisms or poetic apologias. Their daunting challenge was to show how rumination might lead to improved outcomes, especially when it comes to solving life’s most difficult dilemmas. Their first speculations focused on the core features of depression, like the inability of depressed subjects to experience pleasure or their lack of interest in food, sex and social interactions. According to Andrews and Thomson, these awful symptoms came with a productive side effect, because they reduced the possibility of becoming distracted from the pressing problem.