Finding relation between Gibb's free energy and equilibrium constant for a homogeneous gaseous phase reaction

I was trying to find relation between Gibb's free energy change and equilibrium constant for the following homogeneous gaseous phase reaction at constant temperature
$$\ce{aA +bB }\rightleftharpoons \ce{cC + dD}$$


Let the initial partial pressures are $P\_{1,i}$ and final partial pressures are $P\_{2,i}$ for $i=A,B,C,D$


Now Gibb's free energy change of reaction is given by


$$\Delta\_rG=\Delta G\_{reac} + \Delta G\_{prod}$$


However when I tried to find Gibb's free energy change for $\ce{A}$, I got stuck at first step


Using the relation $dG=VdP-SdT$


$$\Delta G\_{A}=\int\_1^2VdP=\int\_1^2\frac{n\_ART}{P\_A}dP$$


However I cannot perform this integration as $n\_A$ is not constant.


I saw other answers relating to same question but cannot gather much from them


Is my method correct ? If yes, then how can I continue
?




It's sometimes not obvious because of the way the subject may be taught, but $\Delta\_rG$ is what's called a differential form, so it actually describes how the free energy changes as the reaction progresses by an infinitely small change in the amount of reactants and products at a given composition, $T$ and $p$.


The equation presented for the chemical potential $\mu\_i=\mu^o\_i+RT\ln p\_i$ is correct, but the partial pressures are constant when evaluating $\Delta\_rG$. In fact, that equation can be used to derive the relation between the reaction quotient and the Gibbs free energy of reaction:


$$\Delta\_rG = \sum\_i c\_i \mu\_i= \sum\_i c\_i \left( \mu^o\_i+RT\ln p\_i \right)\\ = \sum\_i c\_i \mu^o\_i + RT \sum\_i c\_i\ln p\_i \\ = \Delta\_rG ^o + RT \ln Q $$


where $Q = \sum\_i c\_i\ln p\_i$ is the reaction quotient and the $c\_i$ are the coefficients of the reaction (not to be confused with the amount $n\_i$ of each reactant or product, which remains constant).


This idea can be conceptually difficult at first. Another way to think of it is to imagine a very (=infinitely) large reaction vessel for which you measure the change in free energy upon changing the amount of reactants and products by $c\_i$ (see for instance the textbook by Klotz and Rosenberg). Since the $c\_i$ are finite and the vessel infinite, the composition remains constant. It's a mathematical sleight of hand equivalent to adding an infinitely small amount of substance to a finite system.


 3