A convergent boundary is when two plates push against each other. a transform boundary is when they slide past each other. both can couse mid ocean ridges.
We combine the two equations, like we would any mathematical system of equations. After addition of the two equations, we get:
Mg + 2H⁺(aq) + 2e⁻ → Mg⁺²(aq) + H₂(g) + 2e⁻
Cancelling like terms from both sides
Mg + 2H⁺(aq) → Mg⁺²(aq) + H₂(g)