And this isn’t the only reason that sweet snacks are featured prominently at the cash register, just when shoppers are depleted after all their decisions in the aisles. With their willpower reduced, they’re more likely to yield to any kind of temptation, but they’re especially vulnerable to candy and soda and anything else offering a quick hit of sugar. While supermarkets figured this out a long time ago, only recently did researchers discover why.

The discovery was an accident resulting from a failed experiment at Baumeister’s lab. The researchers set out to test something called the Mardi Gras theory — the notion that you could build up willpower by first indulging yourself in pleasure, the way Mardi Gras feasters do just before the rigors of Lent. In place of a Fat Tuesday breakfast, the chefs in the lab at Florida State whipped up lusciously thick milkshakes for a group of subjects who were resting in between two laboratory tasks requiring willpower. Sure enough, the delicious shakes seemed to strengthen willpower by helping people perform better than expected on the next task. So far, so good. But the experiment also included a control group of people who were fed a tasteless concoction of low-fat dairy glop. It provided them with no pleasure, yet it produced similar improvements in self-control. The Mardi Gras theory looked wrong. Besides tragically removing an excuse for romping down the streets of New Orleans, the result was embarrassing for the researchers. Matthew Gailliot, the graduate student who ran the study, stood looking down at his shoes as he told Baumeister about the fiasco.

Baumeister tried to be optimistic. Maybe the study wasn’t a failure. Something had happened, after all. Even the tasteless glop had done the job, but how? If it wasn’t the pleasure, could it be the calories? At first the idea seemed a bit daft. For decades, psychologists had been studying performance on mental tasks without worrying much about the results being affected by dairy-product consumption. They liked to envision the human mind as a computer, focusing on the way it processed information. In their eagerness to chart the human equivalent of the computer’s chips and circuits, most psychologists neglected one mundane but essential part of the machine: the power supply. The brain, like the rest of the body, derived energy from glucose, the simple sugar manufactured from all kinds of foods. To establish cause and effect, researchers at Baumeister’s lab tried refueling the brain in a series of experiments involving lemonade mixed either with sugar or with a diet sweetener. The sugary lemonade provided a burst of glucose, the effects of which could be observed right away in the lab; the sugarless variety tasted quite similar without providing the same burst of glucose. Again and again, the sugar restored willpower, but the artificial sweetener had no effect. The glucose would at least mitigate the ego depletion and sometimes completely reverse it. The restored willpower improved people’s self-control as well as the quality of their decisions: they resisted irrational bias when making choices, and when asked to make financial decisions, they were more likely to choose the better long-term strategy instead of going for a quick payoff. The ego-depletion effect was even demonstrated with dogs in two studies by Holly Miller and Nathan DeWall at the University of Kentucky. After obeying sit and stay commands for 10 minutes, the dogs performed worse on self-control tests and were also more likely to make the dangerous decision to challenge another dog’s turf. But a dose of glucose restored their willpower.

Despite this series of findings, brain researchers still had some reservations about the glucose connection. Skeptics pointed out that the brain’s overall use of energy remains about the same regardless of what a person is doing, which doesn’t square easily with the notion of depleted energy affecting willpower. Among the skeptics was Todd Heatherton, who worked with Baumeister early in his career and eventually wound up at Dartmouth, where he became a pioneer of what is called social neuroscience: the study of links between brain processes and social behavior. He believed in ego depletion, but he didn’t see how this neural process could be caused simply by variations in glucose levels. To observe the process — and to see if it could be reversed by glucose — he and his colleagues recruited 45 female dieters and recorded images of their brains as they reacted to pictures of food. Next the dieters watched a comedy video while forcing themselves to suppress their laughter — a standard if cruel way to drain mental energy and induce ego depletion. Then they were again shown pictures of food, and the new round of brain scans revealed the effects of ego depletion: more activity in the nucleus accumbens, the brain’s reward center, and a corresponding decrease in the amygdala, which ordinarily helps control impulses. The food’s appeal registered more strongly while impulse control weakened — not a good combination for anyone on a diet. But suppose people in this ego-depleted state got a quick dose of glucose? What would a scan of their brains reveal?

The results of the experiment were announced in January, during Heatherton’s speech accepting the leadership of the Society for Personality and Social Psychology, the world’s largest group of social psychologists. In his presidential address at the annual meeting in San Antonio, Heatherton reported that administering glucose completely reversed the brain changes wrought by depletion — a finding, he said, that thoroughly surprised him. Heatherton’s results did much more than provide additional confirmation that glucose is a vital part of willpower; they helped solve the puzzle over how glucose could work without global changes in the brain’s total energy use. Apparently ego depletion causes activity to rise in some parts of the brain and to decline in others. Your brain does not stop working when glucose is low. It stops doing some things and starts doing others. It responds more strongly to immediate rewards and pays less attention to long-term prospects.

The discoveries about glucose help explain why dieting is a uniquely difficult test of self-control — and why even people with phenomenally strong willpower in the rest of their lives can have such a hard time losing weight. They start out the day with virtuous intentions, resisting croissants at breakfast and dessert at lunch, but each act of resistance further lowers their willpower. As their willpower weakens late in the day, they need to replenish it. But to resupply that energy, they need to give the body glucose. They’re trapped in a nutritional catch-22:

1. In order not to eat, a dieter needs willpower.

2. In order to have willpower, a dieter needs to eat.

As the body uses up glucose, it looks for a quick way to replenish the fuel, leading to a craving for sugar. After performing a lab task requiring self-control, people tend to eat more candy but not other kinds of snacks, like salty, fatty potato chips. The mere expectation of having to exert self-control makes people hunger for sweets. A similar effect helps explain why many women yearn for chocolate and other sugary treats just before menstruation: their bodies are seeking a quick replacement as glucose levels fluctuate. A sugar-filled snack or drink will provide a quick improvement in self-control (that’s why it’s convenient to use in experiments), but it’s just a temporary solution. The problem is that what we identify as sugar doesn’t help as much over the course of the day as the steadier supply of glucose we would get from eating proteins and other more nutritious foods.