X is an ionic compound containing only magnesium, aluminium and oxygen. Which of the following can be the chemical formula for X?
MgAl2O4
Net charge of an ionic compound is zero. Mg has a charge of +2, Al has +3 and O has -2. Therefore, in MgAl2O4 the net charge is 0 as (+2)(1) + 2(3) + 4(-2) = 0.