In order to understand the origin of Earth's atmosphere, we must go back to the earliest days of the solar system, before the planets themselves were formed from a disk of rocky material spinning around the young Sun. This material gradually coalesced into lumps called planetesimals as gravity and chance smashed smaller pieces together, a chaotic and violent process that became more so as planetesimals grew in size and gravitational pull. Within each orbit, collisions between planetesimals generated immense heat and energy. How violent these processes were is suggested by the odd tilt and spin of many of the planets, which indicate that each of the planets was, like a billiard ball, struck at some stage by another large body of some kind. Visual evidence of these processes can be seen by looking at the Moon. Because the Moon has no atmosphere, its surface is not subject to erosion, so it retains the marks of its early history. Its face is deeply scarred by millions of meteoric impacts, as you can see on a clear night with a pair of binoculars. The early Earth did not have much of an atmosphere. Before it grew to full size, its gravitational pull was insufficient to prevent gases from drifting off into space, while the solar wind (the great stream of atomic particles emitted from the Sun) had already driven away much of the gaseous material from the inner orbits of the solar system. So we must imagine the early Earth as a mixture of rocky materials, metals, and trapped gases, subject to constant bombardment by smaller planetesimals and without much of an atmosphere. As it began to reach full size, Earth heated up, partly because of collisions with other planetesimals and partly because of increasing internal pressures as it grew in size. In addition, the early Earth contained abundant radioactive materials, also a source of heat. As Earth heated up, its interior melted. Within the molten interior, under the influence of gravity, different elements were sorted out by density. By about 40 million years after the formation of the solar system, most of the heavier metallic elements in the early Earth, such as iron and nickel, had sunk through the hot sludge to the center, giving Earth a core dominated by iron. This metallic core gives Earth its characteristic magnetic field, which has played an extremely important role in the history of our planet. As heavy materials headed for the center of Earth, lighter silicates (such as the mineral quartz) drifted upward. The denser silicates formed Earth's mantle, a region almost 3,000 kilometers thick between the core and the crust. With the help of bombardment by comets, whose many impacts scarred and heated Earth's surface, the lightest silicates rose to Earth's surface, where they cooled more rapidly than the better-insulated materials in Earth's interior. These lighter materials, such as the rocks we call granites, formed a layer of continental crust about 35 kilometers thick. Relative to Earth as a whole, this is as thin as an eggshell. Seafloor crust is even thinner, at about 7 kilometers; thus, even continental crust reaches only about 1/200th of the way to Earth's core. Much of the early continental crust has remained on Earth's surface to the present day.   The lightest materials of all, including gases such as hydrogen and helium, bubbled through Earth's interior to the surface. So we can imagine the surface of the early Earth as a massive volcanic field. And we can judge pretty well what gases bubbled up to that surface by analyzing the mixture of gases emitted by volcanoes. These include hydrogen, helium, methane, water vapor, nitrogen, ammonia, and hydrogen sulfide. Other materials, including large amounts of water vapor, were brought in by cometary bombardments. Much of the hydrogen and helium escaped; but once Earth was fully formed, it was large enough for its gravitational field to hold most of the remaining gases, and these formed Earth's first stable atmosphere.