Final answer:
The formula for magnesium chloride is MgCl2, which indicates that one magnesium ion with a +2 charge combines with two chloride ions, each with a -1 charge, to form a neutral compound.
Step-by-step explanation:
The formula for magnesium chloride can be determined by considering the charges of magnesium and chloride ions. Magnesium, with an atomic number of 12, forms a magnesium ion (Mg2+) with a charge of +2 because it loses two electrons to achieve a noble gas configuration. Chlorine, with an atomic number of 17, forms a chloride ion (Cl−) with a charge of −1 as it gains one electron. To form a neutral compound, the total positive charge must balance the total negative charge. Since each magnesium ion has a +2 charge and each chloride ion has a −1 charge, two chloride ions are needed to balance the charge of one magnesium ion. Therefore, the formula of magnesium chloride is MgCl2.