Answer:
Step-by-step explanation:
Magnesium is present in second group of periodic table. It has two valance electrons. Oxygen us present in group sixteen it has six valance electrons.
Magnesium need to lose two valance electrons to complete the octet while oxygen needed two electrons to complete the octet.
When magnesium loses it two electrons it form magnesium cation Mg²⁺ and its two electrons transfer to the oxygen thus oxygen becomes anion O²⁻.
Both negative and positive charges attract each others and form magnesium oxide. MgO.
Chemical equation with electron dot illustration:
Reaction is given in attached file.