# Statistical Thermodynamics and Rate Theories/Chemical Equilibrium
## Chemical Equilibrium from Statistical Thermodynamics

Consider the general gas phase chemical reaction represented by
    ${\ce {\nu_{A}A + \nu_{B}B <=>\nu_{C}C + \nu_{D}D}}$
where A, B, C and D are the reactants and products of the reaction, and $\nu _{A}$ is the stoichiometric coefficient of chemical A, $\nu _{B}$ is the stoichiometric coefficient of chemical B, and so on. Each of the gases involved in the reaction will eventually reach an equilibrium concentration when the forward and reverse reaction rates become equal. The distribution of reactants to products at the quilibrium point is represented by the equilibrium constant ($K_{c}$):
    $K_{c}={\frac {[C]^{\nu _{C}}[D]^{\nu _{D}}}{[A]^{\nu _{A}}[B]^{\nu _{B}}}}={\frac {\rho _{C}^{\nu _{C}}\rho _{D}^{\nu _{D}}}{\rho _{A}^{\nu _{A}}\rho _{B}^{\nu _{B}}}}$
If the system is not at equilibrium, a shift in the number of reactants and products will occur to lower the overall energy of the system. The difference in the energy of the system at this non-equilibrated point and the energy of the system at equilibrium for any particular species is termed chemical potential. When both temperature and volume are constant for both points aforementioned, the chemical potential $\mu$ of species i is expressed by the equation
    $\mu _{i}={\left({\frac {\partial A}{\partial N_{i}}}\right)}_{T,V,N_{j\neq 1}}$
where A is the Helmholtz energy, and $N_{i}$ is the number of molecules of species i. The Helmholtz energy can be determined as a function of the total partition function, Q:
    $A=-k_{B}T\ln Q$
where $k_{B}$ is the Boltzmann constant and T is the temperature of the system. The total partition function is given by
    $Q={\frac {q_{i}(V,T)^{Ni}}{N_{i}!}}$
where $q_{i}$ is the molecular partition function of chemical species i. Substituting the molecular partition funCtion into the equation for helholtz energy yields:
    $A=-k_{B}T\ln \left({\frac {q_{i}(V,T)^{Ni}}{N_{i}!}}\right)$
and then further substituting this equation into the definition of chemical potential yields:
    $\mu _{i}={\left({\frac {\partial -k_{B}T\ln \left({\frac {q_{i}(V,T)^{Ni}}{N_{i}!}}\right)}{\partial N_{i}}}\right)}_{T,V,N_{j\neq 1}}$
rearranging this equation the following derivative can be set-up:
    $\mu _{i}=-k_{B}T{\left({\left({\frac {\partial {Ni}\ln \left({q_{i}(V,T)}\right)}{\partial N_{i}}}\right)}-{\left({\frac {\partial \ln \left({N_{i}!}\right)}{\partial N_{i}}}\right)}\right)}_{T,V,N_{j\neq 1}}$
From this point Sterling's approximation
    $\ln {N!}=N\ln N-N$
can be substituted into the derivative to yield:
    $\mu _{i}=-k_{B}T{\left({\left({\frac {\partial {Ni}\ln \left({q_{i}(V,T)}\right)}{\partial N_{i}}}\right)}-{\left({\frac {\partial \left({N_{i}\ln N_{i}-N_{i}}\right)}{\partial N_{i}}}\right)}\right)}_{T,V,N_{j\neq 1}}$
From here the derivative can be rearranged and solved:
    $\mu _{i}=-k_{B}T{\left({\ln \left({q_{i}(V,T)}\right)}{\frac {\partial {N_{i}}}{\partial N_{i}}}+{{N_{i}}{\frac {\partial \ln \left({q_{i}(V,T)}\right)}{\partial N_{i}}}}-{\ln \left({N_{i}}\right){\frac {\partial {N_{i}}}{\partial N_{i}}}}-{{N_{i}}{\frac {\partial \ln \left({N_{i}}\right)}{\partial N_{i}}}}+{\frac {\partial {N_{i}}}{\partial N_{i}}}\right)}_{T,V,N_{j\neq 1}}$
    $\mu _{i}=-k_{B}T{\left({\ln {\left({q_{i}(V,T)}\right)}}+{0}-{\ln \left({N_{i}}\right)}-{N_{i}{\frac {1}{N_{i}}}}+{1}\right)}$
    $\mu _{i}=-k_{B}T{\left({\ln {\left({q_{i}(V,T)}\right)}}-{\ln \left({N_{i}}\right)}\right)}$
    $\mu _{i}=-k_{B}T\ln \left({\frac {q_{i}(V,T)}{N_{i}}}\right)$
