Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

4.3. Microscopic View of Entropy

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 dS=δqrev/TdS = \delta q_{\mathrm{rev}}/T, 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 QQ provides a direct bridge between microscopic energy levels and macroscopic thermodynamic potentials.

We introduce three successively more general formulas for entropy — Boltzmann’s S=kBln⁡ΩS = k_{\mathrm{B}}\ln\Omega (isolated systems), the Gibbs form S=−kB∑piln⁡piS = -k_{\mathrm{B}}\sum p_i\ln p_i (any ensemble), and the canonical identity S=U/T+kBln⁡QS = U/T + k_{\mathrm{B}}\ln Q — and show that they are mutually consistent. The section culminates in the identification of the Helmholtz free energy A=−kBTln⁡QA = -k_{\mathrm{B}}T\ln Q, which was foreshadowed in Sections 2.3 and 3.3.

Learning objectives:

Core Ideas and Derivations

Entropy Increases Until the System Reaches Equilibrium

The second law for an isolated system (Section 4.2) requires

dS≥0,dS \ge 0,

with equality only at equilibrium. The qualitative picture is:

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)
<Figure size 400x300 with 1 Axes>

Entropy rises from SiS_i to SfS_f during a spontaneous process and then becomes constant at equilibrium.

A concrete example from Section 4.2 illustrates this. Two subsystems at different temperatures (TA>TBT_A > T_B) in an insulated box exchange heat, and we showed that

dS=dUA ⁣(1TA−1TB)>0dS = dU_A\!\left(\frac{1}{T_A} - \frac{1}{T_B}\right) > 0

as long as TA≠TBT_A \neq T_B. Energy flows from AA to BB, raising TBT_B and lowering TAT_A, until TA=TBT_A = T_B. At that point the factor (1/TA−1/TB)(1/T_A - 1/T_B) vanishes, dS=0dS = 0, and the system has reached thermal equilibrium at the entropy maximum.


The Clausius Inequality

The entropy definition dS=δqrev/TdS = \delta q_{\mathrm{rev}}/T applies specifically to reversible heat transfer. A more general statement, valid for both reversible and irreversible processes, is the Clausius inequality:

dS≥δqT.dS \ge \frac{\delta q}{T}.

The physical interpretation is that irreversibility produces additional entropy beyond the entropy “carried in” by heat flow. For an isolated system (δq=0\delta q = 0), the Clausius inequality reduces to dS≥0dS \ge 0, 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 (dSirrev>0dS_{\mathrm{irrev}} > 0), 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 pi=1/Ωp_i = 1/\Omega to each of the Ω\Omega accessible microstates. The entropy of such a system is

S=kBln⁡Ω.S = k_{\mathrm{B}} \ln \Omega.

Here Ω\Omega is the number of microstates compatible with the macroscopic constraints (fixed UU, VV, NN). You can think of Ω\Omega 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 AA and BB,

Stotal=SA+SB.S_{\text{total}} = S_A + S_B.

But the number of microstates is multiplicative for independent systems:

Ωtotal=ΩA ΩB.\Omega_{\text{total}} = \Omega_A\,\Omega_B.

The logarithm converts the product into a sum:

Stotal=kBln⁡(ΩA ΩB)=kBln⁡ΩA+kBln⁡ΩB=SA+SB.S_{\text{total}} = k_{\mathrm{B}} \ln(\Omega_A\,\Omega_B) = k_{\mathrm{B}} \ln \Omega_A + k_{\mathrm{B}} \ln \Omega_B = S_A + S_B.

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 {pi}\{p_i\} over microstates i=1,…,Mi = 1, \dots, M:

S=−kB∑i=1Mpi ln⁡pi.S = -k_{\mathrm{B}} \sum_{i=1}^{M} p_i\,\ln p_i.

This formula has two important features:

  1. It reduces to Boltzmann’s formula in the microcanonical case. If all Ω\Omega accessible microstates are equally likely (pi=1/Ωp_i = 1/\Omega), then

    S=−kB∑i=1Ω1Ωln⁡ ⁣(1Ω)=−kBln⁡ ⁣(1Ω)=kBln⁡Ω.S = -k_{\mathrm{B}} \sum_{i=1}^{\Omega} \frac{1}{\Omega}\ln\!\left(\frac{1}{\Omega}\right) = -k_{\mathrm{B}}\ln\!\left(\frac{1}{\Omega}\right) = k_{\mathrm{B}}\ln\Omega.
  2. 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, pi=e−βEi/Qp_i = e^{-\beta E_i}/Q, 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 NN, VV) in thermal contact with a reservoir at temperature TT has microstate probabilities

