Rocks can be categorized into three main types - igneous, sedimentary, and metamorphic - based on their formation process. Igneous rocks form from the cooling and solidification of magma or lava. Sedimentary rocks form from the compaction and cementation of sediments. Metamorphic rocks form from the alteration of existing rocks through heat, pressure, and chemically active fluids. These three rock types are interrelated through the rock cycle, where one rock type can transform into another through various geological processes over long periods of time. Studying rocks provides insight into Earth's systems and geological processes.