A Gas in a Box

Heat is motion. Fill a box with bouncing particles, measure the pressure they make and the temperature they share, and watch a bell curve of speeds appear from nothing but collisions

A Gas in a Box

The air round you is mostly empty space, crossed by molecules that move faster than sound and each collide billions of times a second.

Pressure is the patter of those molecules on the walls, and temperature is how energetically they move. Here you can measure both.

What Pushes on the Walls

Begin with one disc and watch its separate kicks, then press 10, 100 and 300 and see them blur into a steady push. Drag the wall, and change the temperature, the mass and the size of the discs.

settling…
pressure measured, all four walls
1.05
predicted, allowing for the discs’ size
1
predicted for points: NkT/A
—
hits counted on the right-hand wall, per unit of time
—
measured average energy per disc (kT = 1.00)
—
scatter of the push, measured
343%
scatter predicted, ∝ 1/√N
1.41
r.m.s. speed, √(2kT/m) in a flat gas

The four walls: left —right —floor —ceiling —

Nothing here pushes steadily. There are only kicks, each with a long gap after it. But keep the average running and it heads for the dashed line.
kicks on the right-hand wallrunning average, and measured pointspredictionwalls kept at the set temperature

The gas is flat, the units are the simulation’s own and Boltzmann’s constant is 1, so a temperature is an energy and a pressure is a force per length of wall (the length the discs’ edges can reach). The discs are hard and do not attract each other. Three walls are warm: a disc leaves them with a fresh random velocity at the set temperature. The wall you drag is smooth. “Scatter” is for the push averaged over a quarter of the time √(m/kT) × width. The size correction (Henderson’s equation, with the crowding along the walls) is good to a few per cent. The ± is one standard error. Colour shows speed, blue slow to red fast.

Go deeper:From 2mv to PV = NkT

A molecule of mass m meets a wall with speed vx towards it and bounces straight back, so its momentum changes by 2mvx. In a box of length L it returns after 2L/vx. Kick times rate gives an average force mvx2/L. Collisions with other molecules do not spoil this: they pass momentum along without losing any. Add up N molecules and divide by the area of the wall, and the box’s volume V appears:

PV = N × (average of mvx2)

In three dimensions v2 = vx2 + vy2 + vz2 and no direction is special, so mvx2 averages a third of mv2, and PV is two-thirds of the total kinetic energy. In the flat gas of the demo there are two directions, and PA equals the total kinetic energy. Either way, calling the average of mvx2 “kT” gives PV = NkT. Daniel Bernoulli published this picture, and the conclusion that pressure grows as the square of the speed, in Hydrodynamica in 1738. Hardly anyone took it up for a century. See also: Momentum and Collisions.

The raggedness of the push is counting statistics. If n hits arrive at random in some interval, their total varies by about 1/√n of itself, and n is proportional to N. A wall of one square centimetre in ordinary air is struck about 3 × 1023 times a second, so the pressure averaged over even a millisecond is steady to about one part in ten thousand million. See also: The Law of Large Numbers.

Chemists count in moles, 6.02214076 × 1023 at a time, and write PV = nRT with R = 8.314 J/(mol K) for n moles. A mole of any ideal gas at 0 °C and one atmosphere fills 22.4 litres. That atmosphere presses with 101 325 N on each square metre, the weight of about 10 tonnes; we do not notice because it presses from every side. A molecule of air travels about 70 nm between collisions, some two hundred times its own diameter, and has about seven thousand million of them a second. Real molecules also take up room, as the fat discs do, and attract one another, as the discs do not.

One Temperature

Watch a hot light gas and a cold heavy gas agree on one temperature through a wall of jiggling atoms, then change the numbers and masses and see which quantity it is that agrees. The other tabs give both the same heat, bring in a third body, and turn to real gases.

Between them
2.00
temperature of the light gas, average of the last 2 time units
0.50
temperature of the heavy gas, likewise
1.357
shared temperature, (N1 T1 + N2 T2)/(N1 + N2)
211.714
total energy, wall included: exactly conserved
2.00
r.m.s. speed of the light discs
0.33
r.m.s. speed of the heavy discs
6.00 times
light ÷ heavy, measured
3.00 times
at equal temperatures, √(mass ratio)
Look at which chart agrees. The speeds do not become equal: the light discs stay faster by the square root of the mass ratio. The total energies do not become equal either, unless the numbers are. What meets is the average kinetic energy of one disc, and that is what a temperature is.
light gasheavy gas (ringed discs)predicted from energy conservation

The conducting wall is a column of 16 atoms of mass 2, each a disc shut in its own tiny cage. Gas discs of either side bounce off them, and that is the only way energy crosses. Every collision is elastic and nothing is rescaled, so energy is conserved to rounding. The atoms start with the predicted average energy, so they do not shift the answer. Flat gas, k = 1: temperature is the average kinetic energy per disc (in three dimensions it would be 3/2 kT). Discs are coloured by speed, so at one temperature the heavy gas looks bluer. With this few discs the readings wobble by several per cent for ever.

Go deeper:What a Thermometer Measures