pi=e−βEiQ,β≡1kBT,p_i = \frac{e^{-\beta E_i}}{Q}, \qquad \beta \equiv \frac{1}{k_{\mathrm{B}} T},

where the canonical partition function is

Q≡∑i=1Me−βEi.Q \equiv \sum_{i=1}^{M} e^{-\beta E_i}.

Derivation

Starting from the Gibbs entropy,

S=−kB∑ipiln⁡pi,S = -k_{\mathrm{B}} \sum_i p_i\ln p_i,

insert ln⁡pi=−βEi−ln⁡Q\ln p_i = -\beta E_i - \ln Q:

S=−kB∑ipi (−βEi−ln⁡Q)=kBβ∑ipiEi  +  kB(ln⁡Q)∑ipi.\begin{aligned} S &= -k_{\mathrm{B}} \sum_i p_i\,(-\beta E_i - \ln Q) \\ &= k_{\mathrm{B}}\beta \sum_i p_i E_i \;+\; k_{\mathrm{B}}(\ln Q)\sum_i p_i. \end{aligned}

Using ∑ipi=1\sum_i p_i = 1 and the definition of internal energy from Section 2.3,

U≡⟨E⟩=∑ipiEi,U \equiv \langle E \rangle = \sum_i p_i E_i,

we obtain

S=kBβU+kBln⁡Q.S = k_{\mathrm{B}}\beta U + k_{\mathrm{B}}\ln Q.

Substituting β=1/(kBT)\beta = 1/(k_{\mathrm{B}} T):

S=UT+kBln⁡Q.\boxed{ S = \frac{U}{T} + k_{\mathrm{B}}\ln Q. }

This is a central result: it expresses the macroscopic state function SS directly in terms of the partition function QQ and the internal energy UU, both of which we know how to compute from microscopic energy levels.


Connection to the Helmholtz Free Energy

Rearranging the boxed result gives

U−TS=−kBTln⁡Q.U - TS = -k_{\mathrm{B}}T\ln Q.

The left-hand side is the Helmholtz free energy, A≡U−TSA \equiv U - TS — a state function whose natural variables are TT and VV. We therefore have

A=−kBTln⁡Q.\boxed{ A = -k_{\mathrm{B}}T\ln Q. }

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 A=U−TSA = U - TS would be “convenient at constant TT and VV”). It is arguably the single most important equation in canonical statistical mechanics: if you can compute QQ, you can compute AA, and from AA you can derive all other thermodynamic quantities — SS, UU, PP, CVC_V, 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 U=∑ipiEiU = \sum_i p_i E_i gives

dU=∑ipi dEi+∑iEi dpi.dU = \sum_i p_i\, dE_i + \sum_i E_i\, dp_i.

For a closed system with only PVPV work, comparing with dU=δq+δw=δq−P dVdU = \delta q + \delta w = \delta q - P\,dV, we identified (Section 3.2):

The Gibbs entropy formula shows why this decomposition is natural. Since S=−kB∑ipiln⁡piS = -k_{\mathrm{B}}\sum_i p_i\ln p_i depends only on the probabilities {pi}\{p_i\}, 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 (δq=0\delta q = 0), dS=0dS = 0.


Worked Examples

Example 1: Entropy of a two-state distribution

Problem. A system has two microstates with probabilities pp and 1−p1-p. Compute the Gibbs entropy and find where it is maximized.

Solution. The Gibbs entropy is

S(p)=−kB[pln⁡p+(1−p)ln⁡(1−p)].S(p) = -k_{\mathrm{B}}\left[p\ln p + (1-p)\ln(1-p)\right].

At p=1/2p = 1/2 (maximally uncertain):

