The planetary nebula Abell 39 has a diameter of about 5 light-years, and is approximately 7,000 light-years from Earth.

All stars die, and eventually — in about 5 billion years — our sun will, too. Once its supply of hydrogen is exhausted, the final, dramatic stages of its life will unfold, as our host star expands to become a red giant and then tears its body to pieces to condense into a white dwarf.

But after the sun's life is over, what will it look like? Astronomers have a new answer, and their conclusions are glowing. [Rainbow Album: The Many Colors of the Sun]

The length of a star's life span depends on its size. Our sun is a yellow dwarf with a diameter of around 864,000 miles (1.4 million kilometers), or about 109 times the size of Earth, according to NASA. Yellow dwarf stars live for about 10 billion years, and at 4.5 billion years old, our middle-age sun is about halfway through its lifetime.

Once its hydrogen supply is depleted, the sun will start consuming its heavier elements. During this volatile and turbulent stage, vast quantities of stellar material will hurtle into space as the sun's body expands to 100 times its current size, becoming a red giant. Then, it will shrink down to a tiny, extremely dense white dwarf star, about Earth-size.

Illuminated by the cooling white dwarf will be the cloud of gas and dust that the sun spewed into space as a churning red giant. Whether this cloud would be visible has long been a puzzle. An estimated 90 percent of dying stars emit a ghostly dust halo, which persists for thousands of years, but computer models established decades ago suggested that a star would need to have a mass about twice that of our sun to generate a cloud bright enough to be seen, the study authors reported.

However, this prediction didn't align with evidence that twinkled across galaxies. Visible nebulas glimmered in young spiral galaxies that were known to host massive stars, which could easily produce glowing dust clouds at the end of their lives, the models predicted.

But nebulas also lit up in old elliptical galaxies populated with stars of lower mass; according to the computer models, these stars shouldn't have been able to produce visible clouds at all. This perplexing, apparent contradiction posed "a long-standing mystery" about the end-of-life stages in low-mass stars, the international team of researchers wrote in the study.

We're stars and we're beautiful

To solve the riddle, the scientists developed a new computer model for predicting stars' life cycles.

According to their new calculations, once expanding red giants eject the dust and gas that make up the nebula, they heat up three times faster than the previous models suggested. This accelerated heating would make it possible even for a star of lower mass, like our sun, to manifest a visible nebula.

"We found that stars with a mass less than 1.1 times the mass of the sun produce fainter nebulae, and stars more massive than 3 solar masses [produce] brighter nebulae," study co-author Albert Zijlstra, a professor of astrophysics at the University of Manchester in the United Kingdom, said in a statement.

"But for the rest, the predicted brightness is very close to what had been observed," Zijlstra added. "Problem solved, after 25 years!"

The findings were published online yesterday (May 7) in the journal Nature Astronomy.

Original article on Live Science.