Answer:
The number of atoms or ions in a compound are shown as subscripts in the chemical formula.
If a compound's ions have a different value, then the chemical formula should have subscripts.
Explanation:
So let's say we have Mg²⁺ (cation) and Cl⁻ (anion).
Mg²⁺ and Cl⁻
As you can see they do not have balanced charges. We need to balance out the charges, so to match the 2+ charge of one Mg, we need two Cl⁻ ions.
Now that we know this, we can write the chemical formula. When you write the chemical formula, you put the cation first before the anion. DO NOT PUT THE CHARGES in the formula.
MgCl
But like we said earlier, we will need two Cl ions to balance this out. To indicate the number of atoms, you will write the number of atoms as a subscript.
Notice that the ions involved are of different value, there is only 1 Mg ion and 2 Cl ions. If they are not the same, you write the subscript. But if they are the same, there is no need.
The conventional method of writing a chemical formula is to not put subscripts if their values are the same.