Statistical Mechanics · Kinetic Theory · Thermodynamics
📅 April 2026 ⏱ ≈ 10 min read 🎯 Intermediate

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:

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:

⟨½ m v_x²⟩ = ½ k_B T
⟨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.

Boltzmann factor. The relative probability of finding a molecule in a state with energy E compared to a reference state is P ∝ e−E / kBT. This exponential suppression of high-energy states is the foundation for chemical kinetics, the Arrhenius equation, and the full Maxwell–Boltzmann distribution.

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:

f(v_x) = √(m / 2π k_B T) · exp(−m v_x² / 2 k_B T)

// 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:

f(v) = 4π · (m / 2π k_B T)^(3/2) · v² · exp(−m v² / 2 k_B T)

// valid for v ≥ 0; integrates to 1 over [0, ∞)

The three factors have intuitive interpretations:

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.

Molar form. For NA molecules per mole use M = m NA (molar mass) and R = kB NA (gas constant). The distribution in terms of molar quantities is f(v) = 4π(M/2πRT)^(3/2) · v² · exp(−Mv²/2RT), convenient for chemists.

4. Characteristic Speeds: vp, ⟨v⟩, vrms

Three speeds characterise the distribution:

Most probable
vp = √(2kBT/m)
Peak of the distribution. Obtained by setting df/dv = 0.
Mean speed
⟨v⟩ = √(8kBT/πm)
= (2/√π)·vp. Equals 4/π times vrms/√3.
RMS speed
vrms = √(3kBT/m)
√⟨v²⟩ = √3/√2 · vp. Appears in ½mv² = 3/2 kBT.
Ratio: v_p : ⟨v⟩ : v_rms = 1 : 1.128 : 1.225

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:

f(E) = (2/√π) · (1/k_B T)^(3/2) · √E · exp(−E / k_B T)

// This is the Gamma distribution with shape α = 3/2

Key moments of the energy distribution:

The energy distribution is universal in the sense that it depends on temperature only through the ratio E/kBT — the Boltzmann factor again.

Fraction with E > Ea. In the Arrhenius equation for reaction rates, the fraction of molecules able to overcome an activation barrier Ea is ∫Ea f(E) dE ≈ exp(−Ea/kBT) when Ea ≫ kBT. A small increase in temperature dramatically raises this fraction — explaining why reaction rates often double per 10 °C rise.

6. Temperature Dependence

As temperature increases the distribution broadens and its peak shifts to the right. Qualitatively:

v_p(T) = √(2 k_B T / m)

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:

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:

rate₁ / rate₂ = ⟨v₁⟩ / ⟨v₂⟩ = √(M₂ / M₁)

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

k(T) = A · exp(−E_a / k_B T) // E_a = activation energy

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.

Open simulation →