A variable, $\lambda$, is then defined such that $dN_{j}=\nu _{j}d\lambda$, where j = A, B, C or D and $\nu _{j}$ is taken to be positive for products and negative for reactants. A change in $\lambda$ therefore corresponds to a change in the concentrations of the reactants and products. Thus, at equilibrium,
    $\left({\frac {\partial A}{\partial \lambda }}\right)_{T,V}=0$
From Classical thermodynamics, the total differential of A is:
    $dA=-SdT-pdV+\sum _{j}\mu _{j}dN_{j}$
For a reaction at a fixed volume and temperature (such as in the canonical ensemble), $dT$ and $dV$ equal 0. Therefore,
    $dA=\sum _{j}\mu _{j}dN_{j}$
    $dA=\sum _{j}\mu _{j}\nu _{j}d\lambda$
    $dA=d\lambda \sum _{j}\mu _{j}\nu _{j}$
    $\sum _{j}\mu _{j}\nu _{j}=0$
Substituting the expanded form of chemical potential:
    $-k_{B}T\sum _{j}\ln \left({\frac {q_{i}}{N_{i}}}\right)\nu _{j}=0$
    $\sum _{j}\ln \left({\frac {q_{i}}{N_{i}}}\right)\nu _{j}=0$
    $\sum _{j}\nu _{j}[\ln(q_{j})-\ln(N_{j})]=0$
For the reaction ${\ce {\nu_{a}A + \nu_{b}B <=>\nu_{c}C + \nu_{d}D}}$:
    $[\nu _{C}\ln(q_{C})-\nu _{C}\ln(N_{C})]+[\nu _{D}\ln(q_{D})-\nu _{D}\ln(N_{D})]-[\nu _{A}\ln(q_{A})-\nu _{A}\ln(N_{A})]-[\nu _{B}\ln(q_{B})-\nu _{B}\ln(N_{B})]=0$
This equation simplifies to
    ${\frac {(q_{C})^{\nu _{C}}(q_{D})^{\nu _{D}}}{(q_{A})^{\nu _{A}}(q_{B})^{\nu _{B}}}}={\frac {(N_{C})^{\nu _{C}}(N_{D})^{\nu _{D}}}{(N_{A})^{\nu _{A}}(N_{B})^{\nu _{B}}}}$
