Maxwell Speed Distribution
Gas molecules bounce elastically in a box while a histogram of their speeds builds up in real time. The theoretical Maxwell-Boltzmann curve is overlaid for comparison. Raise the temperature and watch the distribution broaden and shift to higher speeds; increase the molecular mass and watch it narrow and slow down.
About this lab
The Maxwell-Boltzmann speed distribution describes the statistical spread of molecular speeds in an ideal gas at thermal equilibrium. Derived independently by James Clerk Maxwell (1860) and Ludwig Boltzmann (1868), it was one of the first results of statistical mechanics. The distribution is not symmetric — it has a long tail at high speeds, which means the mean speed is higher than the most probable speed. Three characteristic speeds are commonly defined: the most probable speed v_mp = sqrt(2kT/m), the mean speed v_mean = sqrt(8kT/(pi*m)), and the root-mean-square speed v_rms = sqrt(3kT/m), where k is Boltzmann's constant, T is temperature, and m is molecular mass.
This simulation models molecules as hard disks undergoing perfectly elastic collisions — conserving both momentum and kinetic energy. When two molecules collide, their velocities are updated using the center-of-mass frame transformation. Wall collisions simply reverse the perpendicular velocity component. Even though the molecules start with random initial speeds, the collisions rapidly drive the speed distribution toward the Maxwell-Boltzmann form. This is a direct demonstration of the equipartition theorem and the central limit behavior that emerges from many random binary interactions.
Changing the temperature rescales all molecular speeds by sqrt(T_new / T_old), reflecting the fact that temperature is proportional to mean kinetic energy. Increasing the molecular mass at constant temperature reduces speeds, since heavier molecules need less velocity to carry the same kinetic energy. These relationships explain why lighter gases like hydrogen and helium diffuse faster and have higher thermal velocities than heavier molecules like nitrogen or oxygen — a fact with consequences ranging from atmospheric escape to the design of gas centrifuges.