The sodium ion has a positive 1 charge because it belongs to the group 1a which the charge of other elements is also +1. The magnesium ion has a charge of positive 2 since it belongs to the Group 2a. The concept of ionization energy is related to the number of electrons present in the outermost shells which is related to the group number.