By dividing all terms by volume, and noting the relationship ${\frac {N_{A}}{V}}={\frac {\#molecules}{volume}}=\rho _{A}=[A]$ where $\rho$ is referred to a number density, the following equation is obtained:
    $K_{c}={\frac {\rho _{C}^{\nu _{C}}\rho _{D}^{\nu _{D}}}{\rho _{A}^{\nu _{A}}\rho _{B}^{\nu _{B}}}}={\frac {(q_{C}/V)^{\nu _{C}}(q_{D}/V)^{\nu _{D}}}{(q_{A}/V)^{\nu _{A}}(q_{B}/V)^{\nu _{B}}}}$

## Partition Functions

The molecular partition function, $q_{i}$ is defined as the product of the translational, rotational, vibration and electronic partition functions:
    $q=q_{trans}q_{rot}q_{vib}q_{elec}$
These components of the molecular partition function may be defined as follows:
    $q_{trans}=\left({\frac {2\pi mk_{B}T}{h^{2}}}\right)^{3/2}V$
where m is the mass of a single particle and h is Planck's constant, and T is temperature.
    $q_{rot}={\frac {2k_{B}T\mu {r_{e}}^{2}}{\sigma \hbar ^{2}}}$
where $\mu$ is the reduced mass of the molecule, $r_{e}$ is the bond length between the atoms in the molecule, and $\hbar$ is the reduced Planck's constant.
    $q_{vib}={\frac {1}{1-\exp \left({\frac {-h\nu }{k_{B}T}}\right)}}$
where $\nu$ is the vibrational frequency of the molecule.
    $q_{elec}=g_{1}e^{D_{0}/k_{b}T}$
where $g_{1}$ is the degeneracy of the ground state, and $D_{0}$ is the bond energy of the molecule.
Thus, the equilibrium constant of a chemical reaction can be expressed in terms of the molecular partition functions and the difference in atomization energies of the products and reactants $\Delta D_{0}$.
    $K_{eq}={\frac {\prod _{i}^{products}\left(q_{i}/V\right)^{v_{i}}}{\prod _{i}^{reactants}\left(q_{i}/V\right)^{v_{i}}}}\exp \left({\frac {\Delta D_{0}}{k_{B}T}}\right)$
    $\Delta D_{0}=\sum _{products}^{i}D_{0,i}-\sum _{reactants}^{i}D_{0,i}$

## Example

Calculate the equilibrium constant for the reaction of ${\ce {H2 (g)}}$ and ${\ce {Cl2 (g)}}$ at 650 K.
${\ce {H2 (g) + Cl2 (g) <=> 2HCl (g)}}$
    Equilibrium Constant Equation (From Molecular Partition Functions) $K_{c}(T)={\left({\frac {{\Bigl{\frac {q_{\text{HCl}}}{V}}{\Bigr )}^{2}}{{\Bigl{\frac {q_{{\text{H}}_{2}}}{V}}{\Bigr )}{\Bigl{\frac {q_{{\text{Cl}}_{2}}}{V}}{\Bigr )}}}\right)}$
$K_{c}(T)={\left({\frac {{\Bigl{\frac {q_{trans{\text{HCl}}}q_{rot{\text{HCl}}}q_{vib{\text{HCl}}}q_{elec{\text{HCl}}}}{V}}{\Bigr )}^{2}}{{\Bigl{\frac {q_{trans{\text{H}}_{2}}q_{rot{\text{H}}_{2}}q_{vib{\text{H}}_{2}}q_{elec{\text{H}}_{2}}}{V}}{\Bigr )}({\frac {q_{trans{\text{Cl}}_{2}}q_{rot{\text{Cl}}_{2}}q_{vib{\text{Cl}}_{2}}q_{elec{\text{Cl}}_{2}}}{V}}{\Bigr )}}}\right)}$
A simple problem solving strategy for finding equilibrium constants via statistical mechanics is to separate the equation into the molecular partition functions of each of the reactant and product species, solve for each one, and recombine them to arrive at a final answer.
$\left({\frac {q_{\text{HCl}}}{V}}\right)=\left({\frac {2\pi mk_{B}T}{h^{2}}}\right)^{3/2}\times {\frac {2k_{B}T\mu r_{e}^{2}}{\sigma \hbar ^{2}}}\times {\frac {1}{1-\exp {{\Bigl{\frac {-h\nu }{k_{B}T}}{\Bigr )}}}}\times g_{1}\exp(D_{0}/K_{B}T)$
In order to simplify the calculations of molecular partition functions, the characteristic temperature of rotation ($\Theta _{r}$) and vibration ($\Theta _{\nu }$) are used. These values are constants that incorporate the physical constants found in the rotational and vibrational partition functions of the molecules. Tabulated values of $\Theta _{r}$ and $\Theta _{\nu }$ for select molecules can be found here.
| Species | $\Theta _{\nu }$ (K) | $\Theta _{r}$ (K) | $D_{0}$ (kJ mol$^{-1}$) |
| ${\ce {Cl2 (g)}}$ | 6125 | 0.351 | 239.0 |
| ${\ce {H2 (g)}}$ | 808 | 87.6 | 431.9 |
| ${\ce {HCl (g)}}$ | 4303 | 15.2 | 427.7 |
    $\left({\frac {q_{\text{HCl}}}{V}}\right)=\left({\frac {2\pi mk_{B}T}{h^{2}}}\right)^{3/2}\times {\frac {T}{\sigma \Theta _{r}}}\times {\frac {1}{1-\exp {{\Bigl{\frac {-\Theta _{\nu }}{T}}{\Bigr )}}}}\times g_{1}\exp(D_{0}/RT)$ $\left({\frac {q_{\text{HCl}}}{V}}\right)=\left({\frac {2\pi (2.1957\times 10^{-24}{\text{kg}})(1.38065\times 10^{-23}{\text{JK}}^{-1})(650K)}{(6.62607\times 10^{-34}{\text{Js}})^{2}}}\right)^{3/2}\times {\frac {650{\text{K}}}{(2)(15.2{\text{K}})}}\times {\frac {1}{1-\exp {{\Bigl{\frac {-4303{\text{K}}}{650{\text{K}}}}{\Bigr )}}}}\times (1)\exp((427700{\text{Jmol}}^{-1})/(8.3145{\text{JKmol}}^{-1})(650{\text{K}}))$ $\left({\frac {q_{\text{HCl}}}{V}}\right)=(1.4975\times 10^{35}{\text{m}}^{-3})(21.4)(1.0013)(2.3419\times 10^{34})$
    $\left({\frac {q_{{\text{H}}_{2}}}{V}}\right)=\left({\frac {2\pi mk_{B}T}{h^{2}}}\right)^{3/2}\times {\frac {T}{\sigma \Theta _{r}}}\times {\frac {1}{1-\exp {{\Bigl{\frac {-\Theta _{\nu }}{T}}{\Bigr )}}}}\times g_{1}\exp(D_{0}/RT)$ $\left({\frac {q_{{\text{H}}_{2}}}{V}}\right)=\left({\frac {2\pi (1.2140\times 10^{-25}{\text{kg}})(1.38065\times 10^{-23}{\text{JK}}^{-1})(650K)}{(6.62607\times 10^{-34}{\text{Js}})^{2}}}\right)^{3/2}\times {\frac {650{\text{K}}}{(2)(87.6{\text{K}})}}\times {\frac {1}{1-\exp {{\Bigl{\frac {-808{\text{K}}}{650{\text{K}}}}{\Bigr )}}}}\times (1)\exp((431900{\text{Jmol}}^{-1})/(8.3145{\text{JKmol}}^{-1})(650{\text{K}}))$ $\left({\frac {q_{{\text{H}}_{2}}}{V}}\right)=(1.9468\times 10^{33}{\text{m}}^{-3})(3.71)(1.41)(5.0942\times 10^{34})$
    $\left({\frac {q_{{\text{Cl}}_{2}}}{V}}\right)=\left({\frac {2\pi mk_{B}T}{h^{2}}}\right)^{3/2}\times {\frac {T}{\sigma \Theta _{r}}}\times {\frac {1}{1-\exp {{\Bigl{\frac {-\Theta _{\nu }}{T}}{\Bigr )}}}}\times g_{1}\exp(D_{0}/RT)$ $\left({\frac {q_{{\text{Cl}}_{2}}}{V}}\right)=\left({\frac {2\pi (4.2700\times 10^{-24}{\text{kg}})(1.38065\times 10^{-23}{\text{JK}}^{-1})(650K)}{(6.62607\times 10^{-34}{\text{Js}})^{2}}}\right)^{3/2}\times {\frac {650{\text{K}}}{(2)(0.351{\text{K}})}}\times {\frac {1}{1-\exp {{\Bigl{\frac {-6125{\text{K}}}{650{\text{K}}}}{\Bigr )}}}}\times (1)\exp((239000{\text{Jmol}}^{-1})/(8.3145{\text{JKmol}}^{-1})(650{\text{K}}))$ $\left({\frac {q_{{\text{Cl}}_{2}}}{V}}\right)=(5.4839\times 10^{35}{\text{m}}^{-3})(925.9)(1.00)(1.606\times 10^{19})$
Combining the terms from each species, the following expression is obtained:
    $K_{c}={\frac {(1.9468\times 10^{33}{\text{m}}^{-3})^{2}}{(1.9468\times 10^{33}{\text{m}}^{-3})(5.4839\times 10^{35}{\text{m}}^{-3})}}\times {\frac {(21.4)^{2}}{(3.71)(925.9)}}\times {\frac {(1.0013)^{2}}{(1.41)(1.00)}}\times {\frac {(2.3419\times 10^{34})^{2}}{(1.606\times 10^{19})(5.0942\times 10^{34})}}$ $K_{c}=(0.003550)(0.1333)(0.711)(6.7037\times 10^{14})$ $K_{c}=(2.26\times 10^{11})$
At 650 K, the reaction between ${\ce {H2 (g)}}$ and ${\ce {Cl2 (g)}}$ proceeds spontaneously towards the products. From a statistical mechanics point of view, the product ${\ce {HCl (g)}}$ molecule has more states accessible to it than the reactant species. The spontaneity of this reaction is largely due to the electronic partition function: two very strong H—Cl bonds are formed at the expense of a very strong H—H bond and a relatively weak Cl—Cl bond.