J.R. S. answered 11/24/20
Ph.D. in Biochemistry with an emphasis in Neurochemistry/Neuropharm
Looking at neutral iron (no charge), we have atomic number 26 and it is in period 4, group 8. It is a d-block transition metal and so the electron configuration is [Ar] 3d6 4s2. Now, to become Fe3+, it has to lose 3 electrons and those will be the outermost, so it will lose the 4s2 and one electron from 3d. The resulting electron configuration for Fe(III) ion is [Ar]3d5
Mg2+ = magnesium(II). Neutral Mg has 12 electrons and is in period 3 group 2 and is an s-block element.
Neutral Mg looks like this: [Ne]3s2. To become Mg2+, it must lose 2 electrons, and those will be the 3s electrons. The resulting electron configuration for Mg(II) ion is [Ne]