Petrology is the branch of geology that studies rocks. Rocks are composed of minerals and there are three main types of rocks: sedimentary, igneous, and metamorphic. Sedimentary rocks form from the compaction and cementation of sediments, igneous rocks form from the cooling and solidification of magma, and metamorphic rocks form from the alteration of existing rocks by heat, pressure, and chemical reactions. Each rock type has different characteristics and uses.