Organic compounds of hydrogen and carbon whose densities, boiling points, and freezing points increase as their molecular weights increase. Although composed of only two elements, hydrocarbons exist in a variety of compounds, because of the strong affinity of the carbon atom for other atoms and for itself. The smallest molecules of hydrocarbons are gaseous; the largest are solids. Petroleum is a mixture of many different hydrocarbons.