* Magnesium (Mg) is an alkaline earth metal in Group 2 of the periodic table. It tends to lose two electrons to achieve a stable octet configuration, forming a +2 cation (Mg²⁺).
* Chlorine (Cl) is a halogen in Group 17 of the periodic table. It tends to gain one electron to achieve a stable octet configuration, forming a -1 anion (Cl⁻).
To form a neutral compound, the charges of the ions must balance out. Therefore, we need two chloride ions (2 x -1 = -2) to balance the +2 charge of the magnesium ion.