The ratio of each element is usually expressed by chemical formula. For example, water (H2O) is a compound consisting of two hydrogen atoms bonded to an oxygen atom. The atoms within a compound can be held together by a variety of interactions, ranging from covalent bonds to electrostatic forces in ionic bonds.