Animation of the last stages of the life of a red giant star. At this stage of its life, the star's outer layers have expanded greatly, and have cooled and reddened. The star is burning helium in a shell around an inert core of carbon and oxygen, with a layer of hydrogen burning above the helium layer. Variability in the output of these burning layers causes thermal pulses in the star, which eject huge amounts of the outer gaseous envelope into space. The atmosphere of such large stars is tenuous and much is also lost by a strong stellar wind, forming a cloud of gas around the star. After a few such pulses, the outer layers are entirely ejected into space, leaving behind only the extremely hot core. This core is a white dwarf, a stellar remnant that does not generate energy from nuclear reactions, instead emitting light only due to its high temperature. The light it emits is largely in the ultraviolet, which ionises the gas around the star that was ejected in the red giant stage, causing it to glow. This glowing shell of expanding gas is known as a planetary nebula. Our Sun is expected to end its life in this manner in some five billion years.