system
Given the following post, respond as if you're commenting on Reddit:
human
Do we have any idea what came before our solar system?

My understanding is that around 4.5 billion years ago our star formed out of a cloud of gas and dust, and that our planet formed out of what was left. But what was that gas and dust? Where did it come from? I am assuming that it did not come directly from the Big Bang, because there was too much complex stuff in there. So did we form from the remenents of a supernova or a single dead old star? Did we form out of many old stars or did many new stars form out of a single old star? If the old stars had run out of fuel and finally died, where did the new fuel come from to ignite new stars?
gpt
There's actually quite a complex "life-cycle" of gas in and around a galaxy. Our Milky Way is inside a huge ball of thin hot gas, which we call a "halo" - hot is like millions of degrees. Within the disc of the Milky Way, most of the volume is filled with a denser (but still thin) warm ionised gas, about 10,000 K in temperature. The mix of gas within the Milky Way is called the "interstellar medium".

Through random turbulent motions, sometimes bits of this warm gas pile up and get denser. In space, denser gas is more effective at cooling, because there are more interactions between particles, and more chances to lose energy through radiation. So the denser gas cools, which reduces its pressure, which causes it to cool some more.

What you get here is a *molecular cloud*. Here, the gas is cool enough that it's not an ionised plasma anymore - it's actually made of proper H2 hydrogen molecules. These things are quite big - like thousands to millions of times the mass of our Sun. As they are formed from turbulent motions in the "interstellar medium", these molecular clouds are very turbulent, and have very irregular shapes.

From here, the gas can collapse further. Globules will form within the molecular cloud, that will collapse into star systems. This takes some of the gas out of the galaxy's reservoir of available gas, and locks it into stars. *However*, not all the gas is used up, and some of it gets returned.

The first big thing is "feedback". As the stars form, they irradiate the molecular cloud, heating it up and dispersing it into the interstellar medium. Winds from massive stars will also smash into the cloud, destroying it further. And, finally, the most massive stars will go supernova quite quickly (within a few million years), blowing away a large amount of gas to the interstellar medium.

These are called "feedback" because they slow down star formation. You don't use up all the gas, because new stars heat up and blow away the gas and stop it from collapsing. It's a "negative feedback" effect - forming new stars makes it harder to form more stars. Star formation ends up being somewhat self-regulating - it steadily chugs along, without using up all the gas in the galaxy. Just counting baryonic mass (i.e. ignoring dark matter), the Milky Way is currently about 10% gas, 90% stars. It used to have a higher fraction of gas in the past, but much of that gas has turned into stars now.

The second big thing is that some of the gas gets returned from stars back to the interstellar medium. Massive stars will have winds, or even go supernova. This is particularly important for "enriching" the interstellar medium. Heavy elements are built up by nuclear fusion in stars, and stellar winds and supernovae will carry this heavy-element-enriched gas into the interstellar medium, where it can contribute to new stars. As the gas is turbulent, you will mix elements from lots of supernovae along with unpolluted "primordial" gas, so a new star doesn't come from any one supernova.

These processes also return a bit of gas to the interstellar medium, but most of the gas ends up locked into long-lived stars. The majority of stars are red giant stars with life-times much much longer than the current age of the universe. Really, the dominant reason why there's still gas around is *feedback* - gas returned from stars only contributes a little bit.