I am trying to derive an equation for the chemical potential of an ideal gas. I am following example 22.1 in Blundell & Blundell "Concepts in Thermal Physics".

In this example, an expression for $F$ is used which has been derived from the canonical ensemble $$F = Nk_BT[\ln{n\lambda_{th}^3}-1].$$

This is then substituded into $$\mu = \left(\frac{\partial F}{\partial N}\right)_{V,T}.$$

My question is: why is it valid to use an equation for $F$ derived from the canonical ensemble? Surely this equation is incorrect in this context, and will be missing various factors of $\mu N$, etc. This same process of stealing various results from the canonical ensemble is repeated throughout chapter 22 of Blundell & Blundell and I find it very confusing.

  • $\begingroup$ I'm not sure where you're having trouble. Are you troubled by the fact that the number of particles in the system is fixed when deriving the canonical distribution? We can get the Helmholtz free energy, which satisfies dF(T,V,N)=-PdV-SdT+$\mu$dN, from the canonical formalism. Are you worried about the free energy obtained from a distribution function, calculated by the statistical mechanics, matching the free energy introduced by thermodynamics? $\endgroup$
    – Siam
    Oct 10, 2021 at 12:09

2 Answers 2


I think you already know a lot of what I am going to write, but for the sake of completeness I will write down everything I thought of in relation to your question. So please forgive the verbosity!

In the next table you will find three important thermodynamic ensembles along with the corresponding thermodynamic functions, variables, and partition functions.

fixed/controlled variables name corresponding thermodynamic function relationship to partition function
$U,V,N$ microcanonical ensemble $S(U,V,N)$ = entropy $S=k_{B}\ln\left(Ω\left(U,V,N\right)\right)$
$T,V,N$ canonical ensemble $F(T,V,N)$ = free energy $F=-k_{B}T\ln\left(Z_{C}\left(T,V,N\right)\right)$
$T,V,μ$ grand canonical ensemble $J(T,V,μ)$ = grand canonical potential $J=-k_{B}T\ln\left(Z_{GC}\left(T,V,μ\right)\right)$

