Skip to content
LumenaryAcademy
Start 45 min

Molecules and compounds

How atoms join together, how to read a chemical formula, and why table salt is nothing like sodium or chlorine.

Code tested · 2AI-draftedAwaiting review by a chemist

Your guides: Chloe · The Chemist, Margaret · The Analyst, Gideon · The Sceptic

MotivationH

Three puzzles

Here are three puzzles.

Puzzle 1. Hydrogen is a gas that burns. Oxygen is the gas that things need in order to burn. Yet when hydrogen and oxygen join together, they make water, which we use to put fires out.

Puzzle 2. Sodium is a soft, silvery metal so reactive that it is stored under oil: dropped into water, it fizzes violently. Chlorine is a yellow-green, poisonous gas. Yet joined together, they make sodium chloride, the white crystals of table salt that you sprinkle on your food.

Puzzle 3. The air you breathe contains carbon dioxide, a gas. The sugar in your kitchen is a sweet, white solid. Both are made from carbon and oxygen (sugar has hydrogen too), yet nothing could look less alike.

In Atoms and elements you met the hundred or so kinds of atom. This lesson is about what happens when atoms join together, and why the result can be so completely different from the atoms you started with.

DefinitionsH

Molecules, compounds and formulas

Definition— molecule

A molecule is a group of two or more atoms held tightly together by chemical bonds, acting as a single particle. A water molecule is one oxygen atom joined to two hydrogen atoms.

Definition— compound

A compound is a pure substance made of two or more different elements chemically joined together, always in the same fixed proportions. Water, carbon dioxide and table salt are compounds.

The two words overlap but are not the same. The oxygen in the air is made of molecules of two oxygen atoms, O₂, but it is not a compound, because it contains only one element. Table salt, on the other hand, is a compound but is not made of separate molecules, as you will see below.

OHH104.5°OCOOOwater, H₂Oa compoundcarbon dioxide, CO₂a compoundoxygen, O₂an element
Three molecules. Water and carbon dioxide are compounds; oxygen gas is an element whose atoms go round in pairs. The double lines are double bonds. Water is bent; carbon dioxide is straight.

Reading a chemical formula

A chemical formula says which elements are in a substance and in what proportion, using the element symbols from the periodic table and small numbers written below the line (subscripts).

  • H₂O: two hydrogen atoms (H₂) and one oxygen atom (O, with no number, meaning 1).
  • CO₂: one carbon atom and two oxygen atoms.
  • C₆H₁₂O₆ (glucose): six carbon atoms, twelve hydrogen atoms and six oxygen atoms, 24 atoms in all.
  • NaCl: sodium and chlorine in the ratio one to one.

A subscript belongs only to the symbol just before it. A large number written in front of a formula counts whole molecules: 3CO₂ means three molecules of carbon dioxide, which is 3 carbon atoms and 6 oxygen atoms.

Compounds are not mixtures

In What is matter? you met mixtures, in which substances are mingled but not joined. A compound is different in three ways:

MixtureCompound
Proportionsany amounts: a little salt or a lot in wateralways fixed: every sample of water is H₂O
Propertieseach ingredient keeps its ownnew properties, unlike the elements'
Separatingby physical methods: filtering, evaporating, a magnetonly by a chemical reaction

A classic example: powdered iron and yellow sulfur stirred together make a mixture, and a magnet pulls the iron straight out. When the two react (in a laboratory, with a fume cupboard), they form a new, dark compound, iron sulfide, from which no magnet can pull any iron.

IntuitionH

What holds atoms together: a first, honest picture

Why do atoms join at all? The short answer is electric attraction. Every atom has a positive nucleus and negative electrons. When two atoms come close, the electrons of each are attracted to the nucleus of the other too. In the right arrangement, the atoms together have less energy than they did apart, a bit like a ball that has rolled down into a dip. That joining force is a chemical bond. A bond is not a little stick, as model kits suggest: it is electrons spread out between two nuclei, attracted to both.

Chemists describe three main kinds of bond. Real bonds are often somewhere in between, but these three are the right place to start.

Sharing: covalent bonds. Between non-metal atoms, such as hydrogen, carbon, nitrogen and oxygen, atoms share pairs of electrons. Each shared pair, held between two nuclei, is a covalent bond. In water, the oxygen atom shares one pair of electrons with each hydrogen atom. In carbon dioxide and in oxygen gas, the atoms share two pairs, a double bond. Covalent bonds make molecules: water, carbon dioxide, sugar, caffeine and the molecules of life.

Giving and taking: ionic bonds. When a metal meets a non-metal, the metal atom often gives one or more electrons to the non-metal atom. Each becomes an ion, an atom with an electric charge. A sodium atom gives one electron to a chlorine atom: the sodium becomes Na⁺ and the chlorine becomes a chloride ion, Cl⁻. Opposite charges attract strongly, so the ions pack together in a huge, regular, three-dimensional pattern: a crystal.

