Here's why:
* Red Giant Phase: Red giants are stars that have exhausted the hydrogen fuel in their core and have started fusing helium into heavier elements. This process causes the star to expand significantly.
* Outer Layer Loss: As the star continues to evolve, it eventually sheds its outer layers, forming a planetary nebula.
* Core Collapse: The remaining core, now primarily composed of carbon and oxygen, is extremely dense and hot. The intense gravity causes it to shrink to an incredibly small size, about the size of the Earth.
* White Dwarf: This dense, hot core is called a white dwarf. It is supported by electron degeneracy pressure, which prevents further collapse. White dwarfs gradually cool down over billions of years, eventually becoming black dwarfs.