```
Mg(s) + 2HCl(aq) → MgCl2(aq) + H2(g)
```
In this reaction, magnesium atoms (Mg) react with hydrogen ions (H+) from the hydrochloric acid (HCl) to form magnesium ions (Mg2+) and hydrogen gas (H2). The magnesium ions then combine with chloride ions (Cl-) from the hydrochloric acid to form magnesium chloride (MgCl2), which is a soluble salt. The hydrogen gas produced in the reaction is a colourless and odourless gas that is lighter than air.
The reaction between magnesium and dilute hydrochloric acid is an example of a single-replacement reaction, in which one element (magnesium) replaces another element (hydrogen) in a compound (hydrochloric acid). This type of reaction is commonly observed when a more reactive metal reacts with a less reactive metal's compound.