This all has to do with what ions an element will form. Once you know what type and what charge of ion an element tends to form, then you can combine the different elemental ions together in the correct proportions to make electronically balanced compounds (in other words, the negative and positive charges will sum up to 0).
We can determine how a lot of elements will ionize by looking at their positions on the periodic table. The group of the element is the key. A group on the periodic table is a vertical line of elements. Group 1 compounds (the left-most vertical group starting with hydrogen (H) and ending with francium (Fr)) tend to form positively charged cations with a +1 charge. Group 2 elements tend to form cations with a +2 charge. Groups 3-12 are the transition metals and they don't follow any general rules (they simply must be memorized). Group 13 tend to form +3 cations. Group 14 tend to not readily form ions. Group 15 also tend to not ionize but they can form -3 anions. Group 16 tends to form -2 anions. And finally group 17 are the halogens and they readily form -1 anions. Group 18 are called the noble gasses and they tend to be highly unreactive. All of this is made possible, by they way, as a result of the octet rule where the outermost occupied shell of electrons tends to be the most stable when containing eight electrons. The elements lose and gain electrons accordingly (that is to say form ions) to try to achieve the number of eight.
Tin(4) oxide is the easiest because the number in parenthesis tells us the charge on the tin atom. Tin is a transition metal, so often we are given the charge of the metal since there are no clear rules for transition metals. These metals tend to form cations, so we know that the tin has a +4 charge. Oxide means oxygen, which from the periodic table (group 16) forms -2 anions. So we need two oxide anions to equal the +4 charge of the tin (Sn). So the formula for tin(4) oxide is SnO2.
Strontium chloride is composed of strontium (Sr) and chloride (Cl). From the periodic table as discussed above, strontium forms +2 cations (group 2) and chlorine is a halogen and forms -1 anions. So two chorides are needed to balance the +2 charge of the strontium. The chemical formula is SrCl2.
Magnesium phosphate is a little trickier. Phosphate is a polyatomic ion, meaning it is composed of a charge spread across multiple atoms instead of one as the previous examples have been. These polyatomic ions simply have to be memorized. Phosphate consists of PO4(-3), meaning it has a -3 charge. Since magnesium forms +2 cations, we need to find the lowest common multiple of 2 and 3, which is 6. So we need 3 of the Mg ions (total charge of +6) and 2 of the phosphate ions (total charge of -6) to balance each other out to no net charge. The formula for magnesium phosphate is Mg3(PO4)2
For most compounds, the first element stays the same while the second has the suffix of -ide.
For covalent compounds, the first element will stay same, while the second element should have a numerical prefix. For example, chloride trifluoride (`ClF_3` ).
For ionic compounds:
- Any compound with a numerical value after a transition metal or metals with multiple ions depicts its charge. Tin (IV) oxide is composed of a `Sn^(4+)` and `O^(2-)` . Therefore, the formula would be `Sn_2O_4` .
- Strontium chloride has no unusual rules. It is simply `SrCl_2` . You know what charges they have based on their location on the periodic table.``
- For an ionic compound with a polyatomic ion, you must simply memorize. There are lots of common polyatomic ions such as ammonium, sulfite, sulfate, nitrite, nitrate, etc. that will show up throughout chemistry. Phosphate is a polyatomic ion, `PO_2 ^ (3-)` . Magnesium phosphate would therefore be, `Mg_3(PO_4)_2` .