Answer:
magnesium is a 2A group metal and one of the characteristics of this group is that it has 2valence electrons, magnesium is a metal and a metal gives electrons to another element when creating a compound
since magnesium gives 2electrons the number of electrons and protons is in disbalance
Mg Z=12
e-=p+
p+=Z
p+=12
e-=12
Mg2+
Z=12
p+=12
e-=12-2
e-=10
so there would be 2 more protons than electrons since protons have a positive charge that is presented as 2+