The most important thing to keep in mind when dealing with ionic compounds is that the must be neutral.
That automatically implies that the overall positive charge that's coming from the cations must be balanced out by the overall negative charge that's coming from the anions.
In your case, you want to figure out the ionic formula for a compound that contains magnesium cations,
Notice that the magnesium cation carries a
This tells you that, in order to form a neutral compound, you need to have two nitrate anions for every magnesium cation.
This will give you
#1 xx "Mg"^(2+) ->#a total positive charge of #2+#
#2 xx "NO"_3^(-) ->#a total negative charge of #2-#
Therefore, the ionic formula for this compound will be
#["Mg"^(2+)]_1["NO"_3^(-)]_2 implies "Mg"("NO"_3)_2 ->#magnesium nitrate
Essentially, this is what the criss cross rule is all about. You take the charge of the cation and make it the subscript of the anion, and vice versa.
In this case, you'd have
#"Mg"^(color(red)(2+))"NO"_3^(color(blue)(1-)) implies "Mg"_color(blue)(1)("NO"_3)_color(red)(2) implies "Mg"("NO"_3)_2#