Deriving the Boltzmann Distribution by Maximizing Weight
Imagine shaking a jar of a trillion trillion coins, each coin a molecule that can land on one of many energy levels. Only one arrangement of energies dominates overwhelmingly, and it dominates so completely that it is effectively the only arrangement ever observed. Finding that single dominant arrangement, by maximizing a weight function under fixed constraints, is how the Boltzmann distribution is actually derived rather than assumed. This derivation matters because it converts a combinatorial counting problem into the exponential population law that underlies nearly all of chemical thermodynamics. Reaction equilibria, spectroscopic intensities, and heat capacities all trace back to this single result. This article walks through the full derivation. You will see how Stirling's approximation tames huge factorials. You will see how Lagrange multipliers enforce fixed total particles and fixed total energy. You will arrive at the exponential population law and meet the two multipliers that become and the partition function later.
- The dominant configuration is the one that maximizes the statistical weight , subject to fixed total particles and fixed total energy .
- Taking and applying Stirling's approximation turns a product of factorials into a manageable sum.
- Two Lagrange multipliers, and , enforce the constraints and .
- Maximizing leads directly to , the Boltzmann population law.
- Later work identifies and the normalizing sum as the molecular partition function .
- Key idea: the Boltzmann distribution is not postulated — it is the unique population pattern that maximizes the number of microstates consistent with fixed and .
Among all the ways to distribute molecules over energy levels while keeping the total number and total energy fixed, one distribution corresponds to vastly more microstates than any other, and locating it by maximizing with two Lagrange multipliers yields the exponential Boltzmann population law.
The physical picture
Consider molecules distributed among energy levels with populations . A particular set of populations is called a configuration. Prerequisite material shows that the number of microstates (ways of assigning distinguishable molecules to levels) realizing a given configuration is the statistical weight
For a mole of molecules, , and for the most probable configuration is so astronomically larger than for any neighboring configuration that fluctuations away from it are utterly negligible. This is the key physical fact that licenses replacing "the average over all configurations" by "the single most probable configuration." The task is therefore an optimization problem: find the set that maximizes (equivalently , which is monotonic in and far easier to differentiate), subject to two physical constraints that cannot be relaxed — the total number of molecules is fixed at , and the total energy is fixed at . Without constraints, the trivial maximum of would just pile every molecule into one level or spread them arbitrarily; the constraints are what make the answer physically meaningful and produce the characteristic exponential decay of populations with energy. The method of Lagrange multipliers is the natural tool here because the constraints are equalities that couple all the together. Rather than eliminating variables, we introduce two multipliers, conventionally and , one for each constraint, and extremize an augmented function. The resulting stationarity condition, applied level by level, gives an equation for each individually — this is the payoff of the Lagrange method: a coupled global problem decomposes into independent single-level equations.
The core relations
where: is the total number of molecules and is the population of level with energy .
where: Stirling's approximation has been applied to and to every .
where: these are the fixed-total-particles and fixed-total-energy constraints, enforced with multipliers and .
where: fixes the overall scale (tied to ) and controls how sharply population falls with energy.
where: the denominator is the molecular partition function , introduced properly in the next article.
Goal. Find the populations that maximize the statistical weight subject to and , and show this forces .
Step 1. Take the logarithm. Because is monotonically increasing, maximizing is equivalent to maximizing , and logarithms convert the unwieldy product of factorials into a sum:
Step 2. Apply Stirling's approximation. For large , . Since chemically relevant and every populated are enormous (of order Avogadro's number or a large fraction thereof), this approximation is essentially exact for our purposes:
Using , the two "" and "" terms cancel, leaving the compact working form
Step 3. Build the Lagrange function. We want to extremize subject to two constraints. Introduce multipliers for the particle-number constraint and for the energy constraint, and form
At a stationary point, is extremized with respect to each independently, as if the constraints did not couple them — this is precisely the power of the method: differentiate freely, then use the constraints to fix and afterward.
Step 4. Differentiate with respect to a single . Treating all as independent variables and using (nonzero only for ):
(The term in does not depend on any individual and drops out.)
Step 5. Solve for . Rearranging,
Exponentiating both sides,
This has the wrong sign in the exponent for a physically sensible population (it would grow with energy). The resolution is a sign convention: because higher-energy levels must be less populated, the Lagrange multiplier for energy is conventionally written as multiplying from the start, i.e. the constraint term in is taken as with defined so that the physical solution reads
where absorbs constants. (Equivalently, one simply defines as the multiplier that makes the exponent negative; its sign is fixed by physical requirement, its magnitude by the constraints — this is confirmed independently once is identified with in the next stage of the theory.)
Step 6. Apply the normalization constraint. Summing over all levels must reproduce :
so
Step 7. Assemble the final population law. Substituting back:
The remaining multiplier is fixed by the energy constraint , and, as shown in later work, . The denominator is the molecular partition function .
Worked examples
Example 1 — Two levels, small numbers, checking the maximization directly. Take a toy system with only two non-degenerate levels, and , and molecules total, so configurations are . Statistical weights:
Without any energy constraint, is most probable, consistent with at (equal populations when there's no energetic penalty and levels are non-degenerate). Now suppose the total energy is fixed at (so only configuration satisfies both and ). Here the constraint eliminates all but one configuration, and is trivially "most probable" — it's the only allowed one. This illustrates why real systems with huge and continuous-looking level spacing need the full machinery: many configurations satisfy the constraints, and Stirling plus Lagrange multipliers pick out the dominant one among a combinatorially vast set, something a 4-particle toy model is too small to show numerically but which the derivation guarantees in general. Check the general formula on this toy problem using the Lagrange result with chosen so . If (i.e., ), then , giving out of — exactly matching the constrained configuration found above. The value of is fixed uniquely by requiring the mean energy per molecule equal ; solving with gives exactly , confirming self-consistency.
Example 2 — Molar-scale system: verifying Stirling's approximation is safe. Suppose mol molecules, and at the most probable configuration the ground level holds molecules with the rest in excited levels. We check that Stirling's approximation is trustworthy at this scale, and estimate how sharply peaked is. Using the more accurate Stirling series, , the correction term for is
Compare this to the leading term:
The correction (≈28) is smaller than the leading term (≈) by a factor of about , so dropping it is an utterly safe approximation — this is exactly why Stirling's approximation, poor for small , becomes essentially exact for chemical-scale populations. Next, estimate the sharpness of the peak in around the most probable configuration. A standard result (from expanding to second order in a small deviation from the maximum) shows the weight falls by a factor of when a single population changes by roughly . For ,
So relative fluctuations are of order
a fractional deviation of about one part in . This confirms numerically that the "most probable configuration" is, for all practical purposes, the only configuration ever realized in a macroscopic sample — justifying Step 1's replacement of an ensemble average by a single dominant term.
Limiting cases & common traps
| Situation | What happens | Common error |
|---|---|---|
| Small (few particles) | Stirling's approximation is inaccurate; multiple configurations are comparably probable | Applying the derivation naively to small toy systems and expecting sharp peaking |
| All levels become equally populated regardless of energy | Forgetting this corresponds to the infinite-temperature limit, not zero temperature | |
| Degenerate levels | Each level's population must be weighted by its degeneracy , giving | Dropping degeneracy factors when levels are not simple singlets |
| Negative-looking exponent in Step 5 | A sign convention, not a physical error | Concluding the derivation is wrong because of the raw exponent sign before fixing conventions |
| Identifying | only established in later thermodynamic reasoning, not from combinatorics alone | Assuming 's physical meaning is derivable from Lagrange multipliers alone |
The chemist behind it
Ludwig Boltzmann built the statistical foundation connecting microscopic mechanics to macroscopic thermodynamics, arguing controversially in the 1870s that entropy could be understood as a measure of the number of microstates. His ideas met fierce resistance from physicists who doubted the atomic hypothesis itself, yet the maximization argument presented here — count the ways, apply the constraints, find the overwhelming maximum — is essentially the reasoning path he pioneered, later formalized with the tools of Lagrange and Stirling by Gibbs, Planck, and others who built the modern statistical mechanical framework on his foundation.
Origins · 1 minLudwig Eduard Boltzmann and how this was discovered
Ask the tutor: How does this derivation change if the energy levels are degenerate, and where does the degeneracy factor enter the final population law?
Why maximize ln W instead of W directly?
Both give the same maximizing configuration because the natural logarithm is a strictly increasing function, so wherever has its peak, has its peak too. The practical reason to work with is that Stirling's approximation is naturally stated in terms of , and sums are far easier to differentiate than products of factorials. Differentiating itself would require the product rule across every level simultaneously, a much messier calculation with no compensating benefit.
Why do we need Lagrange multipliers instead of just substituting the constraints in directly?
Direct substitution would mean solving for one in terms of all the others and eliminating it, which destroys the symmetric, level-by-level structure of the problem and quickly becomes intractable with many levels. Lagrange multipliers let us differentiate as though every were free, producing one simple equation per level. The two multipliers are then fixed afterward using the original constraints, which is far more tractable than constrained substitution.
Is the derivation valid if the energy levels are continuous rather than discrete?
Yes, with a modification: sums over discrete levels become integrals over a continuous energy variable, weighted by a density of states. The same maximization logic applies, and Stirling's approximation is equally valid because the populations involved remain macroscopically large. The final result is structurally identical, an exponential Boltzmann factor , now appearing inside an integral rather than a discrete sum.
Does this derivation tell us what beta actually is?
No. The Lagrange multiplier method only shows that exists as a single parameter controlling the energy dependence of populations, fixed in principle by the constraint . Identifying with requires a separate thermodynamic argument, connecting the statistical definition of entropy to the classical thermodynamic relation between entropy, energy, and temperature. That identification is the subject of the next stage of this development.
Why does this derivation assume distinguishable molecules with the N!/(product of n_i!) formula?
This weight formula matches the prerequisite discussion of microstates and configurations, which treats molecules as distinguishable for counting purposes, appropriate for localized particles such as atoms fixed on lattice sites. For indistinguishable gas-phase molecules, a corrected weight formula avoids overcounting, but the same Lagrange multiplier maximization procedure applies unchanged and yields the identical exponential population law, only the leading normalization details differ.