The chemical formula for magnesium nitrite is Mg(NO2)2. The letters in the formula indicate the different elements with Mg representing magnesium, N representing nitrogen and O representing oxygen.
The numbers in the formula indicate the number of atoms of each element present in the compound. They are usually written in subscript. The number after the parenthesis applies to all the elements inside it. If there is no number after an element, the formula contains only one atom of that element. For magnesium nitrite, the formula indicates that one molecule contains one atom of magnesium, two atoms of nitrogen and four atoms of oxygen.