How do you write the formula for a compound containing a polyatomic ion?

Give a for example. I write it as I would any compound.
sodium hyrogen carbonate is NaHCO3.
sodium acetate is NaC2H3O2.

To write the formula for a compound containing a polyatomic ion, you need to know the charge of the polyatomic ion and the charges of the other ions involved in the compound.

Here's a step-by-step guide on how to write the formula for a compound containing a polyatomic ion:

1. Determine the charges of the ions:
- For the metal or cation, look up the charge from the periodic table. For example, sodium (Na) has a charge of +1.
- For the polyatomic ion, look up the charge in a reference table or use the memorized charges. For example, the carbonate ion (CO3 2-) has a charge of -2.

2. Balance the charges:
- If the charges of the cation and the anion are equal in magnitude, simply combine the ions to form the compound. For example, Na+ and CO3 2- combine to form Na2CO3.

- If the charges are different, use the crisscross method:
* Determine how many of each ion is needed to make the overall charge neutral.
* Cross the absolute value of the charge of one ion to the subscript of the other ion.
* Simplify the subscripts, if possible, to get the smallest whole-number ratio. For example, sodium acetate:
* The sodium ion (Na+) has a charge of +1, and the acetate ion (C2H3O2-) has a charge of -1.
* Crisscrossing the charges, we get Na1C2H3O2.
* Simplifying the subscripts, the formula becomes NaC2H3O2.

So, sodium hydrogen carbonate (NaHCO3) and sodium acetate (NaC2H3O2) are both examples of compounds containing polyatomic ions.

Remember to always double-check your charges and transition metals in more complex compounds, as they may have different oxidation states.