---
title: "Boltzmann weights and thermal fluctuations | Sandbox Physics"
description: "Normalize Boltzmann weights to predict level populations. Use the same probabilities to calculate thermal averages and fluctuations."
canonical_url: "https://sandboxphysics.com/learn/heat-and-statistics/boltzmann-weights-and-fluctuations/"
language: "en"
page_type: "story"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/learn/heat-and-statistics/boltzmann-weights-and-fluctuations/"
last_modified: "2026-11-25"
---

[Volume 5 · Heat, Probability and Matter](https://sandboxphysics.com/learn/heat-and-statistics/)

# How do probabilities determine a system's thermal averages?

Normalize Boltzmann weights to predict level populations. Use the same probabilities to calculate thermal averages and fluctuations.

Before you start: [Chapter 2](https://sandboxphysics.com/learn/heat-and-statistics/molecular-motion-and-pressure/) on histograms and [Chapter 4](https://sandboxphysics.com/learn/heat-and-statistics/entropy-and-irreversibility/) on entropy.

After this chapter you can: Calculate a partition sum and use it to find state probabilities, mean energy and energy variance.

At thermal equilibrium with a large heat bath, each microstate has a weight that falls exponentially with its energy. A higher energy level can still hold more of the population if many microstates share it. Normalizing the weights lets you calculate averages and the size of their fluctuations.

## 6.1 Turn the bath's entropy into a probability

Consider a small system that exchanges energy with a large bath at absolute temperature $T$. The two together are isolated. If the system gains energy $E_i$ in microstate $i$, the bath has that much less energy. For a bath large enough to keep its temperature nearly fixed, its entropy changes by about $-E_i/T$ relative to the chosen zero for system energy.

The number of bath states is proportional to the exponential of its entropy divided by $k_B$. This gives the relative weight of microstate $i$. Divide by the sum of all weights to make the probabilities add to one.

$$
\beta=\frac{1}{k_BT},\qquad
Z=\sum_i e^{-\beta E_i},\qquad
p_i=\frac{e^{-\beta E_i}}{Z}.
$$

The factor $e^{-\beta E_i}$ is the Boltzmann weight. The normalization $Z$ is the partition function. Adding the same constant to every energy multiplies each weight and their sum by the same factor, leaving the probabilities unchanged.

## 6.2 Count every state at the same energy

Set a ground level to energy zero and an excited level to energy $\Delta$. The ground level contains one microstate. If $g$ microstates share the excited energy, their probabilities add. With dimensionless temperature $\vartheta=k_BT/\Delta$,

$$
Z=1+g e^{-\beta\Delta},\qquad
P_{\mathrm{exc}}=\frac{g}{e^{1/\vartheta}+g}.
$$

The count $g$ is the degeneracy of the excited level. At $\vartheta=1$, a single excited state gives probability $0.269$. Three excited states at the same energy give total probability $0.525$. Each individual excited state is still less likely than the ground state.

**Table 6.1** Calculated probability of finding the system at the excited energy for two state counts.

| Dimensionless temperature | One excited state | Three excited states |
| --- | --- | --- |
| $0.50$ | $0.119$ | $0.289$ |
| $1.00$ | $0.269$ | $0.525$ |
| $2.00$ | $0.378$ | $0.645$ |

- One excited state
- Three excited states

**Figure 6.1** Analytic excited-level probabilities for one ground microstate and either one or three excited microstates. The energy gap stays fixed. The vertical axis counts all the probability at the excited energy.

## 6.3 Use the probabilities for averages and fluctuations

Multiply a quantity's value in each state by that state's probability and sum. For the energy, the first and second moments give the mean and variance.

$$
\langle E\rangle=\sum_i p_i E_i,\qquad
\operatorname{Var}(E)=\sum_i p_i E_i^2-\langle E\rangle^2.
$$

In the example, the mean energy is $\Delta P_{\mathrm{exc}}$ and the variance is $\Delta^2 P_{\mathrm{exc}}(1-P_{\mathrm{exc}})$. At low temperature, the system is almost always near the ground energy. At higher temperature both levels can have substantial probability, so individual observations can differ substantially from the mean.

For a system at fixed volume and particle count with temperature-independent energies, differentiating the normalized weights gives

$$
C_V=\frac{\partial\langle E\rangle}{\partial T}
=\frac{\operatorname{Var}(E)}{k_BT^2}.
$$

$C_V$ is the total heat capacity, in $\mathrm{J\,K^{-1}}$. This connects an equilibrium fluctuation to the response of the mean energy to a small change in temperature. A sample variance from a short, correlated run may differ from this equilibrium variance.

## 6.4 See two ways to obtain a distribution

### 6.4.1 Sample a spin lattice at fixed temperature

Open [Ising Critical Fluctuations](https://sandboxphysics.com/labs/ising-critical-fluctuations/). The model has spins on a square lattice. Neighbouring spins have lower energy when they align. The program proposes a randomly chosen spin flip. It accepts a flip that lowers the energy or leaves it unchanged, and accepts an energy increase $\Delta E$ with probability $e^{-\Delta E/(k_BT)}$. The energy-increasing proposal and its reverse have the same proposal probability. The acceptance rule gives their forward and reverse transitions the ratio required by the Boltzmann weights.

Choose **Order survives**, then **Heat breaks the patches**. Compare the visible domains and **Energy per spin**. Both use a $32\times32$ lattice and zero applied field. Lower temperature makes energy-increasing flips rare, so aligned regions persist. At higher temperature disordering flips are more common.

**Table 6.2** Example means from the model's first 96 recorded sweeps after warm-up. Energy is in units of the coupling $J$ per spin.

| Preset | Temperature $k_BT/J$ | Mean energy per spin divided by $J$ |
| --- | --- | --- |
| Order survives | $1.50$ | $-1.952$ |
| Heat breaks the patches | $4.20$ | $-0.520$ |

Consecutive sweeps share much of the same configuration. The table describes these particular model samples. It takes longer runs and checks for equilibration to estimate an equilibrium average or its uncertainty.

### 6.4.2 Group motions by speed in a gas

Open [Hard Spheres to Boltzmann](https://sandboxphysics.com/labs/hard-spheres-to-boltzmann/) and turn on **Statistical lens**. Follow one particle while watching the empirical speed histogram change. The bodies move in two dimensions. For a classical equilibrium velocity in two dimensions, the ring of velocity vectors with the same speed has circumference proportional to $v$. The thermal speed density is therefore proportional to $v e^{-mv^2/(2k_BT)}$. In the three-dimensional example in Chapter 2, the shell area gave the factor $v^2$ instead.

The curve in this Lab uses the current mean speed to set its scale. Compare its shape with the fluctuating histogram. The two-dimensional gas visualization follows elastic collisions. The spin experiment uses a sampling rule with a prescribed temperature.

## 6.5 Exercises

1. Two individual microstates differ by $2k_BT$ in energy. What is the higher-to-lower probability ratio?
2. One ground state has energy zero. Two excited states have the same energy $\Delta$. Write the partition function and the probability of being at the excited energy.
3. Why does adding a constant to all energies leave every state probability fixed?
4. In the model with one ground state and three excited states, what fraction of the population goes to the excited level in the high-temperature limit?
5. In the high-temperature limit, a one-ground, one-excited system has $P_{\mathrm{exc}}=1/2$. What are the mean energy and its variance in terms of $\Delta$?
6. Two systems at the same temperature have different energy variances at fixed volume and particle count. Which has the greater equilibrium heat capacity under the conditions of §6.3?
7. For an upward energy move in the spin model, does heating make acceptance more or less likely? Use the sign of the energy change.
8. Why should you distinguish a two-dimensional speed distribution from a three-dimensional one for the same particle mass and temperature?

Exercise 1

The ratio is $e^{-2}\approx0.135$. The partition function cancels in the ratio.

Exercise 2

The partition function is $Z=1+2e^{-\beta\Delta}$. The excited-energy probability is $2e^{-\beta\Delta}/Z$ because it sums the probabilities of two states.

Exercise 3

The shift multiplies every weight by a common factor. It multiplies the partition function by that factor too, so it cancels.

Exercise 4

At very high temperature all four states approach equal probability. Three are excited states, so their total fraction approaches $3/4$.

Exercise 5

The mean is $\Delta/2$. The second moment is $\Delta^2/2$. Subtracting the squared mean gives variance $\Delta^2/4$.

Exercise 6

The system with greater variance has greater $C_V$, since both share the same factor $1/(k_BT^2)$.

Exercise 7

It becomes more likely. For $\Delta E>0$, increasing temperature moves $-\Delta E/(k_BT)$ toward zero and raises its exponential.

Exercise 8

The equilibrium energy weight is the same for the same kinetic energy. The number of velocity states in a given speed interval grows differently with speed in the two cases. A ring gives the factor $v$, and a spherical shell gives $v^2$.

## Test it in the Lab

Change one setting at a time, then compare what you see with the tables and answers in this chapter.

[Ising Critical Fluctuations → Heat a sheet of tiny magnets and watch its domains break apart. Paint a patch directly on the lattice, then compare its survival at different temperatures and sizes.](https://sandboxphysics.com/labs/ising-critical-fluctuations/) [Hard Spheres to Boltzmann → Every sphere on the left moves by deterministic elastic collisions. The upper-right view drops particle identities and keeps only the speed distribution. The lower-right view weaves one particle’s past collisions into a graph, and a violet recollision closes it into a correlation loop.](https://sandboxphysics.com/labs/hard-spheres-to-boltzmann/)

## Sources and reading scope

1. [MIT 8.044 Statistical Physics I, Notes on the Canonical Ensemble](https://ocw.mit.edu/courses/8-044-statistical-physics-i-spring-2013/7fa3fb4237d0d00d5603ae4ea8f02236_MIT8_044S13_Canonical.pdf)

   The notes derive canonical weights from a system in contact with a thermal reservoir and interpret the partition sum and its derivatives.

2. [Nicholas Metropolis et al., Equation of State Calculations by Fast Computing Machines](https://www.osti.gov/biblio/4390578)

   The original report describes accepting or rejecting proposed moves to sample configurations with the Boltzmann weight.

3. [OpenStax, University Physics Volume 2, §2.4 Distribution of Molecular Speeds](https://openstax.org/books/university-physics-volume-2/pages/2-4-distribution-of-molecular-speeds)

   The distribution gives the most probable, mean and root-mean-square speeds and shows how they depend on temperature.

[← Chapter 5 · How much work can a heat engine deliver in one cycle?](https://sandboxphysics.com/learn/heat-and-statistics/heat-engines-and-cycles/)

Chapters in this volume

- [1. When does a thermometer represent the sample temperature?](https://sandboxphysics.com/learn/heat-and-statistics/temperature-and-thermal-equilibrium/)
- [2. How do molecular collisions create pressure?](https://sandboxphysics.com/learn/heat-and-statistics/molecular-motion-and-pressure/)
- [3. How do heat and work change internal energy?](https://sandboxphysics.com/learn/heat-and-statistics/first-law-of-thermodynamics/)
- [4. Why does heat flow spontaneously from hot to cold?](https://sandboxphysics.com/learn/heat-and-statistics/entropy-and-irreversibility/)
- [5. How much work can a heat engine deliver in one cycle?](https://sandboxphysics.com/learn/heat-and-statistics/heat-engines-and-cycles/)
- [6. How do probabilities determine a system's thermal averages?](https://sandboxphysics.com/learn/heat-and-statistics/boltzmann-weights-and-fluctuations/)

## Keep reading

Interactive Physics Textbook · Reading path

### Heat, Probability and Matter

1. [Article **When does a thermometer represent the sample temperature?**](https://sandboxphysics.com/learn/heat-and-statistics/temperature-and-thermal-equilibrium/)
2. [Article **How do molecular collisions create pressure?**](https://sandboxphysics.com/learn/heat-and-statistics/molecular-motion-and-pressure/)
3. [Article **How do heat and work change internal energy?**](https://sandboxphysics.com/learn/heat-and-statistics/first-law-of-thermodynamics/)
4. [Article **Why does heat flow spontaneously from hot to cold?**](https://sandboxphysics.com/learn/heat-and-statistics/entropy-and-irreversibility/)
5. [Article **How much work can a heat engine deliver in one cycle?**](https://sandboxphysics.com/learn/heat-and-statistics/heat-engines-and-cycles/)
6. [You are here **How do probabilities determine a system's thermal averages?**](https://sandboxphysics.com/learn/heat-and-statistics/boltzmann-weights-and-fluctuations/)

1 more group

### Other articles that use the same experiments

Each experiment from this article that another series also uses, followed by the articles there.

1. [Lab **Ising Critical Fluctuations**](https://sandboxphysics.com/labs/ising-critical-fluctuations/)
2. [Article **Why very different materials behave alike near a critical point**](https://sandboxphysics.com/stories/thermal-complexity/wilson-critical-scales/)
