Stars are formed when huge clouds of gas collapse under gravity. As a gas cloud collapses, it gets warmer and its pressure increases. Eventually it will get to a size and temperature where the outward force from the gas pressure matches the force of gravity pulling it inwards. Then it stops collapsing. At this point, the gas will be hot and dense enough that nuclear reactions have begun to occur. This is the fuel for the star – it’s what makes it give out heat and light.
Comments