In the first three equations, Magnesium, sodium and aluminum are oxidized because they loose electrons. Sulfur, oxygen and chlorine are reduced because they gain electrons. In the last equation, magnesium is reduced because it gains hydrogen, and hydrogen is oxidized because it loses electrons.