Here's how to figure that out:
* Magnesium has a +2 charge (Mg²⁺).
* Sulfite has a -2 charge (SO₃²⁻).
Since the charges are equal and opposite, they balance out, resulting in the formula MgSO₃.