A new study with mice fills in one piece of that puzzle. It shows that, in rodents at least, strenuous exercise seems to beneficially change how certain genes work inside the brain. Though the study was in mice, and not people, there are encouraging hints that similar things may be going on inside our own skulls.

For years, scientists have known that the brains of animals and people who regularly exercise are different than the brains of those who are sedentary. Experiments in animals show that, for instance, exercise induces the creation of many new cells in the hippocampus, which is a part of the brain essential for memory and learning, and also improves the survival of those fragile, newborn neurons.

Researchers believe that exercise performs these feats at least in part by goosing the body’s production of a substance called brain-derived neurotrophic factor, or B.D.N.F., which is a protein that scientists sometimes refer to as “Miracle-Gro” for the brain. B.D.N.F. helps neurons to grow and remain vigorous and also strengthens the synapses that connect neurons, allowing the brain to function better. Low levels of B.D.N.F. have been associated with cognitive decline in both people and animals. Exercise increases levels of B.D.N.F. in brain tissue.

But scientists have not understood just what it is about exercise that prompts the brain to start pumping out additional B.D.N.F.

They began by gathering healthy mice. Half of the animals were put into cages that contained running wheels. The others were housed without wheels. For a month, all of the animals were allowed to get on with their lives. Those living with wheels ran often, generally covering several miles a day, since mice like to run. The others remained sedentary.

After four weeks, the scientists looked at brain tissue from the hippocampus of both groups of animals, checking for B.D.N.F. levels. As expected, the levels were much higher in the brains of the runners.

But then, to better understand why the runners had more B.D.N.F., the researchers turned to the particular gene in the animals’ DNA that is known to create B.D.N.F. For some reason, the scientists realized, this gene was more active among the animals that exercised than those that did not.

Using sophisticated testing methods, the scientists soon learned why. In both groups of animals, the B.D.N.F. gene was partially covered with clusters of a particular type of molecule that binds to the gene, though in different amounts.

In the sedentary mice, these molecules swarmed so densely over the gene that they blocked signals that tell the gene to turn on. As a result, the B.D.N.F. genes of the sedentary animals were relatively muted, pumping out little B.D.N.F.

But among the runners, the molecular blockade was much less effective. The molecules couldn’t seem to cover and bind to the entire B.D.N.F. gene. So messages from the body continued to reach the gene and tell it to turn on and produce more B.D.N.F.

Perhaps most remarkably, the researchers also found a particular substance in the runners’ brains that fended off the action of these obstructionist molecules. The runners’ brains contained high levels of ketones, which are a byproduct of the breakdown of fat. During strenuous exercise, the body relies in part on fat for fuel and winds up creating ketones, some of which migrate to the brain. (They are tiny enough to cross the blood-brain barrier.) The brain uses these ketones for fuel when blood sugar levels grow low.

But it appears that ketones also cause the molecules that hinder the B.D.N.F. gene to loosen their grip, as the scientists realized when they experimentally added ketones to brain tissue from some of the mice. Afterward, their B.D.N.F. genes were not blocked by nearly as many of the bothersome molecules, and those genes could get on with the job of making B.D.N.F.

None of this occurred in the brains of the sedentary mice.

“It’s incredible just how pervasive and complex the effects of exercise are on the brain,” said Moses Chao, a professor at the Skirball Institute of Biomolecular Medicine at N.Y.U. who oversaw the study.

Whether the same mechanisms that occur in mice occur in our own brains when we exercise is still unknown. But, Dr. Chao pointed out, like the mice, we have more B.D.N.F. in our bodies after exercise. We also create ketones when we exercise, and those ketones are known to migrate to our brains..

Generally, however, this process requires exerting yourself vigorously for an hour or more, after which time your body, having exhausted its stores of sugar, starts burning stored fat and making ketones.

If an hour or more of intense exercise seems daunting — and it does to me — don’t despair. “We are only starting to understand” the many ways in which exercise of any kind and amount is likely to alter our brains, Dr. Chao said. For now, he says, “it’s a very good idea to just keep moving.”