2.4.12Thermodynamics & Statistical Mechanics (Advanced)

Free energy from partition function

1,780 words8 min readdifficulty · medium

1. What we are building

The goal: show the deceptively simple result F=kBTlnZ\boxed{F = -k_B T \ln Z} and derive it from scratch, not just quote it.


2. Derivation from first principles

Step 2a — Probability of a microstate

The Boltzmann probability of microstate ii is pi=eβEiZ.p_i = \frac{e^{-\beta E_i}}{Z}. Why this step? The bath fixes TT; maximizing entropy at fixed average energy gives exactly this exponential weight, and dividing by ZZ normalizes ipi=1\sum_i p_i = 1.

Step 2b — Internal energy from ZZ

U=E=ipiEi=1ZiEieβEi.U = \langle E \rangle = \sum_i p_i E_i = \frac{1}{Z}\sum_i E_i\, e^{-\beta E_i}. Notice βeβEi=EieβEi\dfrac{\partial}{\partial\beta}e^{-\beta E_i} = -E_i e^{-\beta E_i}, so iEieβEi=Zβ.\sum_i E_i e^{-\beta E_i} = -\frac{\partial Z}{\partial\beta}. Therefore U=1ZZβ=lnZβ.U = -\frac{1}{Z}\frac{\partial Z}{\partial\beta} = -\frac{\partial \ln Z}{\partial \beta}. Why this step? We turned a weighted sum into a derivative of ZZ — the whole point: differentiate lnZ\ln Z instead of summing microstates.

Step 2c — Entropy from ZZ (Gibbs entropy)

Start from the Gibbs/Shannon entropy S=kBipilnpi.S = -k_B \sum_i p_i \ln p_i. Why this step? This is the statistical definition of entropy; it reduces to kBlnΩk_B\ln\Omega for equal-probability microstates. Substitute lnpi=βEilnZ\ln p_i = -\beta E_i - \ln Z: S=kBipi(βEilnZ)=kBβipiEiU+kBlnZipi=1.S = -k_B\sum_i p_i(-\beta E_i - \ln Z) = k_B\beta\underbrace{\sum_i p_i E_i}_{U} + k_B\ln Z\underbrace{\sum_i p_i}_{=1}. So S=kBβU+kBlnZ=UT+kBlnZ.S = k_B\beta\, U + k_B\ln Z = \frac{U}{T} + k_B\ln Z.

Step 2d — Assemble FF

F=UTS=UT(UT+kBlnZ)=UUkBTlnZ.F = U - TS = U - T\left(\frac{U}{T} + k_B\ln Z\right) = U - U - k_B T\ln Z. F=kBTlnZ\boxed{F = -k_B T\ln Z} Why this is beautiful: UU cancels exactly. The free energy is pure lnZ\ln Z — confirming the intuition that FF is the additive (extensive) partner of the multiplicative ZZ.

Figure — Free energy from partition function

3. Everything else falls out of FF

Because dF=SdTpdV+μdNdF = -S\,dT - p\,dV + \mu\,dN, we read off:

Self-consistency check: using U=F+TSU = F+TS with F=kBTlnZF=-k_BT\ln Z and SS above reproduces U=βlnZU=-\partial_\beta\ln Z. ✓


4. Worked examples


5. Common mistakes (steel-manned)


Recall Feynman: explain to a 12-year-old

Imagine a big bag of dice that each can land on a number, but cold dice "prefer" small numbers and hot dice are wild. The partition function ZZ is one number that secretly knows how many likely outcomes the whole bag has. The "free energy" FF is just a stretched-out version of ZZ — we squish ZZ with a logarithm so that when you put two bags together, you can simply add their free energies instead of multiplying. From that one stretched number you can predict the bag's temperature behavior, its energy, and its messiness (entropy) — without ever counting every die one by one.


6. Active recall

