Question: what is the chemical formula for the compound composed of magnesium ions and chloride ions?
Answer: We could write the chemical formula for this ionic compound as MgClCl, but the convention is to use a numerical subscript when there is more than one ion of a given type—MgCl2. This chemical formula says that there are one magnesium ion and two chloride ions in this formula.