Deriving the equation for reaction spontaneity I'm trying to make sense of the derivation of the equation $$\Delta G = \Delta G^0_r + RT\ln(Q)$$

While searching for a derivation of this equation that made sense to me I came across a publication in the Journal of Chemical Education that suggests it is incorrectly applied if not completely wrong:

"Following this development, the paper investigates the source of the mathematical
and logical errors contained in textbooks ca. 1950 to the present that led to the
fallacious statements still present in most introductory chemistry textbooks and some
more advanced texts that the conditions for spontaneity are ΔG &lt; 0 at constant T and
p and ΔA &lt; 0 at constant T and V, whereas the corresponding conditions for
equilibrium are ΔG = 0 or ΔA = 0. This investigation shows the principal errors to be
(i) incorrect evaluation of definite integrals; (ii) failure to determine whether the
results of such integrations produce criteria for spontaneity and equilibrium that are
necessary conditions, sufficient conditions, both, or neither; and (iii) incorrect logical arguments related to equilibrium. (Spontaneity and Equilibrium III: A History of Misinformation)"

https://pubs.acs.org/doi/full/10.1021/ed500253e

Also, by the same author: https://pubs.acs.org/doi/10.1021/ed400453s

Here is the standard derivation:

For a given chemical reaction, let $v_i$ be the signed stoichiometric coefficient of reagent $i$ (That is, $v_i$ is negative for reactants and positive for products, with $|v_i| = $ the stoichiometric coefficient of reagent $i$).

Define the extent of the reaction, $\xi,$ as: $$\xi := \frac{n_i - n_{i,o}}{v_i} =  \frac{\Delta n_i}{v_i}$$

where $n_i$ and $n_{i,o}$ are the instantaneous number of moles and initial number of moles, (of reagent $i$) respectively. This quantity will have the same value regardless of which reagent is chosen to compute it and is therefore well-defined. It is effectively a measure of the reaction coordinate.

Note that: $$n_i = n_{i,o} + v_i\xi \to dn_i = v_i d \xi $$

$ \\ $
 $$dG = Vdp - SdT + \sum_i \mu_i dn_i \to \left(dG\right)_{P,T} = \sum_i \mu_i dn_i = \sum_i \mu_i v_i d \xi$$

In particular, $$\left( dG/d \xi \right)_{P,T} = \sum_i \mu_iv_i = \sum_i \left(\mu^o_i + RT\ln(a_i)\right)v_i = \sum_i \mu^o_iv_i + RT \sum_i \ln(a_i)v_i = \Delta G^o_r + RT \sum_i \ln(a_i^{v_i}) = \Delta G^o_r + RT \ln\left(\prod_i a_i^{v_i}\right) = \Delta G^o_r + RT \ln(Q)$$

In particular, $$\left( dG/d \xi \right)_{P,T} = \Delta G^o_r + RT \ln(Q)$$

I assert this is where it should stop. It tells you everything you need to know about the direction of spontaneity and the condition for equilibrium. For instance, the condition for equilibrium is that the free energy of the system is at a (local) minimum. To find the minimum of a differentiable function, you set its derivative equal to zero. Thus at equilibrium you have $Q = K$ and $dG/d \xi = 0$. Plugging this in gives $$K = e^{- \Delta G^o_r / RT}$$What I don't understand is how the left side gets equated with $\Delta G$. The left side is $\sum_i \mu_i v_i$. This is not the "instantaneous difference in free energy between the reactants and products". That would be $\sum_i \mu_i n_i$ (assuming such a notion even makes physical sense). I suppose you could call it $\Delta G_r$, but that perspective is confusing and would have no physical significance in the context of this equation (as you are viewing the reagents' concentrations as the variable that is moving as opposed to pressure or temperature).

I'm wondering if I am conceptually missing something?
The method you described for deriving the desired relationship is one of two that I am aware of.  In my judgment, it is important to mention that this approach looks at a reaction in progress,  determining the free energy of the mixture of reactants and products as a function of the reaction conversion.  As such, it makes the tacit assumption that it is valid for this irreversible process of a reaction occurring spontaneously to determine the free energy at each conversion as if one is considering a thermodynamic equilibrium state of an unreacting mixture.  In my judgment, this is an excellent approximation, but some purists might argue that such an approach is not valid.

The other approach I am aware of is illustrated for the case of a reaction involving an ideal gas reaction.  It evaluates the change in Gibbs free energy between the following pair of initial and final thermodynamic equilibrium states:


Stoichiometric proportions of pure reactants in separate  containers at temperature T and 1 bar pressure
Corresponding stoichiometric proportions of pure products in separate containers at temperature T and 1 bar pressure


The process for evaluating the change from state 1 to state 2 is reversible, and involves successive steps involving isothermal gas expansions and compressions within cylinders in series with a van't Hopf equilibrium box.  The net result is the standard free energy change of the reaction $\Delta G^0$.

If one then modifies the process slightly, by starting with pure gases in separate containers at pressures different from 1 bar, this merely changes the compression and expansion steps in the reversible process, and results in the value of the Gibbs free energy change altering from $\Delta G^0$ to $$\Delta G=\Delta G^0+RT\ln{Q}$$Moreover, if the initial and final pressures in the separate containers are chosen to exactly match the equilibrium partial pressure of the various species in the equilibrium box, then the compression and expansion steps are not necessary, and the $\Delta G$ for this process is zero.  Under these circumstances the reaction parameter Q is equal to the equilibrium constant:  $$0=\Delta G^0+RT\ln{K}$$