Cl⁻Na⁺Cl⁻Na⁺Cl⁻Na⁺Cl⁻Na⁺Cl⁻Na⁺Cl⁻Na⁺Cl⁻Na⁺Cl⁻Na⁺Cl⁻Na⁺Cl⁻Na⁺Cl⁻Na⁺Cl⁻Na⁺Cl⁻Na⁺Cl⁻Na⁺Each sodium ion, Na⁺, is surroundedby chloride ions, Cl⁻, and eachchloride ion by sodium ions.No pairs, no molecules: one ionof each kind for every one of theother, so the formula is NaCl.
A slice through a crystal of table salt. Sodium ions (Na⁺) and chloride ions (Cl⁻) alternate in every direction, in a pattern that repeats millions of times in a single grain of salt.

A sea of electrons: metallic bonds. In a metal, such as copper or iron, every atom lets go of one or more of its outer electrons, which then wander freely through the whole piece of metal, holding the positive ions together. Those wandering electrons are why metals conduct electricity, the reason copper is used for wires.

Why do atoms give, take or share electrons in just these ways? A useful rule of thumb is that atoms tend to end up with the same number of electrons as the nearest noble gas in the periodic table, the family that hardly reacts at all. Sodium (11 electrons) loses one to match neon (10); chlorine (17) gains one to match argon (18). In water, sharing gives oxygen a share in 10 electrons, like neon. The deeper reasons, and the many exceptions, are explained in Chemical bonding.

Analogy, not a formal construction

Covalent bonding is like two children holding the same skipping rope, each pulling on it, which keeps them together. Ionic bonding is more like one child handing a ball to another: afterwards, one has a ball too many and one a ball too few, and here the "extra" and "missing" charges pull them strongly together. Like all analogies, this one breaks down if you push it: electrons are not balls or ropes.

Worked examplesH

Why salt is not like sodium or chlorine

Now Puzzle 2 has an answer. The properties of a substance come mostly from its electrons: how they are arranged, and how easily they are lost, gained or shared.

Example— Sodium, chlorine and sodium chloride

Sodium, NaChlorine, Cl₂Sodium chloride, NaCl
At room temperaturesoft, silvery metalyellow-green gaswhite, hard crystals
What it is made ofsodium atoms, sharing a sea of electronsmolecules of two chlorine atomsNa⁺ and Cl⁻ ions in a crystal
Behaviourreacts violently with water; stored under oilpoisonous; attacks the lungsdissolves quietly in water; melts at 801 °C
In the bodynot found as the metalnot found as the gasneeded every day, in small amounts

A sodium atom has one loosely held outer electron, which it loses very easily, so sodium metal reacts fiercely with water and air. A sodium ion has already lost that electron; its remaining electrons are tightly held, so it is calm and stable. In the same way a chlorine molecule grabs electrons from almost anything, which is what makes it harmful, while a chloride ion already has the extra electron it "wanted". The ions are completely different particles from the atoms, so salt is a completely different substance.

The same goes for Puzzle 1. In a water molecule, the hydrogen and oxygen atoms have already joined in a stable arrangement and have no tendency to burn. Puzzle 3 is about how atoms join: carbon dioxide molecules are small and barely attract each other, so it is a gas, while sugar molecules are large and cling together, so sugar is a solid.

Even an element can change its properties with the way its atoms are joined. Diamond and graphite (the "lead" in pencils) are both pure carbon. In diamond each carbon atom is bonded to four others in a rigid three-dimensional network, making the hardest natural material; in graphite the atoms are bonded in flat sheets that slide over each other, which is why it is soft and leaves a mark on paper.

ComputationC

Counting atoms with Python

A computer can read formulas for us. This program reads each formula letter by letter: a capital letter starts a new element symbol, a small letter can follow it (as in Na or Cl), and a number after the symbol says how many atoms. Then it adds up the atoms, and, using the average mass of each kind of atom from the periodic table, the mass of each molecule in atomic mass units (u).

python
import re

# Average masses of atoms, in atomic mass units (u), rounded
MASS = {"H": 1.008, "C": 12.011, "N": 14.007, "O": 15.999, "Na": 22.990, "Cl": 35.45, "Ca": 40.078}

def count_atoms(formula):
    """Read a formula like 'C6H12O6' into {'C': 6, 'H': 12, 'O': 6}."""
    counts = {}
    # a capital letter, maybe a small letter, then maybe a number
    for symbol, number in re.findall(r"([A-Z][a-z]?)(\d*)", formula):
        counts[symbol] = counts.get(symbol, 0) + (int(number) if number else 1)
    return counts

compounds = [
    ("water", "H2O"),
    ("carbon dioxide", "CO2"),
    ("table salt", "NaCl"),
    ("baking soda", "NaHCO3"),
    ("chalk", "CaCO3"),
    ("glucose", "C6H12O6"),
    ("sucrose (sugar)", "C12H22O11"),
    ("caffeine", "C8H10N4O2"),
]

print(f"{'compound':16} {'formula':10} {'atoms':>5}   {'mass (u)':>8}   atoms of each element")
for name, formula in compounds:
    counts = count_atoms(formula)
    total = sum(counts.values())
    mass = sum(MASS[el] * n for el, n in counts.items())
    print(f"{name:16} {formula:10} {total:5d}   {mass:8.2f}   {counts}")
Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Try adding a compound of your own, such as methane, CH4, the main gas in natural gas, or ammonia, NH3. (This simple reader cannot handle brackets, as in Ca(OH)₂; can you see why?)

