# Exchange of Particles Between Subsystems

Many thanks to Bart Andrews for this contribution!

### Question

Consider two systems $$I$$ and $$II$$ in contact with a common heat bath with temperature T and suppose that a mechanism exists which allows both systems to exchange particles. The probability that the composed system $$I + II$$ is in a state for which system $$I$$ has an energy between $$E_I$$ and $$E_I+dE_I$$ and a particle number $$N_I$$, while $$II$$ has an energy between $$E_{II}$$ and $$E_{II} + dE_{II}$$ with a particle number $$N_{II}$$ is given by

\begin{equation}
p(E_I, N_I; E_{II}, N_{II})dE_I dE_{II} = \frac{\Omega_I(E_I,N_I)\Omega_{II}(E_{II},N_{II}) e^{-\beta(E_I+E_{II})}}{\sum_{N_I=0}^{N} Z_I(T,N_I)Z_{II}(T,N-N_I)}\,\,\,\,\,\,dE_IdE_{II}
\end{equation}

Here, $$Z_I(T, N_I)$$ and $$Z_{II}(T, N_{II})$$ are the partition sums of the single systems, $$\Omega_I(E_I, N_I)$$ and $$\Omega_{II}(E_{II},N_{II})$$ are the degeneracies of the states in the single systems and $$N = N_I + N_{II}$$ is the total number of particles.

Show that for the most probable distribution $$\{N_I, N_{II}\}$$ of particles, the sum of the free energies $$F_I + F_{II}$$ is minimal and that the chemical potentials of both systems are equal.

### Solution

This question considers the most probable configuration of free particles and then asks for two things:

• Show that the total free energy of the system is minimal
• Show that the chemical potentials are equal

We shall start by showing that the chemical potentials are equal. Let the most probable value of $$N_I$$ be called $$\tilde{N_I}$$. We know that since the total number of particles stays constant, the particle number of the second system can be expressed as a function of the particle number of the first system.

$N_{II} = N - N_I$

Therefore, if we find the most probable distribution for $$N_I$$ particles, then this will consequently be the most probable distribution of $$\{N_I,N_{II}\}$$. So, we can proceed by finding the most probable distribution as follows:

Maximise the probability with respect to $$N_I$$.

${\partial p \over \partial N_I} \stackrel{!}{=} 0$

Use the product rule, set equal to zero and simplify.

$\bigg({\Omega'_I}(E_I,N_I){\Omega_{II}}(E_{II},N-N_I)-{\Omega_I}(E_I,N_I){\Omega'_{II}}(E_{II},N-N_I)\bigg) \bigg|_{\tilde{N_I}} = 0$

$\frac{\Omega'_I(E_I,\tilde{N_I})}{\Omega_I(E_I,\tilde{N_I})} = \frac{\Omega'_{II}(E_{II},N-\tilde{N_I})}{\Omega_{II}(E_{II},N-\tilde{N_I})}$

Multiply both sides by the Boltzmann constant.

$k_B\frac{\Omega'_I(E_I,\tilde{N_I})}{\Omega_I(E_I,\tilde{N_I})} = k_B\frac{\Omega'_{II}(E_{II},N-\tilde{N_I})}{\Omega_{II}(E_{II},N-\tilde{N_I})}$

Take the Boltzmann constant inside the derivatives.

${\partial (k_B \ln \Omega_I) \over \partial N_I} \bigg|_{\tilde{N_I}} = {\partial (k_B \ln \Omega_{II}) \over \partial N_{II}}\bigg|_{N-\tilde{N_I}}$

Use the Boltzmann expression for the entropy.

${\partial S_I \over \partial N_I} \bigg|_{\tilde{N_I}} = {\partial S_{II} \over \partial N_{II}}\bigg|_{N-\tilde{N_I}}$

Use the thermodynamic relation for the chemical potential.

$\frac{\mu_I}{T} = \frac{\mu_{II}}{T}$

Since $$T$$ is constant for both systems due to the heat bath, it cancels.

$\mu_I = \mu_{II} \; \blacksquare$

Now we can proceed to the second part and show that the total free energy in this situation is minimal. From the second law of thermodynamics, we know that:
$$\newcommand{\dslash}{\delta}$$

$dS\ge \frac{\dslash Q}{T}$

$T dS \ge \dslash Q$

$0 \ge \dslash Q - T dS$

Additionally, from the first law of thermodynamics we know that:

$dU = \dslash Q - P dV$

Now taking the Legendre transform of the internal energy to Helmholtz free energy, $$F\equiv U – TS$$, we obtain:

\begin{eqnarray}
dF & = & dU-TdS-SdT \nonumber \\
& = & \dslash Q-PdV-TdS-SdT \nonumber \\
& = & (\dslash Q-TdS) -PdV-SdT \nonumber \\
& = & \dslash Q-TdS \nonumber
\end{eqnarray}

Here, we have used the fact that the total volume and temperature of the two systems is constant and so $$dV=dT=0$$. Combining this result with the second law of thermodynamics leads to the inequality:

$dF \le 0$

This implies that for a process at constant temperature and volume the Helmholtz free energy seeks a minimum and this minimum is achevied when $$dF=0$$. So now we can look at our particular problem and calculate the total differential $$dF$$.

$dF = \left( \partial F \over \partial T \right) dT + \left( \partial F \over \partial V \right) {dV} + \left( \partial F \over \partial N_I \right) dN_I + \left( \partial F \over \partial N_{II} \right) dN_{II}$

It is assumed that all other neccesary variables are kept constant when these partial derivatives are taken. Now we know that the temperature is constant because of mutual contact with a heat bath and so $$dT=0$$. We also know that the total volume is kept constant because these systems are confined and so $$dV=0$$. From the relation…

$dN_I = -dN_{II}$

…coupled with the thermodynamic definitions for chemical potential…

$\mu_I = \left( \partial F \over \partial N_I \right) \; , \; \mu_{II} = \left( \partial F \over \partial N_{II} \right)$

…it is clear that since the chemical potentials are equal, the last two terms cancel. This means that the total free energy is, in fact, at a minimum as required.

$dF=0 \; \blacksquare$