# Introduction to Mathematical Physics/Statistical physics/Constraint relaxing

We have defined at section secmaxient external variables, fixed by the exterior, and internal variables free to fluctuate around a fixed mean. Consider a system $L$ being described by $N+N'$ internal variables \index{constraint} $n_{1},\dots ,n_{N},X_{1},\dots ,X_{N'}$. This system has a partition function $Z^{L}$. Consider now a system $F$, such that variables $n_{i}$are this time considered as external variables having value $N_{i}$. This system $F$ has (another) partition function we call $Z^{F}$. System $L$ is obtained from system $F$ by constraint relaxing. Here is theorem that binds internal variables $n_{i}$ of system $L$ to partition function $Z^{F}$ of system $F$ :
Theorem:
Values $n_{i}$ the most probable in system $L$ where $n_{i}$ are free to fluctuate are the values that make zero the differential of partition function $Z^{F}$ where the $n_{i}$'s are fixed.
Proof:
Consider the description where the $n_{i}$'s are free to fluctuate. Probability for event $n_{1}=N_{1}$,$\cdots$,$n_{N}=N_{N}$ occurs is:
$P(n_{1}=N_{1},\cdots ,n_{N}=N_{N})=\sum _{(l)/n_{1}=N_{1},\cdots ,n_{N}=N_{N}}P_{l}^{L}$
So
${\begin{matrix}P(n_{1}=N_{1},\cdots ,n_{N}=N_{N})=\\&&{\frac {1}{Z^{nl}}}e^{-\lambda _{n_{1}}N_{1}-\cdots -\lambda _{n_{N}}N_{N}}\sum _{(l)/n_{1}=N_{1},\cdots ,n_{N}=N_{N}}e^{-\lambda _{X_{1}}{\bar {X}}_{1}-\lambda _{X_{2}}{\bar {X}}_{2}}\end{matrix}}$
Values the most probable make zero differential $dP(n_{1}=N_{1},\cdots ,n_{N}=N_{N})$ (this corresponds to the maximum of a (differentiable) function $P$.). So
$d\log(Z^{F})=\sum _{i}{\frac {\partial \log(Z^{F})}{\partial n_{i}}}dn_{i}=0$
Remark:
This relation is used in chemistry: it is the fundamental relation of chemical reaction. In this case, the $N$ variables $n_{i}$ represent the numbers of particles of the $N$ species $i$ and $N'=2$ with $X_{1}=E$ (the energy of the system) and $X_{2}=V$ (the volume of the system). Chemical reaction equation gives a binding on variables $n_{i}$ that involves stoechiometric coefficients.
Let us write a Gibbs-Duheim type relation \index{Gibbs-Duheim relation}:
$S^{F}/k=\lambda _{X_{1}}{\bar {X}}_{1}+\lambda _{X_{2}}{\bar {X}}_{2}+\ln(Z^{F})$
$S^{L}/k=\lambda _{X_{1}}{\bar {X}}_{1}+\lambda _{X_{2}}{\bar {X}}_{2}+\lambda _{n_{1}}{\bar {n_{1}}}+\cdots +\ln(Z^{L})$
At thermodynamical equilibrium $S^{F}=S^{L}$, so:
$\lambda _{n_{i}}={\frac {\partial \ln(Z^{F})}{\partial n_{i}}}$
Example:
This last equality provides a way to calculate the chemical potential of the system.\index{chemical potential}
$\mu _{i}={\frac {\partial \ln(Z^{F})}{\partial n_{i}}}$
In general one notes $-\ln(Z^{F})=G$.
Example:
Consider the case where variables $n_{i}$ are the numbers of particles of species $i$. If the particles are independent, energy associated to a state describing the $N$ particles (the set of particles of type $i$ being in state $l_{i}$) is the sum of the $N$ energies associated to states $l_{i}$. Thus:
$\ln Z^{F}(\lambda _{X_{1}},\lambda _{X_{2}},n_{1},n_{2})=\ln Z_{1}^{F}(\lambda _{X_{1}},\lambda _{X_{2}},n_{1})+\dots +\ln Z_{N}^{F}(\lambda _{X_{1}},\lambda _{X_{2}},n_{N})$
where $Z_{i}^{F}(\lambda _{X_{1}},\lambda _{X_{2}},n_{i})$ represents the partition function of the system constituted only by particles of type $i$, for which the value of variable $n_{i}$ is fixed. So:
${\frac {\partial \ln Z_{1}^{F}}{\partial n_{1}}}dn_{1}+\dots +{\frac {\partial \ln Z_{N}^{F}}{\partial n_{N}}}dn_{N}=0$
Remark:
Setting $\lambda _{1}=\beta$,$\lambda _{2}=\beta p$ and $\lambda _{n_{1}}=-\beta \mu$ with $G=-k_{B}T\ln Z^{nf}$, we have $G(T,p,n)=E+pV-TS$ and $G'(T,p,\mu )=E+pV-TS-\mu -{n_{1}}$. This is a Gibbs-Duheim relation.
Example:
We propose here to prove the Nernst formula\index{Nernst formula} describing an oxydo-reduction reaction.\index{oxydo-reduction} This type of chemical reaction can be tackled using previous formalism. Let us precise notations in a particular case. Nernst formula demonstration that we present here is different form those classically presented in chemistry books. Electrons undergo a potential energy variation going from solution potential to metal potential. This energy variation can be seen as the work got by the system or as the internal energy variation of the system, depending on the considered system is the set of the electrons or the set of the electrons as well as the solution and the metal. The chosen system is here the second. Consider the free enthalpy function $G(T,p,n_{i},E_{p})$. Variables $n_{i}$ and $E_{p}$ are free to fluctuate. They have values such that $G$ is minimum. let us calculate the differential of $G$:
$dG(T,p,n_{i},E_{p})={\frac {\partial G}{\partial T}}dT+{\frac {\partial G}{\partial p}}dp+\sum _{i}{\frac {\partial G}{\partial n_{i}}}dn_{i}+{\frac {\partial G}{\partial E_{p}}}dE_{p}$
Using definition\footnote{the internal energy $U$ is the sum of the kinetic energy and the potential energy, so as $G$ can be written itself as a sum:
$G=U+pV-TS$
of $G$:
${\frac {\partial G}{\partial E_{p}}}=1$
one gets:
$0=\sum _{i}\mu _{i}dn_{i}+dE_{p}$
If we consider reaction equation:
$Ox+n{\bar {e}}\longrightarrow Red$
$0=\sum _{i}\mu _{i}\nu _{i}d\xi +nq(V_{red}-V_{ox})$
So:
$V_{red}-V_{ox}={\frac {\sum _{i}\nu _{i}\mu _{i}}{nF}}$
$dG$ can only decrease. Spontaneous movement of electrons is done in the sense that implies $dE_{p}<0$. As $dE_{p}^{ext}=-dE_{p}^{int}$ we chose as definition of electrical potential:
$V^{ext}=-V^{int}$
Nernst formula deals with the electrical potential seen by the exterior.