When a heavy disc and a light one collide, energy may pass either way. On average it passes from the one with more kinetic energy to the one with less, until the averages are equal. The result is called equipartition. At temperature T every independent direction of motion of every particle, light or heavy, has average kinetic energy ½kT. That makes kT for a disc in the plane and (3/2)kT for a molecule in space. It fixes the speeds too, since ½mv2 is the same for all: at one temperature the r.m.s. speed goes as 1/√m.

So temperature is not the energy of a body, which grows with its size. Nor is it heat. Heat is the name for energy on its way from one body to another because of a difference in temperature. There is no heat stored in a kettle; there is energy, some of which may leave as heat. A thermometer is any body small enough not to disturb what it touches, with some property that shows its own temperature. It always reports its own; what makes it useful is that two bodies which each agree with a third agree with each other. That is the zeroth law, numbered late because the first and second already had their names.

Cool a gas at constant volume and its pressure falls along a straight line. Extend the line and it reaches zero at −273.15 °C, whatever the gas, though every real gas turns liquid or solid first. That is absolute zero, the 0 of the kelvin scale. Since 2019 the kelvin has been defined by fixing Boltzmann’s constant at exactly k = 1.380649 × 10−23 joules per kelvin, so a temperature is in effect an energy quoted in unusual units: 300 K is about 4.1 × 10−21 J. In this classical picture all motion would stop at absolute zero; in quantum mechanics it does not, and a least “zero-point” motion remains. See also: From Oscillators to Fields.

Molecules near the edge of the atmosphere leave if they move faster than about 11 km/s. The fraction that do falls off roughly as e to the power −mv2/2kT, so a modest difference in mass makes an enormous difference in lifetime: hydrogen goes, nitrogen stays. It matters that the air up there is at 1000 K or more. The Moon, with an escape speed of 2.4 km/s, has kept almost no air at all.

A Bell Curve from Collisions

Press Play and watch a crowd of equal speeds turn into a smooth spread of speeds within a few collisions. Try the other three starts, lay the predicted curves over the bars, and tap a disc to follow it.

Start with
0.0
collisions per disc so far
0.36
Boltzmann’s H now
−0.97
its average at equilibrium, for 400 discs
1.00
⟨v⁴⟩/⟨v²⟩²: 1 for equal speeds, 2 for the curve
Nothing much has collided yet. Press Play and watch the bars.
the discs nowpredicted: Maxwell’s curves for a flat gas, and the average HBoltzmann’s Hthe tagged disc and its history

Flat gas, k = 1, insulating walls. The far bars also collect anything faster than the chart. H is Σ f ln f over 36 equal cells of the plane of velocities (nine rings of energy 0.7 kT, four quarters); a small crowd cannot fill the cells evenly, so its average H is higher. The tagged disc’s history counts from time 1, by how long it spends at each speed; it needs some hundreds of collisions, so use 2×. Every collision is exactly reversible; how H can fall all the same is the subject of The Arrow of Time, in this module.

Go deeper:Maxwell’s Argument and Boltzmann’s H

In 1860 James Clerk Maxwell found the curve without following a single collision. Suppose that the spread of velocities is the same in every direction, so that the density depends on the speed alone, and that a molecule’s velocity to the right tells you nothing about its velocity upwards, so that the density is a product. Then

f(vx) f(vy) f(vz) depends only on vx2 + vy2 + vz2

A product that depends only on a sum must be an exponential of that sum, and so f(vx) is a bell curve, e to the power −mvx2/2kT, with variance kT/m. The second assumption was the weak point, and Maxwell gave a better argument from collisions in 1867. See also: The Central Limit Theorem.

The speed is a different matter from a component. There are more ways to be moving fast than slow: the velocities of speed v lie on a circle of length 2πv in the plane, or a sphere of area 4πv2 in space. Multiplying by that gives the two densities

plane: (mv/kT) e−mv²/2kT     space: 4π(m/2πkT)3/2 v2 e−mv²/2kT

In space the most likely, mean and r.m.s. speeds are √(2kT/m), √(8kT/πm) and √(3kT/m); in the plane they are √(kT/m), √(πkT/2m) and √(2kT/m). Otto Stern measured molecular speeds directly with beams in the 1920s, and later experiments of the same kind traced out the whole curve.

In 1872 Ludwig Boltzmann showed why collisions lead there. Assuming that molecules about to collide are uncorrelated, the quantity H = Σ f ln f can only fall, and it stops falling exactly at Maxwell’s distribution. The assumption hides a direction of time, since molecules that have just collided are correlated, and what you see in the demo is a fall followed by fluctuations, not a law without exceptions. Reversing the sign turns H into an entropy. See also: The Arrow of Time, Shannon Entropy.

Key Takeaways

  • Pressure is a great many small kicks: 2mv at a time, v/2L times a second, and steady only because there are so many.
  • For an ideal gas PV = NkT, whatever the molecules weigh; molecules that take up room press a little harder.
  • Temperature is the average kinetic energy per particle: not the speed, not the total energy, and not heat.
  • Collisions turn any starting speeds into Maxwell’s curve, and one molecule’s history traces the same curve as the crowd.

Spot a mistake or have an idea?

Search