The earth is a planet, so it was also formed just like other planets. In the beginning, earth was a huge collection of cold objects called planetesimals. These planetesimals which formed the earth came from two regions : from the region occupied by the inner planets like mercury and venus, and from the farther regions of Jupiter, Saturn and Uranus. The planetesimals coming from the inner planet’s region consisted mostly of the compounds of iron, silicon and magnesium with traces of other elements whereas those coming from the regions of Jupiter, Saturn and Uranus, largely consisted of matter like hydrogen, water, carbon dioxide and methane.
As more and more planetesimals collided with the earth and got stuck into it, their kinetic energy was converted into heat energy. In addition to this, the radioactive disintegration of the elements like uranium (U), thorium (Th) and potassium (K), produced a lot of heat energy. The enormous heat energy thus produced along with gravitational compression, heated the earth so much that it melted to form a liquid. This melting of the original earth planet happened about 800 million years after its formation. It was because of the melting of earth that the surface records of the earth for the first 800 million years of its existence were completely destroyed.
When the earth melted, the molten material present in it began to reorganize itself under the influence of gravity. The molten iron, being the heaviest material, fell to the centre of the earth and formed core of the earth (innermost part of the earth). The lighter constituents which were earlier present in the core, came up and formed the crust of earth. The medium density matter remained in-between the core and crust to form the mantle of earth. The organization of molten earth into various layers having different densities is called differentiation.
As a result of differentiation, the earth was divided into three major layers: crust, mantle, and core, the crust being lightest and the core being densest. It was during the differentiation process that the water vapour and gases present in the molecules of earth minerals were released. This water formed the oceans on the earth whereas gases formed the atmosphere.
The planet we live on is not just a ball of inert material. During the past ages, dramatic changes have taken place inside the earth. Without these changes, life could never have originated on the earth. And changes are still going on today, like the occurrence of earthquakes, outburst of volcanoes, and the uplift of mountain ranges.