It has been called the most extreme migration on Earth: Twice a year, bar-headed geese fly over the Himalayas between India and Central Asia. Now, after years of speculation, scientists say they have discovered how the birds manage the high-altitude journey.

Like riders on a roller coaster, the geese hug the terrain as they fly, rising and falling with the peaks and valleys. By taking advantage of lower and denser air, the birds conserve more energy than they would by flying steadily at very high altitudes.

“We know that quite a few birds on migration fly quite high in order to catch tailwinds,” said Charles Bishop, a zoologist at Bangor University and lead author of the study. “But when we looked, we saw the geese were working really hard to get up, then coming back down again.”

To conduct the study, published in the journal Science, Dr. Bishop and his colleagues implanted in seven geese devices that monitor heart rate, abdominal temperature, air pressure and the frequency of wing beats. Knowing that wing-beat frequency increases in the thin air of high altitudes, the researchers were able to determine where the birds were and how much energy they were expending.