Write the balanced molecular equation for the reaction between magnesium chloride and sodium hydroxide: \(\mathrm{MgCl_2 (aq) + 2NaOH (aq) \rightarrow Mg(OH)_2 (s) + 2NaCl (aq)}\).
Dissociate all strong electrolytes (soluble salts and strong bases) into their ions to write the complete ionic equation: \(\mathrm{Mg^{2+} (aq) + 2Cl^{-} (aq) + 2Na^{+} (aq) + 2OH^{-} (aq) \rightarrow Mg(OH)_2 (s) + 2Na^{+} (aq) + 2Cl^{-} (aq)}\).
Identify the spectator ions, which are ions that appear unchanged on both sides of the equation. Here, \(\mathrm{Na^{+}}\) and \(\mathrm{Cl^{-}}\) are spectator ions.
Remove the spectator ions from the complete ionic equation to write the net ionic equation: \(\mathrm{Mg^{2+} (aq) + 2OH^{-} (aq) \rightarrow Mg(OH)_2 (s)}\).
Confirm that the net ionic equation shows the formation of the solid precipitate magnesium hydroxide from its ions in solution, which is the key chemical change in this reaction.