Answer:
Magnesium will lose 2 electrons.
Step-by-step explanation:
Looking at a periodic table, magnesium is in the third period and the second group. It would help to look up where atomic orbitals are on the periodic table, but basically, s orbitals are filled in the first two groups. Since magnesium is in the second group, it will just have filled a 3s orbital with two electrons.
Elements in groups 1A, 2A, and 3A especially like to lose electrons to gain stability. Elements want to have a filled valence (outer) orbital with 8 electrons (except for hydrogen and helium) like noble gases. As such, they will lose or gain electrons in the easiest way possible to get a filled valence orbital. Magnesium wants to have the electron configuration of the nearest noble gas, in this case neon, so it will lose 2 electrons to achieve this stability. It takes much less energy to lose 2 electrons than gain 6 to fill its valence orbital, so magnesium will go for the former.