#flashcards/physics

  • Define the canonical partition function. ::: Z=ieβEiZ=\sum_i e^{-\beta E_i}, sum over all microstates, β=1/kBT\beta=1/k_BT.
  • Helmholtz free energy in terms of ZZ? ::: F=kBTlnZF=-k_BT\ln Z.
  • Why a logarithm in FF (not just ZZ)? ::: Independent systems multiply their ZZ; ln\ln converts the product to a sum so FF is extensive (additive).
  • Internal energy from ZZ? ::: U=(lnZ)/β=1Z(βZ)U=-\partial(\ln Z)/\partial\beta = \frac{1}{Z}(-\partial_\beta Z).
  • Entropy from ZZ and UU? ::: S=U/T+kBlnZ=F/TS=U/T + k_B\ln Z = -\partial F/\partial T.
  • Pressure from ZZ? ::: p=kBT(lnZ)/V=F/Vp=k_BT\,\partial(\ln Z)/\partial V = -\partial F/\partial V.
  • In deriving F=UTSF=U-TS, what cancels? ::: UU cancels exactly, leaving kBTlnZ-k_BT\ln Z.
  • For NN identical independent two-level systems, F=?F=? ::: F=NkBTln(1+eβε)F=-Nk_BT\ln(1+e^{-\beta\varepsilon}).
  • Classical 1D oscillator ZZ? ::: Z=kBT/ωZ=k_BT/\hbar\omega, giving U=kBTU=k_BT (equipartition).
  • Common sign error in entropy formula? ::: S=F/TS=-\partial F/\partial T (minus, from dF=SdTpdV+μdNdF=-SdT-pdV+\mu dN).

7. Connections

Concept Map

normalizes weights

U equals minus d lnZ / d beta

weighted energy sum

S equals minus kB sum p ln p

log gives extensive potential

F equals U minus TS

F equals U minus TS

terms collapse

master quantity

Partition function Z

Boltzmann probability p_i

Internal energy U

Gibbs entropy S

Helmholtz free energy F

F equals minus kB T ln Z

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, statistical mechanics ka asli "boss" quantity hai partition function Z=ieβEiZ=\sum_i e^{-\beta E_i}. Yeh basically saare microstates ko Boltzmann weight ke saath count karta hai — thande system me low-energy states zyada important, garam me sab states almost barabar. Ek baar ZZ mil gaya, toh tumhe phir se microstate-by-microstate jaana nahi padta; sab thermodynamics differentiation se nikal aati hai.

Sabse seedha connection hota hai Helmholtz free energy F=UTSF=U-TS ke saath, aur result yaad rakhne layak hai: F=kBTlnZF=-k_BT\ln Z. WHY log? Kyunki do independent systems jodo toh unke ZZ multiply hote hain (Z=Z1Z2Z=Z_1Z_2), par energy aur free energy toh add honi chahiye (extensive). Log multiplication ko addition me badal deta hai — isiliye FF me lnZ\ln Z aata hai, sirf ZZ nahi.

Derivation simple hai: U=βlnZU=-\partial_\beta\ln Z (average energy), aur Gibbs entropy se S=U/T+kBlnZS=U/T + k_B\ln Z. Jab F=UTSF=U-TS me daalo, UU exactly cancel ho jaata hai aur bachta hai sirf kBTlnZ-k_BT\ln Z. Bahut clean! Iske baad S=F/TS=-\partial F/\partial T, p=F/Vp=-\partial F/\partial V — sab ready.

Do common galtiyaan: (1) log bhool jaana — phir FF extensive nahi rahega, galat. (2) U=βZU=-\partial_\beta Z likh dena bina ZZ se divide kiye — average lena hai, isliye 1ZβZ=βlnZ\frac{1}{Z}\partial_\beta Z=\partial_\beta\ln Z hota hai. Bas yeh do cheez sambhaal lo toh poora topic tumhara.

Go deeper — visual, from zero

Test yourself — Thermodynamics & Statistical Mechanics (Advanced)

Connections