Gibbs free energy of mixing (source code)

= Gibbs free energy of mixing
{c}
{title2=$\Delta_{\rm mix}G=nRT\sum_i x_i\ln x_i$}

The Gibbs free energy of mixing compares the final <mixture>'s <Gibbs free energy> with that of its initially separate components at the same <temperature> and <pressure>. For an <ideal solution>, subtract the pure-component reference from $G=\sum_i n_i\mu_i$:
$$
\Delta_{\rm mix}G=\sum_i n_i(\mu_i-\mu_i^*)
=RT\sum_i n_i\ln x_i
=nRT\sum_i x_i\ln x_i.
$$
For one <mole> of the chosen A/B <ideal solution> at $300\,\mathrm K$ and $x_A=0.4$,
$$
\Delta_{\rm mix}G\approx-1.67872\,\mathrm{kJ}.
$$
The individual <chemical potential> changes are $RT\ln0.4\approx-2.28554\,\mathrm{kJ\,mol^{-1}}$ for A and $RT\ln0.6\approx-1.27417\,\mathrm{kJ\,mol^{-1}}$ for B. Weighting these by $0.4\,\mathrm{mol}$ and $0.6\,\mathrm{mol}$ reproduces the total <Gibbs free energy of mixing>.

\Image[/ideal-solution-entropy-and-gibbs-mixing.png]
{title=Chosen ideal binary model: entropy gain and Gibbs energy decrease}
{description=At the same stipulated <temperature> $300\,\mathrm K$, one <mole> of the invented A/B <ideal solution> has positive <entropy of mixing> and negative <Gibbs free energy of mixing> at every interior composition. The marked $x_A=0.4$ example gives approximately $5.596\,\mathrm{J\,K^{-1}}$ and $-1.679\,\mathrm{kJ}$. Dashed markers show the extrema at equal <mole fractions>; both functions vanish at the pure endpoints. These are calculated mixing quantities at a common initial/final <pressure>, not measured data or a <vapor> composition plot.}

If ideality holds in a neighborhood of the specified <temperature> and <pressure>, differentiation at fixed component amounts gives
$$
\Delta_{\rm mix}S=-\left(\frac{\partial\Delta_{\rm mix}G}{\partial T}\right)_{P,\{n_i\}}
=-R\sum_i n_i\ln x_i,
\qquad
\Delta_{\rm mix}H=\Delta_{\rm mix}G+T\Delta_{\rm mix}S=0,
$$
$$
\Delta_{\rm mix}V=\left(\frac{\partial\Delta_{\rm mix}G}{\partial P}\right)_{T,\{n_i\}}=0.
$$
Thus the ideal mixing <Gibbs free energy> decrease comes entirely from the <entropy> increase; the mixing <enthalpy> and <volume (thermodynamics)> changes vanish. Ideality at a single isolated state alone does not determine <temperature> or <pressure> <derivatives>.<Thermodynamics and Chemistry by Howard DeVoe>[§9.4.3, printed pp. 250–251, equations 9.4.9–9.4.11; §11.1.2, printed pp. 305–307, equations 11.1.8–11.1.12]{ref}

The same formula rules out spontaneous separation into two <liquid> <thermodynamic phases> within this model. Per <mole>, the mixing <Gibbs free energy> $g_{\rm mix}=RT[x\ln x+(1-x)\ln(1-x)]$ has
$$
\frac{d^2g_{\rm mix}}{dx^2}=RT\left(\frac{1}{x}+\frac{1}{1-x}\right)>0.
$$
Adding the pure-component reference contributions changes only a term linear in $x$. The total molar <Gibbs free energy> is therefore a strictly <convex function>: a separated pair of different compositions has a larger composition-weighted <Gibbs free energy> than the uniform sample with the same inventory. Such <phase separation> requires physics beyond this <ideal solution> model.