A compound is a distinct substance that is composed of the atoms of two or more elements and always contains exactly the same relative masses of those elements. In light of Dalton's atomic theory, this statement simply means that a compound always contains the same relative numbers of atoms of each element. Foe example, water always contains two hydrogen atoms for each oxygen atom.
The types of atoms and the number of each type in a each unit (molecule) of a given compound are conveniently expressed by a chemical formula.
In a chemical formula, the atoms are indicated by the element symbols and the number of each type of atom is indicated by a subscript, a number that appears tothe right of and below the symbol for the element.
The formula for water is written H2O, indicating that each molecule of water contains two atoms of hydrogen and one atom of oxygen (the subscript 1 is always understood and not written).