
The formation of the solar system began billions of years ago with a massive cloud of gas and dust, known as a nebula. This cloud, primarily composed of hydrogen and helium, also contained heavier elements produced by earlier generations of stars. The nebula was disturbed, possibly by a nearby supernova, causing it to collapse under its own gravity. As it collapsed, the cloud began to spin faster, forming a rotating disk of material. The center of this disk became increasingly dense and hot, eventually forming the Sun.
Around the newly formed Sun, particles of dust and ice started to collide and stick together due to the force of gravity. These collisions led to the formation of planetesimals, which were small bodies that would eventually coalesce into planets. The process continued with the planetesimals growing larger and larger, merging over time to form protoplanets. In the inner regions of the disk, where it was too hot for volatile substances like water to condense, rocky materials dominated, forming the terrestrial planets like Mercury, Venus, Earth, and Mars. These planets were made primarily of metal and silicate minerals.
Further out, beyond the "frost line," where temperatures were low enough for ices to freeze, icy planetesimals and gases began to accumulate. This region gave birth to the gas giants like Jupiter and Saturn, and the ice giants, Uranus and Neptune. These planets formed from a combination of rock, ice, and hydrogen, and grew large enough to capture surrounding gas from the nebula, forming thick atmospheres.
As the solar system matured, leftover planetesimals formed the asteroid belt, located between Mars and Jupiter, while others were cast into the outer reaches of the solar system. The process of formation took millions of years, but eventually, a stable solar system emerged, with the planets orbiting the Sun and the remnants scattered throughout the system, shaping the space that we observe today.