# Gibbs–Duhem equation

In thermodynamics, the Gibbs–Duhem equation describes the relationship between changes in chemical potential for components in a thermodynamic system:
$\sum _{i=1}^{I}N_{i}\mathrm {d} \mu _{i}=-S\mathrm {d} T+V\mathrm {d} p$
where $N_{i}$ is the number of moles of component $i,\mathrm {d} \mu _{i}$ the infinitesimal increase in chemical potential for this component, $S$ the entropy, $T$ the absolute temperature, $V$ volume and $p$ the pressure. $I$ is the number of different components in the system. This equation shows that in thermodynamics intensive properties are not independent but related, making it a mathematical statement of the state postulate. When pressure and temperature are variable, only $I-1$ of $I$ components have independent values for chemical potential and Gibbs' phase rule follows.
The Gibbs−Duhem equation applies to homogeneous thermodynamic systems. It does not apply to inhomogeneous systems such as small thermodynamic systems, systems subject to long-range forces like electricity and gravity, or to fluids in porous media.
The equation is named after Josiah Willard Gibbs and Pierre Duhem.

## Derivation

The Gibbs–Duhem equation follows from assuming the system can be scaled in amount perfectly. Gibbs derived the relationship based on the thought experiment of varying the amount of substance starting from zero, keeping its nature and state the same.
Mathematically, this means the internal energy $U$ scales with its extensive variables as follows: $U(\lambda S,\lambda V,\lambda N_{1},\lambda N_{2},\ldots )=\lambda U(S,V,N_{1},N_{2},\ldots )$ where $S,V,N_{1},N_{2},\ldots$ are all of the extensive variables of system: entropy, volume, and particle numbers. The internal energy is thus a first-order homogenous function. Applying Euler's homogeneous function theorem, one finds the following relation:
$U=TS-pV+\sum _{i=1}^{I}\mu _{i}N_{i}$
Taking the total differential, one finds
$\mathrm {d} U=T\mathrm {d} S+S\mathrm {d} T-p\mathrm {d} V-V\mathrm {d} p+\sum _{i=1}^{I}\mu _{i}\mathrm {d} N_{i}+\sum _{i=1}^{I}N_{i}\mathrm {d} \mu _{i}$
From both sides one can subtract the fundamental thermodynamic relation, $\mathrm {d} U=T\mathrm {d} S-p\mathrm {d} V+\sum _{i=1}^{I}\mu _{i}\mathrm {d} N_{i}$
yielding the Gibbs–Duhem equation
$0=S\mathrm {d} T-V\mathrm {d} p+\sum _{i=1}^{I}N_{i}\mathrm {d} \mu _{i}.$

## Applications

By normalizing the above equation by the extent of a system, such as the total number of moles, the Gibbs–Duhem equation provides a relationship between the intensive variables of the system. For a simple system with $I$ different components, there will be $I+1$ independent parameters or "degrees of freedom". For example, if we know a gas cylinder filled with pure nitrogen is at room temperature (298 K) and 25 MPa, we can determine the fluid density (258 kg/m$^3$), enthalpy (272 kJ/kg), entropy (5.07 kJ/kg⋅K) or any other intensive thermodynamic variable. If instead the cylinder contains a nitrogen/oxygen mixture, we require an additional piece of information, usually the ratio of oxygen-to-nitrogen.
If multiple phases of matter are present, the chemical potentials across a phase boundary are equal. Combining expressions for the Gibbs–Duhem equation in each phase and assuming systematic equilibrium (i.e. that the temperature and pressure is constant throughout the system), we recover the Gibbs' phase rule.
One particularly useful expression arises when considering binary solutions. At constant P (isobaric) and T (isothermal) it becomes:
$0=N_{1}\mathrm {d} \mu _{1}+N_{2}\mathrm {d} \mu _{2}$
or, normalizing by total number of moles in the system $N_{1}+N_{2},$ substituting in the definition of activity coefficient $\gamma$ and using the identity $x_{1}+x_{2}=1$:
$0=x_{1}\mathrm {d} \ln(\gamma _{1})+x_{2}\mathrm {d} \ln(\gamma _{2})$
This equation is instrumental in the calculation of thermodynamically consistent and thus more accurate expressions for the vapor pressure of a binary mixture from limited experimental data. One can develop this further to the Duhem–Margules equation which relates to vapor pressures directly.

## Ternary and multicomponent solutions and mixtures