S=−kB[12ln⁡12+12ln⁡12]=−kBln⁡12=kBln⁡2.S = -k_{\mathrm{B}}\left[\tfrac{1}{2}\ln\tfrac{1}{2} + \tfrac{1}{2}\ln\tfrac{1}{2}\right] = -k_{\mathrm{B}}\ln\tfrac{1}{2} = k_{\mathrm{B}}\ln 2.

To confirm this is a maximum, note that S(p)S(p) is concave (its second derivative d2S/dp2=−kB/[p(1−p)]<0d^2S/dp^2 = -k_{\mathrm{B}}/[p(1-p)] < 0 for 0<p<10 < p < 1) and is zero at the endpoints p=0p = 0 and p=1p = 1, where one microstate has all the probability and there is no uncertainty.

Result. The maximum entropy kBln⁡2k_{\mathrm{B}}\ln 2 occurs at p=1/2p = 1/2, where the distribution is most spread out. This is consistent with Boltzmann’s formula: two equally likely microstates give Ω=2\Omega = 2 and S=kBln⁡2S = k_{\mathrm{B}}\ln 2.


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 E0=0E_0 = 0 and E1=ε=0.010 eVE_1 = \varepsilon = 0.010\ \mathrm{eV} and found p0=0.596p_0 = 0.596 and p1=0.404p_1 = 0.404 at T=300 KT = 300\ \mathrm{K}. Compute the entropy two ways: (a) from the Gibbs formula, and (b) from the canonical identity S=U/T+kBln⁡QS = U/T + k_{\mathrm{B}}\ln Q.

Solution.

(a) Gibbs formula.

S=−kB[0.596ln⁡(0.596)+0.404ln⁡(0.404)].S = -k_{\mathrm{B}}\left[0.596\ln(0.596) + 0.404\ln(0.404)\right].

Evaluating: 0.596ln⁡(0.596)=−0.3080.596\ln(0.596) = -0.308 and 0.404ln⁡(0.404)=−0.3660.404\ln(0.404) = -0.366, so

S=−kB(−0.308−0.366)=0.674 kB=9.31×10−24 J/K.S = -k_{\mathrm{B}}(-0.308 - 0.366) = 0.674\,k_{\mathrm{B}} = 9.31 \times 10^{-24}\ \mathrm{J/K}.

(b) Canonical identity.

From Section 2.2: Q=1.679Q = 1.679, and U=ε p1=(0.010)(0.404)=4.04×10−3 eV=6.47×10−22 JU = \varepsilon\,p_1 = (0.010)(0.404) = 4.04 \times 10^{-3}\ \mathrm{eV} = 6.47 \times 10^{-22}\ \mathrm{J}.

S=UT+kBln⁡Q=6.47×10−22300+(1.381×10−23)ln⁡(1.679).S = \frac{U}{T} + k_{\mathrm{B}}\ln Q = \frac{6.47 \times 10^{-22}}{300} + (1.381 \times 10^{-23})\ln(1.679).
S=2.16×10−24+7.16×10−24=9.31×10−24 J/K.S = 2.16 \times 10^{-24} + 7.16 \times 10^{-24} = 9.31 \times 10^{-24}\ \mathrm{J/K}.

Result. Both methods give the same answer, as they must — the canonical identity is derived from the Gibbs formula. Notice that the entropy (0.674 kB0.674\,k_{\mathrm{B}}) is less than the maximum (kBln⁡2=0.693 kBk_{\mathrm{B}}\ln 2 = 0.693\,k_{\mathrm{B}}) 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 SS would approach kBln⁡2k_{\mathrm{B}}\ln 2 from below.


Concept Checks

  1. How does “entropy increases until equilibrium” translate into a statement about probability distributions over microstates?

  2. Why does S=kBln⁡ΩS = k_{\mathrm{B}}\ln\Omega require the microcanonical assumption pi=1/Ωp_i = 1/\Omega? What goes wrong if you try to apply it to a canonical ensemble?

  3. In the Gibbs entropy formula, why does S=0S = 0 when pi=1p_i = 1 for one state and pj=0p_j = 0 for all others?

  4. How can entropy be extensive (additive for independent subsystems) while probability distributions are normalized to 1?

  5. Starting from A=−kBTln⁡QA = -k_{\mathrm{B}}T\ln Q, how would you obtain SS and UU as functions of TT? (Hint: think about which partial derivatives of AA give SS and UU.)

Key Takeaways