Course-wide Conventions & Notation
Overview and Learning Objectives¶
Sections 4.1 and 4.2 developed entropy entirely from macroscopic reasoning: a state function defined by , used to derive engine efficiency limits and the direction of spontaneous heat flow. This section shifts to the microscopic side, connecting entropy to the statistical-mechanical framework from Chapter 2. The payoff is substantial: entropy becomes a measure of how many ways a system can realize a macrostate, and its connection to the partition function provides a direct bridge between microscopic energy levels and macroscopic thermodynamic potentials.
We introduce three successively more general formulas for entropy — Boltzmann’s (isolated systems), the Gibbs form (any ensemble), and the canonical identity — and show that they are mutually consistent. The section culminates in the identification of the Helmholtz free energy , which was foreshadowed in Sections 2.3 and 3.3.
Learning objectives:
State the second-law condition for isolated systems and interpret equilibrium as .
Use Boltzmann’s formula and explain why the logarithm ensures extensivity.
Compute entropy from a probability distribution via .
Derive the canonical identity .
Identify the Helmholtz free energy as a consequence of the canonical entropy formula.
Core Ideas and Derivations¶
Entropy Increases Until the System Reaches Equilibrium¶
The second law for an isolated system (Section 4.2) requires
with equality only at equilibrium. The qualitative picture is:
Out of equilibrium: entropy increases spontaneously ().
At equilibrium: entropy reaches its maximum value subject to the constraints and stops changing ().
Source
import numpy as np
import matplotlib.pyplot as plt
# Schematic "approach to equilibrium" curve
t = np.linspace(0, 10, 400)
S_i = 1.0
S_f = 2.0
# Smooth approach to plateau + slight wiggle to mimic "spontaneous process" steps
S = S_f - (S_f - S_i) * np.exp(-t/2.0) + 0.03*np.sin(5*t)*np.exp(-t/2.0)
fig, ax = plt.subplots(figsize=(4,3))
ax.plot(t, S)
ax.axhline(S_f, linestyle="--")
ax.set_xlabel("time (schematic)")
ax.set_ylabel("entropy (schematic)")
ax.set_title("Entropy increases until equilibrium (isolated system)")
ax.text(0.4, S_i+0.05, r"$S_i$")
ax.text(7.5, S_f+0.03, r"$S_f$")
ax.set_ylim(S_i-0.1, S_f+0.2)
ax.grid(True, alpha=0.3)
plt.show()
plt.close(fig)
Entropy rises from to during a spontaneous process and then becomes constant at equilibrium.
A concrete example from Section 4.2 illustrates this. Two subsystems at different temperatures () in an insulated box exchange heat, and we showed that
as long as . Energy flows from to , raising and lowering , until . At that point the factor vanishes, , and the system has reached thermal equilibrium at the entropy maximum.
The Clausius Inequality¶
The entropy definition applies specifically to reversible heat transfer. A more general statement, valid for both reversible and irreversible processes, is the Clausius inequality:
Equality holds for a reversible process: .
Strict inequality holds for an irreversible process: .
The physical interpretation is that irreversibility produces additional entropy beyond the entropy “carried in” by heat flow. For an isolated system (), the Clausius inequality reduces to , recovering the second law.
The Clausius inequality also explains why the Carnot engine (Section 4.2) sets the maximum efficiency. Any irreversible engine operating between the same two reservoirs produces entropy internally (), so more heat must be rejected to the cold reservoir to compensate, reducing the net work output.
Entropy and the Number of Microstates: Boltzmann’s Formula¶
We now connect entropy to the microscopic picture. For an isolated system (microcanonical ensemble), the fundamental postulate of statistical mechanics (Section 2.1) assigns equal probability to each of the accessible microstates. The entropy of such a system is
Here is the number of microstates compatible with the macroscopic constraints (fixed , , ). You can think of as the degeneracy of the macrostate: fix the total energy and other extensive quantities, then count how many distinct microscopic configurations share those values.
Why the Logarithm?¶
A key property of thermodynamic entropy is that it is extensive: for two independent subsystems and ,
But the number of microstates is multiplicative for independent systems:
The logarithm converts the product into a sum:
Without the logarithm, entropy would not be additive for independent subsystems.
Entropy in Terms of Probabilities: The Gibbs Entropy¶
The Gibbs (or Gibbs–Shannon) formula generalizes Boltzmann’s result from “counting equally likely microstates” to working with an arbitrary probability distribution over microstates :
This formula has two important features:
It reduces to Boltzmann’s formula in the microcanonical case. If all accessible microstates are equally likely (), then
It applies when microstates are not equally likely — for instance, when the system is in contact with a heat bath (canonical ensemble). In this case, , and different microstates have different probabilities.
Canonical Ensemble: Entropy in Terms of the Partition Function¶
We now evaluate the Gibbs entropy for the canonical ensemble. Recall from Section 2.2 that a closed system (fixed , ) in thermal contact with a reservoir at temperature has microstate probabilities
where the canonical partition function is
Derivation¶
Starting from the Gibbs entropy,
insert :
Using and the definition of internal energy from Section 2.3,
we obtain
Substituting :
This is a central result: it expresses the macroscopic state function directly in terms of the partition function and the internal energy , both of which we know how to compute from microscopic energy levels.
Connection to the Helmholtz Free Energy¶
Rearranging the boxed result gives
The left-hand side is the Helmholtz free energy, — a state function whose natural variables are and . We therefore have
This result was foreshadowed in Section 2.3 (where it was stated as a Module 5 preview) and in Section 3.3 (where we noted that would be “convenient at constant and ”). It is arguably the single most important equation in canonical statistical mechanics: if you can compute , you can compute , and from you can derive all other thermodynamic quantities — , , , , and chemical potentials — by taking appropriate derivatives. We will develop this machinery in a later chapter.
Microscopic Interpretation of Heat (Connection to Section 3.2)¶
The results above connect naturally to the microscopic interpretation of the First Law developed in Section 3.2. Differentiating gives
For a closed system with only work, comparing with , we identified (Section 3.2):
Heat: — energy exchange via redistributing probabilities among fixed energy levels.
Work: — energy exchange via shifting the energy levels themselves (e.g., changing volume changes the particle-in-a-box levels).
The Gibbs entropy formula shows why this decomposition is natural. Since depends only on the probabilities , entropy changes when and only when probabilities change — that is, when heat flows. Work, which shifts energy levels without redistributing probabilities, does not change the entropy. This is consistent with the macroscopic result: for a reversible adiabatic process (), .
Worked Examples¶
Example 1: Entropy of a two-state distribution¶
Problem. A system has two microstates with probabilities and . Compute the Gibbs entropy and find where it is maximized.
Solution. The Gibbs entropy is
At (maximally uncertain):
To confirm this is a maximum, note that is concave (its second derivative for ) and is zero at the endpoints and , where one microstate has all the probability and there is no uncertainty.
Result. The maximum entropy occurs at , where the distribution is most spread out. This is consistent with Boltzmann’s formula: two equally likely microstates give and .
Example 2: Entropy of the two-state system from Section 2.2¶
Problem. In Section 2.2, we analyzed a two-state system with energies and and found and at . Compute the entropy two ways: (a) from the Gibbs formula, and (b) from the canonical identity .
Solution.
(a) Gibbs formula.
Evaluating: and , so
(b) Canonical identity.
From Section 2.2: , and .
Result. Both methods give the same answer, as they must — the canonical identity is derived from the Gibbs formula. Notice that the entropy () is less than the maximum () because the distribution is not perfectly uniform: the ground state is slightly more populated than the excited state at 300 K. At higher temperatures, the two probabilities would become more equal, and would approach from below.
Concept Checks¶
How does “entropy increases until equilibrium” translate into a statement about probability distributions over microstates?
Why does require the microcanonical assumption ? What goes wrong if you try to apply it to a canonical ensemble?
In the Gibbs entropy formula, why does when for one state and for all others?
How can entropy be extensive (additive for independent subsystems) while probability distributions are normalized to 1?
Starting from , how would you obtain and as functions of ? (Hint: think about which partial derivatives of give and .)
Key Takeaways¶
Entropy quantifies how many microstates — or how much probability weight — a macrostate contains.
Boltzmann’s applies to isolated systems (microcanonical ensemble, equal probabilities). The logarithm ensures extensivity.
The Gibbs formula generalizes Boltzmann’s result to any probability distribution and reduces to it in the microcanonical limit.
In the canonical ensemble, ties entropy directly to the partition function.
Rearranging gives the Helmholtz free energy — the master potential from which all canonical thermodynamic quantities can be derived.
The microscopic decomposition (Section 3.2) is consistent with the entropy picture: only the (heat) term changes probabilities and therefore changes entropy.