Hydrogen atoms have one electron apiece, but atoms are chemically reactive when they have unpaired electrons. As a result, hydrogen atoms pair up and form diatomic molecules, each atom sharing its electron with its partner to form an electron pair. Fluorine, chlorine, bromine, iodine, oxygen and nitrogen exhibit similar chemical behavior. Each element exists as covalent molecules in which two like atoms form a pair. Oxygen has two unpaired electrons, and nitrogen has three, so these atoms have to share more than one electron with each other to form stable molecules.
The nonmetal carbon has four unpaired electrons, which it sometimes shares with four different hydrogen atoms to form a covalent organic compound called methane. In addition, larger hydrocarbons, such as ethane, propane and octane, form when carbon atoms share electrons with each other to form chains of varying length, while the remaining unpaired carbon electrons form covalent bonds with hydrogen. In such compounds as ethylene and propylene, a carbon atom shares more than one electron with its neighboring carbon. This means that there are fewer leftover electrons for hydrogen to share, so that while ethane has the formula C2H6, ethylene is H2H4 and propylene is C2H2. Carbon atoms can also form rings of various sizes, resulting in such carbon-hydrogen compounds as cyclohexane and benzene.
While carbon and hydrogen share an electron pair equally between them, not all nonmetallic atoms are equal partners. In water molecules, each of the two hydrogen atoms share electrons with the oxygen atom, but oxygen appropriates to itself most of the negative charge. Nitrogen does the same thing in NH3, the ammonia molecule. In the case of water, this unequal distribution of electrical charge gives one end of the molecule a positive polarity and the other end negative. However, this does not happen in such molecules as carbon tetrachloride (CH4). The four chlorine atoms hold the electron pairs closer to themselves than the single carbon atom, but the chlorine atoms are distributed evenly around the central carbon, so that the atom as a whole has no polarity.
In addition to hydrocarbons, other organic compounds result from the sharing of electrons. Fats, sugars, starches and cellulose are covalent compounds composed of carbon, hydrogen and oxygen. The same three elements form alcohols, esters, ethers and ketones. Nitrogen, and sometimes sulfur, joins these three elements to form amino acids, and 20 essential amino acids unite in various combinations to make a host of different compounds called proteins and enzymes. Phosphorus enters into the composition of such covalent organic compounds as phospholipids, ATP and the nucleic acids DNA and RNA. These same nonmetals form covalent inorganic compounds, such as sulfur hexafluoride (SF6) and phosphorus pentachloride (PCl5).