Lawrence Stamper Darken has shown that the Gibbs–Duhem equation can be applied to the determination of chemical potentials of components from a multicomponent system from experimental data regarding the chemical potential ${\bar {G_{2}}}$ of only one component (here component 2) at all compositions. He has deduced the following relation
${\bar {G_{2}}}=G+(1-x_{2})\left({\frac {\partial G}{\partial x_{2}}}\right)_{\frac {x_{1}}{x_{3}}}$
x$_i$, amount (mole) fractions of components.
Making some rearrangements and dividing by (1 – x$_2$)$^2$ gives:
${\frac {G}{(1-x_{2})^{2}}}+{\frac {1}{1-x_{2}}}\left({\frac {\partial G}{\partial x_{2}}}\right)_{\frac {x_{1}}{x_{3}}}={\frac {\bar {G_{2}}}{(1-x_{2})^{2}}}$
or
$\left({\mathfrak {d}}{\frac {G}{\frac {1-x_{2}}{{\mathfrak {d}}x_{2}}}}\right)_{\frac {x_{1}}{x_{3}}}={\frac {\bar {G_{2}}}{(1-x_{2})^{2}}}$
or
$\left({\frac {\frac {\partial G}{1-x_{2}}}{\partial x_{2}}}\right)_{\frac {x_{1}}{x_{3}}}={\frac {\bar {G_{2}}}{(1-x_{2})^{2}}}$ as formatting variant
The derivative with respect to one mole fraction x$_2$ is taken at constant ratios of amounts (and therefore of mole fractions) of the other components of the solution representable in a diagram like ternary plot.
The last equality can be integrated from $x_{2}=1$ to $x_{2}$ gives:
$G-(1-x_{2})\lim _{x_{2}\to 1}{\frac {G}{1-x_{2}}}=(1-x_{2})\int _{1}^{x_{2}}{\frac {\bar {G_{2}}}{(1-x_{2})^{2}}}dx_{2}$
Applying LHopital's rule gives:
$\lim _{x_{2}\to 1}{\frac {G}{1-x_{2}}}=\lim _{x_{2}\to 1}\left({\frac {\partial G}{\partial x_{2}}}\right)_{\frac {x_{1}}{x_{3}}}.$
This becomes further:
$\lim _{x_{2}\to 1}{\frac {G}{1-x_{2}}}=-\lim _{x_{2}\to 1}{\frac {{\bar {G_{2}}}-G}{1-x_{2}}}.$
Express the mole fractions of component 1 and 3 as functions of component 2 mole fraction and binary mole ratios:
$x_{1}={\frac {1-x_{2}}{1+{\frac {x_{3}}{x_{1}}}}}$ $x_{3}={\frac {1-x_{2}}{1+{\frac {x_{1}}{x_{3}}}}}$
and the sum of partial molar quantities
$G=\sum _{i=1}^{3}x_{i}{\bar {G_{i}}},$
gives
$G=x_{1}({\bar {G_{1}}})_{x_{2}=1}+x_{3}({\bar {G_{3}}})_{x_{2}=1}+(1-x_{2})\int _{1}^{x_{2}}{\frac {\bar {G_{2}}}{(1-x_{2})^{2}}}dx_{2}$
$({\bar {G_{1}}})_{x_{2}=1}$ and $({\bar {G_{3}}})_{x_{2}=1}$ are constants which can be determined from the binary systems 1_2 and 2_3. These constants can be obtained from the previous equality by putting the complementary mole fraction x$_3$ = 0 for x$_1$ and vice versa.
Thus
$({\bar {G_{1}}})_{x_{2}=1}=-\left(\int _{1}^{0}{\frac {\bar {G_{2}}}{(1-x_{2})^{2}}}dx_{2}\right)_{x_{3}=0}$
and
$({\bar {G_{3}}})_{x_{2}=1}=-\left(\int _{1}^{0}{\frac {\bar {G_{2}}}{(1-x_{2})^{2}}}dx_{2}\right)_{x_{1}=0}$
The final expression is given by substitution of these constants into the previous equation:
$G=(1-x_{2})\left(\int _{1}^{x_{2}}{\frac {\bar {G_{2}}}{(1-x_{2})^{2}}}dx_{2}\right)_{\frac {x_{1}}{x_{3}}}-x_{1}\left(\int _{1}^{0}{\frac {\bar {G_{2}}}{(1-x_{2})^{2}}}dx_{2}\right)_{x_{3}=0}-x_{3}\left(\int _{1}^{0}{\frac {\bar {G_{2}}}{(1-x_{2})^{2}}}dx_{2}\right)_{x_{1}=0}$