Olivine is one of the simplest silicate minerals that can be found in igneous rocks on our planet.
All the silicate minerals are made from the basic silicate mineral building block called the 'silicon tetrahedron' which is one silicon atom surrounded by oxygen atoms. It is how these building blocks join together to form a mineral structure that gives us the huge number of silicate minerals that make up the rocks of our planet.
See the diagram - there are four oxygen atoms (one is sitting on top of the others and is see through). Each of these oxygen atoms can connect (bond) to another element. This simple structure is the LEGO block on which our major rock-forming minerals are built.
Olivine is one of the minerals on Earth that is made up of the simplest silicate structure - and these minerals are called nesosilicates. Nesosilicates are minerals in which single tetrahedrons are isolated from each other by metallic cations. In Olivines, the silicon tetrahedrons are completely surrounded by other atoms - such as Iron (Fe), Magnesium (Mg). As the oxygen atoms bond with only one of the available sites on the metal atom, the remaining free bonding site on the metal atom (cation) can bond to another tetrahedron. This allows a crystal structure to develop.
So the chemical composition of Olivine is generally written as (Mg, Fe) SiO4 - but as the name suggests the amounts of Magnesium (Mg) and Iron (Fe) can vary and this gives slightly different olivines with different colors. So geologists refer to the olivines as a group of minerals. At one end of the group is the olivines with only Iron in the structure - and this is known as the mineral Fayalite (Fe2SiO4) and at the other end of the group is the olivine with only magnesium in its structure and this is known as the mineral Forsterite (Mg2SiO4). Most olivines fall somewhere in-between those end 'members' of the group.
Olivines range in color from clear through to dark brown, but a shade of olive green is the most common. As with most things in geology, color is always a poor indicator of composition.
Gem-quality olivine is called Peridot. It is mined in many locations around the world. (Often Hawaii is quoted as one such place, but all peridot I have seen for sale in Hawaii is NOT from the state - and in fact, I have not seen gem quality olivine in Hawaii).
Olivine is most commonly formed in basaltic rocks and is the major constituent of the upper mantle layer of the Earth. Often basaltic lavas can contain large (1-2mm) crystals of olivine which have come formed deep in the volcano and are trapped in a very fine-grained rock when it reaches the surface. In some locations, clumps of mantle material have been caught up in the erupting materials and olivine bombs surrounded by basalt can be found.