Nobody can follow the path of every molecule in a glass of water. There are around 1025 of them, colliding billions of times a second. Yet the water has a perfectly definite temperature, and if you leave it on a table it will reliably come to the temperature of the room. In the second half of the nineteenth century James Clerk Maxwell, Ludwig Boltzmann and later Josiah Willard Gibbs worked out why. When the numbers are large enough, ignorance about the details turns into certainty about the whole. The subject they created is statistical mechanics.

Counting the ways

Toss a hundred coins. There is exactly one way for all of them to land heads, but about 1029 ways for them to land fifty heads and fifty tails. Nothing forbids the first outcome; it is simply outnumbered. Boltzmann's insight was that a gas, a crystal or a cup of tea works the same way. What we can measure, such as pressure or temperature, is a macrostate. Each macrostate can be produced by an enormous number of microstates, the exact positions and speeds of all the molecules. Boltzmann tied the two together with a single line, later carved on his tombstone in Vienna:

S=kBln⁡W

This is the modern meaning of entropyEntropyA measure of how many microscopic arrangements fit what we observe of a system; loosely, its disorder, or the information we are missing.. It is not disorder in a vague sense. It is a count of how many ways the inside of a system can be arranged while looking the same from outside.

The Boltzmann distribution

Now put a small system, a single molecule perhaps, in contact with something much larger that holds its temperature steady. How likely is the molecule to be found in a state with a given energy? The answer, the Boltzmann distributionBoltzmann distributionThe rule that a system at a given temperature occupies each of its states with a probability that falls off exponentially with the state's energy., is one of the most useful formulas in science:

pi=e−Ei/kBTZ

The reason is counting again. Every bit of energy the molecule takes is energy the large surroundings no longer have, and fewer arrangements remain open to them. The exponential is the price. The same formula explains why air thins with altitude, why chemical reactions speed up when warmed and how the atoms in a laser can be coaxed out of balance.

What temperature really is

We think of temperature as hot or cold, a reading on a thermometer. Statistical mechanics gives it a sharper meaning. Temperature measures how much a system's entropy grows when you give it a little more energy:

1T=∂S∂U

This explains why heat flows from hot to cold. Energy passing from a hot body to a cold one costs the hot body a little entropy but gains the cold body more, so the total count of arrangements goes up. Equilibrium is reached when no further transfer would raise it, which is exactly when the two temperatures are equal. Temperature is not a substance and not a property of any single molecule. It is a statement about the whole crowd.

Why time has a direction

The laws that govern individual collisions work equally well forwards and backwards. Film two billiard balls bouncing off each other and the reversed film looks just as plausible. Yet nobody has seen a broken egg reassemble or a cooled cup of coffee warm itself up from the air. In 1876 Josef Loschmidt pressed this puzzle on his friend Boltzmann: how can reversible laws produce irreversible behaviour?

Boltzmann's answer was that the second law of thermodynamics, which says entropy tends to increase, is a law of overwhelming probability. A system starting in a rare, low-entropy state will almost certainly wander into the vastly more numerous high-entropy states, simply because there are so many more of them. Going back is not forbidden, only so unlikely that it never happens on any timescale that matters.

That answer moves the mystery rather than removing it. If entropy always rises, it must once have been very low. The arrow of time we feel, remembering the past but not the future, seems to trace back to the extraordinarily ordered state of the early universe. Why it began that way is still an open question, and one of the deepest in physics.