ExplanationH

Compounds at home and in your body

Here are some compounds you meet every day. Chemists give each one an exact name, agreed internationally through IUPAC, as well as the everyday name.

Everyday nameChemical nameFormulaWhere you meet it
waterwater (oxidane)H₂Oabout 60 % of an adult's body mass
table saltsodium chlorideNaClfood; sea water; your blood and sweat
sugarsucroseC₁₂H₂₂O₁₁sugar cane, sugar beet, sweets
blood sugarglucoseC₆H₁₂O₆the fuel your cells burn for energy
baking sodasodium hydrogencarbonateNaHCO₃baking; some antacid tablets
vinegar's acidethanoic acid (acetic acid)CH₃COOHabout 5 % of vinegar
chalk, limestone, eggshellcalcium carbonateCaCO₃eggshells, seashells, marble, chalk
carbon dioxidecarbon dioxideCO₂the bubbles in fizzy drinks; the gas you breathe out
caffeinecaffeineC₈H₁₀N₄O₂tea, coffee, cocoa, kola nuts

The molecules of life are much bigger. A protein molecule, such as the haemoglobin that carries oxygen in your blood, contains thousands of atoms, and a single DNA molecule in one of your cells contains thousands of millions. Your bones and teeth get their hardness from a compound of calcium, phosphorus and oxygen (with a little hydrogen), arranged in tiny crystals.

How chemists see molecules

How do we know that water is bent and carbon dioxide straight? One way is to shine X-rays through a crystal: the pattern they make reveals where the atoms are. The British chemist Dorothy Crowfoot Hodgkin used this method to find the structures of penicillin (1945), vitamin B₁₂ and insulin, and won the Nobel Prize in Chemistry in 1964. Today chemists use X-rays, magnetic resonance and computer calculations together, and the free database PubChem lists more than a hundred million compounds, each with its formula and shape.

Common misconceptionsH

Common misconceptions

Misconception

"A compound is just a mixture of its elements." In a mixture, each substance keeps its properties and can be separated physically. In a compound, the atoms are chemically bonded into a new substance with new properties, and only a chemical reaction can split them apart.

Misconception

"Table salt is made of NaCl molecules." Salt is a crystal of ions, with no separate pairs. The formula NaCl tells you the ratio of ions, one sodium ion for every chloride ion, not the contents of a molecule. Chemists call one Na⁺ with one Cl⁻ a formula unit.

Misconception

"Every molecule is a compound." O₂, N₂ and ozone, O₃, are molecules of a single element, so they are elements, not compounds. Diamond, made only of carbon atoms, is an element too.

Misconception

"Chemical bonds are little sticks between the atoms." Sticks are a handy way to draw bonds. Real bonds are electrons spread out between nuclei and attracted to both, and the atoms in a molecule are always vibrating, so bond lengths are averages.

Exercises

Exercises

These exercises practise reading formulas, telling elements from compounds, and thinking about bonds. One asks you to write a little Python.

1. Molecules and compounds

Warm-upHuman

Glucose, the sugar your cells use for energy, has the formula C₆H₁₂O₆. How many atoms are there in one molecule of glucose?

2. Molecules and compounds

CoreHuman

Which of these substances are compounds? Select all that apply.

Choose all that apply

3. Molecules and compounds

CoreHuman

What is the difference between 2H₂O and H₂O₂?

Choose one

4. Molecules and compounds

CoreHuman

Sodium is a dangerously reactive metal and chlorine is a poisonous gas. Why is sodium chloride, table salt, safe to eat in small amounts?

Choose one

5. Molecules and compounds

Warm-upHuman

In which of these substances are the particles held together mainly by ionic bonds?

Choose one

6. Molecules and compounds

Warm-upHuman

Write the chemical formula of carbon dioxide, a molecule with one carbon atom and two oxygen atoms. (Type the 2 as an ordinary digit, e.g. H2O for water.)

7. Molecules and compounds

CoreHuman

How many oxygen atoms are there in 3CO₂?

8. Molecules and compounds

CoreComputational

A formula can be stored in Python as a dictionary that says how many atoms of each element there are, for example glucose as {"C": 6, "H": 12, "O": 6}.

Complete total_atoms(formula) so that it returns the total number of atoms. Replace the ....

Runs entirely in your browser, in an isolated worker. Nothing is sent to a server.

Further reading and resources

  • PubChemSearch for any compound in this lesson (try "caffeine" or "sucrose") to see its formula, its structure in 3D, and its safety information.
  • PhET: Build a Molecule · University of Colorado BoulderA free simulation. Join atoms into molecules and see their formulas and 3D shapes.
  • The Nobel Prize in Chemistry 1964Dorothy Crowfoot Hodgkin, for finding the shapes of important molecules with X-rays.
  • IUPACThe international body that agrees how chemical compounds are named and how formulas are written.