Here's why:
* Mafic rocks are rich in magnesium (Mg) and iron (Fe), which are the primary elements in olivine and pyroxene. These rocks are typically dark-colored and form from relatively fast cooling of magma.
* Ultramafic rocks are even richer in magnesium and iron than mafic rocks. They often contain a high percentage of olivine and pyroxene. These rocks are very dense and form deep within the Earth's crust.
Examples of mafic and ultramafic igneous rocks containing olivine and pyroxene include:
* Basalt: A mafic volcanic rock commonly found on the ocean floor.
* Gabbro: A mafic intrusive rock, the plutonic equivalent of basalt.
* Peridotite: An ultramafic intrusive rock that makes up a significant portion of the Earth's upper mantle.
While olivine and pyroxene are found in these rock types, they can also occur in some less common types of igneous rocks.