Maxwell–Boltzmann Distribution — Speed & Energy of Gas Molecules
First derived by James Clerk Maxwell in 1860 and placed on a rigorous statistical foundation by Ludwig Boltzmann in 1872, the Maxwell–Boltzmann distribution describes the probability that a molecule in an ideal gas travels at a given speed. It connects thermodynamic temperature to the microscopic world of individual particles and underlies phenomena from chemical reaction rates to stellar atmosphere escape.
1. Kinetic Theory: Molecules & Temperature
In kinetic theory an ideal gas is a collection of N point particles bouncing inside a container. Four key assumptions define the model:
- Molecules are identical, perfectly elastic spheres (no energy loss on collision).
- The volume of the molecules is negligible compared to the container volume.
- The only interactions are instantaneous elastic collisions; there are no long-range forces.
- Collisions are statistically uncorrelated — the molecular chaos assumption.
With these assumptions the pressure–volume–temperature relationship emerges purely from Newton's laws. More importantly, the equipartition theorem links absolute temperature to the average kinetic energy per degree of freedom:
⟨E_k⟩ = ½ m ⟨v²⟩ = 3/2 · k_B T // three translational DoF
where kB = 1.380 649 × 10⁻²³ J/K is Boltzmann's constant and m is the molecular mass. Temperature is therefore a macroscopic measure of microscopic kinetic energy.
2. Gaussian Velocity Components
Because the gas is in thermal equilibrium and there is no preferred direction, each Cartesian velocity component is independent and identically distributed. Combining the equipartition result with the Boltzmann factor for a single component gives a one-dimensional Gaussian:
// variance σ² = k_B T / m, standard deviation σ = √(k_B T / m)
This is the probability density for the x-component of velocity. The mean is zero (no net drift) and the distribution widens with temperature. The same form holds for vy and vz.
In 3D, the velocity vector (vx, vy, vz) follows a spherically symmetric multivariate Gaussian — a product of three independent one-dimensional Gaussians.
3. The Speed Distribution f(v)
The speed v = |v| (a scalar magnitude, v ≥ 0) has a different distribution than each component. To find it, we integrate the 3D Gaussian over all angles, treating the velocity space as a set of thin spherical shells of radius v and thickness dv. The surface area of such a shell is 4πv², giving:
// valid for v ≥ 0; integrates to 1 over [0, ∞)
The three factors have intuitive interpretations:
- 4πv² — the volume of the spherical shell in velocity space (more ways to reach high speed).
- (m / 2πkBT)^(3/2) — normalisation constant.
- exp(−mv² / 2kBT) — Boltzmann factor suppressing high energies.
The competition between the v² term (growing) and the Boltzmann suppression (falling) creates a peak at a finite speed, giving the characteristic right-skewed bell shape.
4. Characteristic Speeds: vp, ⟨v⟩, vrms
Three speeds characterise the distribution:
Numerical example — N₂ at 300 K (m = 28 × 1.66×10⁻²⁷ kg = 4.65×10⁻²⁶ kg):
v_p ≈ 422 m/s
⟨v⟩ ≈ 476 m/s
v_rms ≈ 517 m/s
Because the distribution is positively skewed, the RMS speed lies above the mean, which lies above the most-probable speed. For all three, speed scales as √T (doubling temperature increases speeds by ≈ 41 %) and as 1/√m (lighter molecules move faster at the same temperature).
5. Energy Distribution
Substituting E = ½mv² (so dE = mv dv, v = √(2E/m)) into the speed distribution gives the distribution over kinetic energies:
// This is the Gamma distribution with shape α = 3/2
Key moments of the energy distribution:
- Peak (most probable energy): Ep = ½ kBT
- Mean energy: ⟨E⟩ = (3/2) kBT (from equipartition)
- Variance: Var(E) = (3/2)(kBT)²
The energy distribution is universal in the sense that it depends on temperature only through the ratio E/kBT — the Boltzmann factor again.
6. Temperature Dependence
As temperature increases the distribution broadens and its peak shifts to the right. Qualitatively:
- At low T the molecules are slow and tightly clustered around vp.
- At high T the distribution spreads out — more molecules at both very low and very high speeds.
- The area under the curve is always 1 (normalisation), so as it widens it also flattens.
T = 300 K, N₂: v_p ≈ 422 m/s
T = 600 K, N₂: v_p ≈ 597 m/s // ×√2 ≈ ×1.41
T = 1200 K, N₂: v_p ≈ 844 m/s // ×2 vs original
Heavier molecules have smaller vp at the same temperature. Hydrogen (H₂, M = 2 g/mol) at room temperature has vp ≈ 1578 m/s — nearly four times that of oxygen (O₂, M = 32 g/mol) at ≈ 394 m/s. This mass dependence underpins Graham's law of effusion and isotope separation by gaseous diffusion.
The High-Speed Tail
The exponential tail means there is always some probability of extremely fast molecules. This tail matters enormously:
- Atmospheric escape: molecules in the high-speed tail of Earth's exosphere can exceed escape velocity (≈ 11.2 km/s). The lightweight hydrogen and helium leak away over geological time.
- Nuclear fusion: the Sun's core temperature (≈ 1.5 × 10⁷ K) is too low for classical fusion — only the high-speed tail enables quantum tunnelling through the Coulomb barrier (Gamow peak).
7. JavaScript: Box–Muller Sampling
To simulate a gas, we need to sample from the Maxwell–Boltzmann distribution. The cleanest approach uses the Box–Muller transform to produce standard-normal samples for each velocity component, then scales by the thermal velocity σ = √(kBT/m).
// Box–Muller transform: two uniform → two standard-normal samples
function boxMuller() {
const u1 = Math.random(); // uniform in (0, 1]
const u2 = Math.random();
const r = Math.sqrt(-2 * Math.log(u1));
return [
r * Math.cos(2 * Math.PI * u2),
r * Math.sin(2 * Math.PI * u2),
];
}
// Sample a single particle velocity (vx, vy, vz) in m/s
function sampleVelocity(T, m) {
const kB = 1.380649e-23; // Boltzmann constant J/K
const sigma = Math.sqrt(kB * T / m); // thermal speed (std dev per component)
const [z0, z1] = boxMuller();
const [z2] = boxMuller();
return {
vx: sigma * z0,
vy: sigma * z1,
vz: sigma * z2,
};
}
// Compute the speed probability density at speed v (m/s) for a molecule of mass m
function maxwellBoltzmannPDF(v, T, m) {
const kB = 1.380649e-23;
const a = m / (2 * kB * T);
return 4 * Math.PI * Math.pow(a / Math.PI, 1.5)
* v * v
* Math.exp(-a * v * v);
}
// Example: initialise N₂ molecules at 300 K
const N = 500;
const T = 300; // Kelvin
const mN2 = 28 * 1.6605e-27; // 28 u in kg
const particles = Array.from({length: N}, () => sampleVelocity(T, mN2));
// Compute speed of each and histogram
const speeds = particles.map(p =>
Math.hypot(p.vx, p.vy, p.vz)
);
const vp = Math.sqrt(2 * 1.380649e-23 * T / mN2); // ~422 m/s
const vrms = Math.sqrt(3 * 1.380649e-23 * T / mN2); // ~517 m/s
Scaling for a Canvas Simulation
For a 2D browser simulation the velocity vector is reduced to (vx, vy). Since we cannot use SI units directly, we scale velocities to pixel-per-frame units: choose a reference speed V0 (in pixels/frame) corresponding to vp at the desired temperature, then multiply samples by V0/vp. The shape of the distribution is identical; only the units change.
8. Applications
Graham's Law of Effusion
When a gas escapes through a tiny hole into vacuum, faster molecules effuse more frequently. The effusion rate is proportional to the mean speed, giving:
Uranium hexafluoride isotopes ²³⁵UF₆ (M ≈ 349) and ²³⁸UF₆ (M ≈ 352) differ by only √(352/349) ≈ 1.004 per stage. Cascading thousands of stages allows isotope enrichment for nuclear reactors and weapons.
Arrhenius Equation & Reaction Rates
The rate constant k(T) is proportional to the Boltzmann factor — the fraction of molecular collisions with enough energy to surmount the activation barrier. This explains why raising T by 10 °C roughly doubles most reaction rates.
Doppler Broadening of Spectral Lines
The thermal motion of atoms in a hot gas shifts each atom's emitted/absorbed photon frequency by the Doppler effect. Since vx follows a Gaussian, the resulting spectral line has a Gaussian profile with width Δν ∝ √(T/M). Astronomers use this broadening to measure the temperature and turbulent velocity of stellar atmospheres.
Jeans Escape & Planetary Atmospheres
At the top of an atmosphere (exosphere) molecules that reach escape velocity are lost to space. The fraction above vescape is the tail of the Maxwell–Boltzmann distribution. Hydrogen and helium are so light that even at Earth's exosphere temperature (≈ 1000 K) an appreciable fraction exceeds vesc ≈ 11.2 km/s — explaining why the Earth has retained its nitrogen-oxygen atmosphere but lost its primordial hydrogen.
See it in motion
Watch hundreds of gas molecules colliding in a 2D box — their speed distribution emerges spontaneously and matches the Maxwell–Boltzmann curve.