Here's why:
* Ionic Compounds: Magnesium (Mg) is a metal and sulfur (S) is a nonmetal. This indicates an ionic compound will form.
* Charge Balance: Magnesium ions (Mg²⁺) have a +2 charge, while sulfide ions (S²⁻) have a -2 charge. To achieve electrical neutrality, we need one magnesium ion to balance out one sulfide ion.
Therefore, the simplest whole-number ratio of ions is 1:1, resulting in the formula MgS.