Answer:
When magnesium reacts with hydrochloric acid (HCl), a single-replacement reaction occurs. These reactions involve the substitution of one element in a compound with another. In this case, the hydrogen in HCl will be swapped with the magnesium metal because both of these elements make cations (positively-charged ions) when they participate in ionic bonding.
So why does the chorine have a subscript of 2 when it bonds with magnesium? This occurs in order to balance the ionic charges and make the overall compound neutral.
Magnesium wants to give away 2 electrons when it ionizes, forming the cation Mg²⁺. However, chlorine only wants to gain 1 electron to fill its valence shell, making it form the anion, Cl⁻. As you can see, if just one of each ion were to bond, the compound would have an overall charge of +1 because (+2 - 1 = +1). Therefore, the compound can be made neutral if two chlorine ions bond with just 1 magnesium ion (+2 - 1 - 1 = 0).
The hydrogen ion from HCl becomes H₂ after the reaction occurs. This occurs because hydrogen generally exists as a diatomic compound in nature (diatomic = exists as 2 atoms).
The complete balanced equation for the reaction is:
Mg + 2 HCl ------> MgCl₂ + H₂