Here's why:
* Red Giant Phase: Red giants are stars in their later stages of life. They have exhausted the hydrogen fuel in their core and are fusing helium into heavier elements. This causes the star to expand significantly.
* Outer Layer Ejection: As the core continues to fuse heavier elements, the outer layers become less tightly bound to the core and are eventually ejected as a planetary nebula.
* Core Collapse: The remaining core, now primarily composed of carbon and oxygen, is extremely dense and hot. Under immense pressure, it shrinks dramatically, becoming about the size of the Earth.
* White Dwarf Formation: This incredibly dense, hot core is what we call a white dwarf. It no longer undergoes nuclear fusion and slowly cools over billions of years, eventually becoming a black dwarf.
So, the shrinking core of a red giant, after shedding its outer layers, becomes a white dwarf.