The mineral olivine is composed of the elements iron, magnesium and silicon. It is categorized in the silicate chemical group. Under certain conditions it can become a gemstone called peridotite that has a green tint.
The mineral pyroxene is composed of the elements calcium, magnesium, iron, silicon and oxygen. It is a dull black in color and sometimes can be found in crystal form in hot lava. This is how it got its Greek name of "fire (pyro) stranger (xene)" because the unmelted crystals in lava seemed to come from somewhere else.
Olivine and pyroxene are considered rock forming minerals. They flow up to the surface of the Earth through the lithosphere, where they become the basic material which other surface minerals and elements combine with to make rocks.
Olivine and pyroxene can appear on the surface of the Earth in combination with other types of rock. Green sand near lava fields is olivine. The dull black crystals found in metamorphic rock like marble or igneous rocks like granite are pyroxene.