Electronic configuration of Mg (Z = 12) = 2, 8, 2
Electronic configuration of O (Z = 8) = 2, 6
Mg (metal) has a tendency to lose two valence electrons and attain a stable state (Ne = 2,8). On the other hand, O (non-metal) has a tendency to gain two electron and attain a stable state (Ne = 2,8). Hence, when the two atoms fuse together to form MgO, then Mg loses two electrons and O gains two electrons and they fo