* Magnesium (Mg) is in group 2 of the periodic table, meaning it forms ions with a +2 charge (Mg²⁺).
* Sulfur (S) is in group 16 of the periodic table, meaning it forms ions with a -2 charge (S²⁻).
To create a neutral compound, the charges must balance. Since the charges of magnesium and sulfur are equal in magnitude but opposite in sign, one atom of each is needed:
* Mg²⁺ + S²⁻ → MgS