Answer:
![\begin{gathered} Mg^2+2e^-\operatorname{\rightarrow}Mg(s)(reduction) \\ 2Cl^-\operatorname{\rightarrow}Cl_2(g)(oxidation) \end{gathered}]()
Explanations:
Electrolysis occur when an electric current is passed through a liquid or solution thereby causing the decomposition of chemicals.
For magnesium chloride, it will be heated to be able to conduct electricity. When molten, the MgCl2 will decomposes into Mg2+ and 2Cl- ions. During electrolysis, the elements are separated according to the equations;

According to the half reactions, the Mg2+ is reduced at the cathode (-) and the Cl- is oxidized at the anode (+). Reduction at the cathode shows that magnesium gains two electrons to form a magnesium solid while the chlorine ion looses two electrons at the anode