a. Monatomic ions
Cs is in Group 1. It has one valence electron that it can lose to form a Cs⁺ ion.
Mg is in Group 2. It has two valence electrons that it can lose to form an Mg²⁺ ion.
N is in Group 15. It can gain three valence electrons to complete its octet and form an N³⁻ ion.
b. Ionic compounds
In an ionic compound there must be the same number of positive and negative charges.
It takes three Na⁺ ions to balance the charge on one N³⁻ ion, so the formula of sodium nitride is Na₃N.
It takes three Mg²⁺ ions (charge = +6) to balance the charge on two N³⁻ ions
(charge = -6), so the formula of magnesium nitride is Mg₃N₂.