According to my thermodynamics book, it is not important if you derive your thermodynamic quantities like temperature, entropy, or chemical potential from the microcanonical, canonical or grand canonical partition function as long as the number of particles in your system is extremely large (of the order of Avogadro's number). This statement should be understood in the following manner: in a microcanonical ensemble, the internal energy $U$ of your system together with the particle number $N$ are fixed values, which do not fluctuate around a mean value, because your system is isolated. If one goes from the micro-canonical (keyword: $U,V,N$) to the canonical ensemble (keyword: $T,V,N$), the value of the internal energy $U$ is practically "relaxed" and may now fluctuate around a mean value. Only the temperature remains fixed. If you keep the number of particles, the volume and the temperature identical during the transition from the microcanonical to the canonical ensemble, the internal energy $U$ of the microcanonical-ensemble will be identical to the mean value $\langle{U}\rangle$ of the internal energy of the canonical ensemble. But if the number of particles is very high, the fluctuations around the mean value will be so insignificant, that you don't have to worry about replacing the mean with the variable itself, since it makes no difference in the end. It's the same when you go from the canonical ensemble to the grand canonical ensemble, only now the particle number will fluctuate around a mean value. But as already said, when the number of particles is large, then these fluctuations are negligible. For these reasons, it is not important from which ensemble you derive your thermodynamic quantities. In the end, you can decide for yourself which variables become dependent variables and which variables become independent variables. Thermodynamic quantities are often derived from the ensemble, the resulting formulas of which can be solved most easily mathematically. Sometimes it's even easier to deduce things from the grand canonical ensemble.

I will provide here the derivations of the chemical potential from the microcanonical and the canonical partition functions. It can be shown that both methods lead to the same result. There is certainly also a derivation from the grand canonical partition function, but unfortunately, I do not know it. I hope that all this will help you.

I. Chemical potential from the microcanonical partition function

The internal energy $U$ of an ideal gas is the sum of the kinetic energies of the atoms: $$U=\sum_{i=1}^{3N}\frac{p_{i}^{2}}{2m}\tag{1}$$ where $p_{i}$ are the impulses of the atoms and $m$ the mass of an atom. If you multiply with $2m$ on both sides and take the square root you obtain: $$\sqrt{2mU}=\sqrt{\sum_{i=1}^{3N}p_{i}^{2}}\tag{2}$$ So $\sqrt{2mU}$ is the radius of a 3N-dimensional "sphere". The number $Φ\left(U,V,N\right)$ of microstates (in the 6N-dimensional phase space) available for an isolated ideal gas with total energies between $0$ and $U$ is: $$Φ\left(U,V,N\right)=\frac{1}{N!}V^{N}\cdot\frac{\text{volume of 3N-dimensional sphere with radius }\sqrt{2mU}}{\text{volume of a phase space cell}}=\frac{1}{N!}\frac{1}{h^{3N}}V^{N}\frac{\pi^{\frac{3N}{2}}}{Γ\left(\frac{3N}{2}+1\right)}\left(\sqrt{2mU}\right)^{3N}=\text{if N is even}=\frac{1}{N!}V^{N}\frac{1}{h^{3N}}\frac{\pi^{\frac{3N}{2}}}{\left(\frac{3N}{2}\right)!}\left(\sqrt{2mU}\right)^{3N}\tag{3}$$ The factor $\frac{1}{N!}$ arises from the fact that the atoms are indistinguishable, i. e. you do not have a new microstate if you interchange the position of two atoms. The number of microstates $Ω\left(U,V,N\right)$ with energy between $U$ and $U + δU$, which is the microcanonical partition function can be obtained by multiplying the derivative of $Φ\left(U,V,N\right)$ with $δU$.
$$Ω\left(U,V,N\right)=\frac{1}{N!}V^{N}\frac{1}{h^{3N}}\frac{\pi^{\frac{3N}{2}}}{\left(\frac{3N}{2}\right)!}\left(2m\right)^{\frac{3N}{2}}\frac{3N}{2}U^{\frac{3N}{2}-1}δU\tag{4}$$ The entropy is: $$S\left(U,V,N\right)=k_{B}\ln\left(Ω\left(U,V,N\right)\right)=k_{B}\ln\left(\frac{3\cdot N\cdot V^{N}\cdot\left(2\pi mU\right)^{\frac{3N}{2}}}{2\cdot U\cdot N!\cdot h^{3N}\cdot\left(\frac{3N}{2}\right)!}δU\right)\tag{5}$$ From the definition of the internal energy $U$: $$dU=TdS-pdV+μdN\tag{6}$$ you can obtain the dependence of $TdS$ on the variables $U,V,N$: $$TdS=dU+pdV-μdN\tag{7}$$ and after dividing on both sides by the temperature $T$: $$dS=\frac{1}{T}dU+\frac{p}{T}dV-\frac{μ}{T}dN\tag{8}$$ Note that the temperature $T$, the pressure $p$ and the chemical potential $μ$ are here functions of $U,V$ and $N$: $$dS=\frac{1}{T\left(U,V,N\right)}dU+\frac{p\left(U,V,N\right)}{T\left(U,V,N\right)}dV-\frac{μ\left(U,V,N\right)}{T\left(U,V,N\right)}dN\tag{9}$$ From the last equation you can identify the inverse of the temperature and the quotient of the chemical potential by the temperature with the following partial derivatives: $$\frac{1}{T}=\left(\frac{∂S}{∂U}\right)_{V,N}\tag{10}$$ $$\frac{μ}{T}=-\left(\frac{∂S}{∂N}\right)_{U,V}\tag{11}$$ Therefore, you can compute the chemical potential by using: $$μ=-\frac{\left(\frac{∂S}{∂N}\right)_{U,V}}{\left(\frac{∂S}{∂U}\right)_{V,N}}\tag{12}$$ By using Stirling’s formula $\ln\left(N!\right)\approx N\ln\left(N\right)-N+\frac{1}{2}\ln\left(2\pi N\right)$, which is a very good approximation for large values of $N$, you obtain for the partial derivative of the entropy with respect to $N$: $$\left(\frac{∂S}{∂N}\right)_{U,V}=k_{B}\frac{∂}{∂N}\ln\left(\frac{3\cdot N\cdot V^{N}\cdot\left(2\pi mU\right)^{\frac{3N}{2}}}{2\cdot U\cdot N!\cdot h^{3N}\cdot\left(\frac{3N}{2}\right)!}δU\right)=\text{expand the logarithm and discard the terms that do not depend on N}=$$ $$=-k_{B}\frac{∂\ln\left(\left(N-1\right)!\right)}{∂N}-k_{B}\frac{∂\ln\left(\left(\frac{3N}{2}\right)!\right)}{∂N}+k_{B}\frac{∂}{∂N}N\ln\left(V\left(\frac{\sqrt{2\pi mU}}{h}\right)^{3}\right)=$$ $$=\text{use here Stirling’s formula}\approx$$ $$\approx -k_{B}\left(\ln\left(N-1\right)+\frac{1}{2\left(N-1\right)}\right)-k_{B}\left(\frac{3}{2}\ln\left(\frac{3N}{2}\right)+\frac{1}{3N}\right)+k_{B}\ln\left(V\left(\frac{\sqrt{2\pi mU}}{h}\right)^{3}\right)=$$ $$=-k_{B}\ln\left(N-1\right)-k_{B}\ln\left(\left(\frac{3N}{2}\right)^{\frac{3}{2}}\right)+k_{B}\ln\left(V\left(\frac{\sqrt{2\pi mU}}{h}\right)^{3}\right)-\frac{k_{B}}{2\left(N-1\right)}-\frac{k_{B}}{3N}\tag{13}$$ and for the partial derivative of the entropy with respect to $U$: $$\left(\frac{∂S}{∂U}\right)_{V,N}=k_{B}\frac{∂}{∂U}\ln\left(\frac{3\cdot N\cdot V^{N}\cdot\left(2\pi mU\right)^{\frac{3N}{2}}}{2\cdot U\cdot N!\cdot h^{3N}\cdot\left(\frac{3N}{2}\right)!}δU\right)=$$ $$=\text{expand the logarithm and discard the terms that do not depend on U}=$$ $$=k_{B}\frac{∂\ln\left(U^{\left(\frac{3N}{2}-1\right)}\right)}{∂U}=k_{B}\left(\frac{3N}{2}-1\right)\frac{1}{U}\tag{14}$$ By using these results you obtain for the chemical potential $μ(U,V,N)$: $$μ(U,V,N) = \frac{\ln\left(\frac{N\left(1-\frac{1}{N}\right)}{V}\left(\frac{3N}{2}\right)^{\frac{3}{2}}\left(\frac{h}{\sqrt{2\pi mU}}\right)^{3}\right)+\frac{1}{2\left(N-1\right)}+\frac{1}{3N}}{\frac{3N}{2}\left(1-\frac{2}{3N}\right)\frac{1}{U}}\tag{15}$$ In order to obtain the chemical potential of an ideal gas as function of $T,V$ and $N$ you must replace $U$ in the previous formula with $\frac{3}{2}Nk_{B}T$. In the end you have for the chemical potential $μ(T,V,N)$: $$μ(T,V,N) = \frac{k_{B}T\ln\left(\frac{N\left(1-\frac{1}{N}\right)}{V}\left(\frac{h}{\sqrt{2\pi mk_{B}T}}\right)^{3}\right)+\frac{k_{B}T}{2\left(N-1\right)}+\frac{k_{B}T}{3N}}{\left(1-\frac{2}{3N}\right)}\tag{16}$$ For large values of $N$ you can in a very good approximation discard the terms with $N$ in the denominator, leading in the end to: $$μ(T,V,N) = k_{B}T\ln\left(\frac{N}{V}\left(\frac{h}{\sqrt{2\pi mk_{B}T}}\right)^{3}\right)\tag{17}$$

II. Chemical potential from the canonical partition function

The derivation from the canonical partition function is much easier. For the canonical partition function $Z_{C}\left(T,V,N\right)$ of an ideal gas you have: $$Z_{C}\left(T,V,N\right)=\frac{1}{N!}\frac{1}{h^{3N}}\int_{-\infty}^{+\infty}\int_{-\infty}^{+\infty}...\int_{-\infty}^{+\infty}\int_{0}^{L}\int_{0}^{L}...\int_{0}^{L}e^{-\frac{\sum_{i=1}^{3N}\frac{p_{i}^{2}}{2m}}{k_{B}T}}\prod_{i=1}^{3N}dq_{i}dp_{i}=\frac{1}{N!}\frac{1}{h^{3N}}V^{N}\left(\sqrt{2\pi mk_{B}T}\right)^{3N}\tag{18}$$ From the definition of the free energy: $$dF=-SdT-pdV+μdN\tag{19}$$ you have for the chemical potential $μ\left(T,V,N\right)$: $$μ=\left(\frac{∂F}{∂N}\right)_{T,V}\tag{20}$$ From the canonical partition function and by using a more simplified version of Stirling’s formula $\ln\left(N!\right)\approx N\ln\left(N\right)-N$ you obtain for the free energy: $$F\left(T,V,N\right)=-k_{B}T\ln\left(Z_{C}\left(T,V,N\right)\right)=$$ $$=-k_{B}T\left(-N\ln\left(N\right)+N+N\ln\left(V\left(\frac{\sqrt{2\pi mk_{B}T}}{h}\right)^{3}\right)\right)=$$ $$=Nk_{B}T\left(\ln\left(\frac{N}{V}\left(\frac{h}{\sqrt{2\pi mk_{B}T}}\right)^{3}\right)-1\right)\tag{21}$$ By using the definition of the thermal wavelength $λ_{th}=\frac{h}{\sqrt{2\pi mk_{B}T}}$ you obtain further: $$F\left(T,V,N\right)=Nk_{B}T\left(\ln\left(nλ_{th}^{3}\right)-1\right)\tag{22}$$ which is exactly the formula provided by you in your question, if instead of $\frac{N}{V}$ you write $n$ for the particle density. In conclusion, the chemical potential of an ideal gas is: $$μ=\left(\frac{∂F}{∂N}\right)_{T,V}=$$ $$=\frac{∂}{∂N}\left(Nk_{B}T\left(\ln\left(\frac{N}{V}\left(\frac{h}{\sqrt{2\pi mk_{B}T}}\right)^{3}\right)-1\right)\right)=$$ $$=k_{B}T\ln\left(\frac{N}{V}\left(\frac{h}{\sqrt{2\pi mk_{B}T}}\right)^{3}\right)-k_{B}T+Nk_{B}T\frac{1}{N}=$$ $$=k_{B}T\ln\left(\frac{N}{V}\left(\frac{h}{\sqrt{2\pi mk_{B}T}}\right)^{3}\right)=$$ $$=k_{B}T\ln\left(\frac{N}{V}λ_{th}^{3}\right)\tag{23}$$


I think that the formula provided by your textbook for the free energy is correct. As shown before, both the microcanonical partition function and the canonical partition function led to the same result for the chemical potential: $$μ=k_{B}T\ln\left(\frac{N}{V}\left(\frac{h}{\sqrt{2\pi mk_{B}T}}\right)^{3}\right)\tag{24}$$ Therefore, it is unimportant from which ensemble the chemical potential is derived (when $N$ is large). I think that the author of your textbook chose the derivation from the canonical ensemble only for the sake of simplicity. I hope that my answer was useful for you. Please write in the comments if there is something with which you are dissatisfied, and I will try to edit my answer if possible.

All the best!


While the other answer provided a detailed calculation of how to obtain chemical potential in microcanonical and canonical ensembles, it did not cover the grand canonical ensemble. However, using the grand canonical ensemble to calculate chemical potential is straightforward.

Starting with the grand canonical ensemble, we can obtain the chemical potential for an ideal monoatomic gas with N particles. The Hamiltonian for such a system can be written as $$ H = \sum_i^N \frac{\mathbf{p}_i}{2m} $$ The grand partition function is given by: \begin{align} \Xi(T, V, \mu) &= \sum_{N=0}^{\infty} \int dq dp \frac{1}{N! h^{3N}} e^{-\beta (H - \mu N)} \\ &= \sum_{N=0}^{\infty} Z(T,V,N) e^{\beta \mu N} \\ &= \sum_{N=0}^{\infty} \frac{1}{N!} \left( \frac{V e^{\beta \mu}}{\lambda_{th}^3} \right)^N \\ &= \exp \left( \frac{V e^{\beta \mu}}{\lambda_{th}^3} \right) \end{align} where $Z(T, V, N)$ is the partition function that can be inferred from the other answer: $$ Z(T, V, N) = \frac{1}{N!} \left( \frac{V }{\lambda_{th}^3} \right)^N $$ The grand canonical potential is then given by: $$ J = -k_B T \ln \Xi = - \frac{k_B T V e^{\beta \mu}}{\lambda_{th}^3} $$ Using the differential expression of $J$, $$ dJ = -SdT - PdV - Nd\mu $$ we can determine the average particle number: $$ N = - \frac{\partial J}{\partial \mu} = \frac{V e^{\beta \mu}}{\lambda_{th}^3} $$ Finally, the chemical potential can be obtained as: $$ \mu = k_B T \ln \left( \frac{\lambda_{th}^3 N}{V} \right) $$ As we can see, using the grand canonical ensemble to calculate chemical potential is simpler than the other ensembles. It is worth noting that the thermodynamic quantities obtained from any ensemble are equivalent.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.