What is the basis for the relationship of Gibbs energy and extent of reaction shown in this graph?

How this graph of Gibbs free energy between reaction coordinate is made because because
∆G = ∆G° + RT ln Q
and since ∆G° and T is constant hence the graph should be like that of ln(x)?


[![enter image description here](https://i.stack.imgur.com/Qqg8o.png)](https://i.stack.imgur.com/Qqg8o.png)


Source: <https://wisc.pb.unizin.org/chem109fall2020ver03/chapter/day-31/>




The Gibbs energy for a system at a fixed pressure and temperature, is only a function of the concentration of the species. We write it in a differental form
$$ dG = \sum\_j \mu\_j dn\_j \tag{1} $$
Our task is to plot *this* $G$ versus a variable that can keep track of the reaction, this is the extent of reaction $\xi$. By stoichiometry, we know in general that $n\_\pu{j} = n\_\pu{j}^0 + \nu\_j \xi$, or $dn\_\pu{j} = \nu\_\pu{j} d\xi$, so we get
\begin{align}
 dG &= \sum\_\pu{j} \mu\_\pu{j} \nu\_\pu{j} d\xi \\
 dG &= \sum\_\pu{j} \nu\_\pu{j} [\mu\_\pu{j}^0 + RT\ln(\hat{f}\_\pu{j})] d\xi \\
 dG &= \left[\sum\_\pu{j} \nu\_\pu{j} \mu\_\pu{j}^0 + \sum\_\pu{j} \nu\_\pu{j} 
 RT\ln(\hat{f}\_\pu{j})\right] d\xi \tag{2} \\
\end{align}


where $\hat{f}\_j$ is the fugacity coefficient of species $j$. We identify the first sum as the standard Gibbs energy of reaction and continue with Eq. (2)


\begin{align}
 dG &= \left[\Delta\_\pu{r} G^\circ + RT \ln\prod\_\pu{j} 
 (\hat{f}\_j)^{\nu\_j}\right] d\xi \tag{3}
\end{align}


Without making some assumptions on the behavior of the species this is as far as we can get. But the idea is simple, we need to integrate Eq. (3). However, this may be hard! The fugacity coefficient is a complex function of the composition, and this is why we never integrate this function to get $G$ and find its minimum. Rather, we go back, and just solve $\sum\_j \nu\_\pu{j} \mu\_\pu{j} = 0$.


We will make an exception and do it the hard way, so it is a rather tedious trip. I will do an example so you get the idea.


**Example** Lets consider the formation of hydrogen iodide in the gas phase
$$ \ce{\frac{1}{2}H2(g) + \frac{1}{2}I2(g) -> HI(g)} \tag{4} $$


The system is formed initially by a number of moles of $n\_\ce{H2}^0$ and $n\_\ce{I2}^0$, which I will consider equal, so $ n\_\ce{H2}^0 = n\_\ce{I2}^0 = n^0$. By stoichiometry we link the moles of the species to the extent of the reaction
\begin{align}
 n\_\ce{H2} &= n^0 - \frac{1}{2}\xi \\
 n\_\ce{I2} &= n^0 - \frac{1}{2}\xi \tag{5-7} \\
 n\_\ce{HI} &= \xi
\end{align}
the total number of moles is constant in this case, $n = \sum\_\pu{j} n\_\pu{j} = 2n^0$. So, combining this with Eqs. (5-7) we can calculate the molar fractions of the species
\begin{align}
 y\_\ce{H2} &= \frac{n^0 - \xi/2}{2n^0} \\
 y\_\ce{I2} &= \frac{n^0 - \xi/2}{2n^0} \tag{8-10} \\
 y\_\ce{HI} &= \frac{\xi}{2n^0}
\end{align}
If we assume that the mixture behaves as an ideal gas, then the fugacity coefficient is $\hat{f}\_\pu{j} = y\_jP/P^\circ$


* $P$ is the pressure of the system, that we mantained constant when writting Eq. (1).
* $P^\circ$ is the standard pressure, more precisely, is the standard pressure of the species $j$ when the standard Gibbs energy of formation was measured.


We combine Eqs. (8-10) with Eq. (3)
\begin{align}
 dG &= \left[\Delta\_\pu{r} G^\circ + RT \ln \prod\_\pu{j} \left(\frac{y\_jP}{P^\circ}\right)^{\nu\_j}\right] d\xi \\
 dG &= \left\{ \Delta\_\pu{r} G^\circ + RT \ln\left[
 \dfrac{\dfrac{y\_\ce{HI}P}{P^\circ}}{
 \left(\dfrac{y\_\ce{H2}P}{P^\circ}\right)^{1/2}
 \left(\dfrac{y\_\ce{I2}P}{P^\circ}\right)^{1/2}} \right]\right\} d\xi \\
 dG &= \left\{ \Delta\_\pu{r} G^\circ + RT \ln\left(
 \dfrac{y\_\ce{HI}}{y\_\ce{H2}^{1/2}y\_\ce{I2}^{1/2}} \right)\right\} d\xi \\
 dG &= \left\{ \Delta\_\pu{r} G^\circ + RT \ln\left[
 \dfrac{\dfrac{\xi}{2n^0}}{\left(\dfrac{n^0 - \xi/2}{2n^0}\right)^{1/2}
 \left(\dfrac{n^0 - \xi/2}{2n^0}\right)^{1/2}} \right]\right\} d\xi \\
 dG &= \left\{ \Delta\_\pu{r} G^\circ + RT \ln\left[
 \dfrac{\dfrac{\xi}{2n^0}}{\dfrac{n^0 - \xi/2}{2n^0}} \right]\right\} d\xi \\
 dG &= \left\{ \Delta\_\pu{r} G^\circ + RT \ln\left(
 \frac{\xi}{n^0 - \xi/2}\right)\right\} d\xi \\
 \int\_{G(\xi = 0)}^{G(\xi)} \; dG &= \int\_{0}^{\xi}
 \Delta\_\pu{r} G^\circ \; d\xi + RT \int\_{0}^{\xi} \ln\left(
 \frac{\xi}{n^0 - \xi/2}\right) \; d\xi \\
 G(\xi) - G(\xi = 0) &= \Delta\_\pu{r} G^\circ \xi +
 RT \bigg[2n^0 \ln(2n^0 - \xi) + \xi \ln\left(\frac{\xi}{n^0 - \xi/2}\right)\bigg]\_{0}^{\xi}
\end{align}


$$ \boxed{
 G(\xi) = G(\xi = 0) + \Delta\_\pu{r} G^\circ \xi +
 RT \bigg[2n^0 \ln\left(\frac{2n^0 - \xi}{2n^0}\right) + \xi
 \ln\left(\frac{\xi}{n^0 - \xi/2}\right)\bigg]} \tag{11}
$$


We did al the steps, the only thing that I did is not extend in finding the primitive of the second integral. Secondly, I also skipped that the second logarithm is not continuous on $\xi=0$, but can be seen easily that applying L'Hôpital's rule the limit of that function exists (similar like proving that $\lim\_{x\rightarrow0} x \ln(x) = 0 $). Note that Eq. (11) predicts:


* If $\xi=0$ then $G = G(\xi = 0)$.
* If $\xi=2n^0$, the maximum extent of reaction by Eqs. (8-10), the final term diverges to $\infty$, because both logarithm terms tend to $\infty$.


The following data will be needed ot obtain the standard Gibbs energy of reaction:
\begin{array}{c|c}
 \text{Substance} & \Delta\_\pu{f} G^\circ \pu{(kJ/mol)} \\ \hline
 \ce{H2} & 0 \\
 \ce{I2} & 0 \\
 \ce{HI} & 1690 \\
\end{array}
\begin{equation}
 \Delta\_\pu{r} G^\circ = \sum\_\pu{j} \nu\_\pu{j} \Delta\_\pu{f} G^\circ \rightarrow
 \Delta\_\pu{r} G^\circ = 1690 \; \pu{\frac{J}{mol}}
\end{equation}
And finally, we have the desired plot of Eq. (11), which I just put to exemplify $n^0 = 1 \; \pu{mol}$:


[![enter image description here](https://i.stack.imgur.com/x2KzB.jpg)](https://i.stack.imgur.com/x2KzB.jpg)


**Last comment** The idea still remains in the integration of Eq. (3), but a primitive may not exist. In this case, just numerically integrate the function many times. So, at a point $\xi\_1$ you will get $G(\xi\_1) - G(\xi = 0 )$, and so on; and repeat until the maximum extent of reaction possible (minus some tiny value, because $G \rightarrow \infty$ when the reactants are depleted).


**References**


The thermodynamic data was obtained here:


* Atkins, P. and De Paula, J., "Physical Chemistry", 9th ed, W.H. Freeman and Company New York (2016).


 8

What an interesting question! I was perplexed when I first read this. And then I remembered what my professor told me in college, that is, "when in doubt, *read*." So, I read and found an acceptable answer to your problem.


What is $G$?
------------


We will begin with the definition of Gibbs energy $G$ for a closed homogeneous system:


$$
\mathrm{d}G = -S\mathrm{d}T + V\mathrm{d}P
$$


At constant temperature:


$$
\mathrm{d}G\_{n} = V\mathrm{d}P
$$


Where the subscript indicates the value/s which is/are kept constant. Since our system is gaseous:


$$
\begin{align}
&(\mathrm{d}G)\_{T,n} = \dfrac{nRT}{P}\mathrm{d}P\\
\implies &\int\_{G\_1}^{G\_2} = \int\_{P\_1}^{P\_2} \dfrac{nRT}{P}\mathrm{d}P \\
\implies & G\_2 - G\_1 = nRT\ln{\dfrac{P\_2}{P\_1}}\\
\implies & G\_2 = G\_1 + nRT\ln{\dfrac{P\_2}{P\_1}}
\end{align}
$$


Say $P\_1 = 1 \mathrm{bar}$, then $G\_1=G^{\ominus}$ and, for simplicity, $G\_2 = G$ and $P\_2 = P$, then we obtain the following.


$$
G = G^{\ominus} + nRT\ln{P} \tag{1}
$$


What is $\Delta\_r G$?
----------------------


By definition, Gibbs free energy of reaction is related to the *[extent of reaction](https://en.wikipedia.org/wiki/Extent_of_reaction)* $\xi$ by the following formula.


$$
\Delta\_r G = \left( \dfrac{\partial G}{\partial \xi}\right)\_{T,P}
$$


### Two Component System


For simplicity, I am going to assume a simple gas-phase reaction with $1\ \mathrm{mol}$ of $\ce{A}$ and $\ce{B}$ combined.


$$
\ce{A(g) -> B(g)}
$$


For such a system we define the Gibbs energy as follows.


$$
\mathrm{d}G = -S\mathrm{d}T + V\mathrm{d}P + \mu\_\ce{A}\mathrm{d}n\_\ce{A} + \mu\_\ce{B}\mathrm{d}n\_\ce{B}
$$


At constant temperature and pressure, we obtain the following.


$$
(\mathrm{d}G)\_{T,P} = \mu\_\ce{A}\mathrm{d}n\_\ce{A} + \mu\_\ce{B}\mathrm{d}n\_\ce{B} \tag{2}
$$


Now, here, you will have to do some work yourself, and read about $\xi$, but for our simple reaction $\ce{A -> B}$, we obtain the following.


$$
\begin{align}
\Delta\_r G &= \left( \dfrac{\partial G}{\partial \xi}\right)\_{T,P}\\ 
&= \dfrac{\partial }{\partial \xi}(\mu\_\ce{A}\mathrm{d}n\_\ce{A} + \mu\_\ce{B}\mathrm{d}n\_\ce{B})\\
&= \mu\_\ce{B} - \mu\_\ce{A}
\end{align}
$$


We know that $\mu\_\ce{A} = \left( \dfrac{\partial G}{\partial n\_\ce{A}}\right)\_{T,P}$ and $\mu\_\ce{B} = \left( \dfrac{\partial G}{\partial n\_\ce{B}}\right)\_{T,P}$. Using Eq. (1) we obtain the following.


$$
\Delta\_r G^\* = RT\ln{P\_\ce{B}} - RT\ln{P\_\ce{A}} = RT\ln{\dfrac{P\_\ce{B}}{P\_\ce{A}}} = RT\ln{Q} \tag{3}
$$


The superscript $^\*$ will make sense soon. If we plot this, we obtain the following graph.


[![Plot of Gibbs energy of reaction for a two one-component system](https://i.stack.imgur.com/J4Rxm.png)](https://i.stack.imgur.com/J4Rxm.png)


The Problem
-----------


We have combined an equation (Eq. 1) of single-component system with that (Eq. 2) of a two-component system, which is only valid if the two components are separated into two one-component systems. This would look something like the following.


[![Two one-component system](https://i.stack.imgur.com/WapKv.png)](https://i.stack.imgur.com/WapKv.png)


### The Solution


Consider a two-component system to begin with.


$$
\mathrm{d}G = -S\mathrm{d}T + V\mathrm{d}P + \mu\_\ce{A}\mathrm{d}n\_\ce{A} + \mu\_\ce{B}\mathrm{d}n\_\ce{B}
$$


Define $\Delta\_r G$ accordignly.


$$
\begin{align}
\left( \dfrac{\partial G}{\partial \xi}\right)\_{T,P} &= \dfrac{\partial }{\partial \xi}(\mu\_\ce{A}\mathrm{d}n\_\ce{A} + \mu\_\ce{B}\mathrm{d}n\_\ce{B})\\
&= \mu\_\ce{B} - \mu\_\ce{A} \tag{4}
\end{align}
$$


The differential of the above equation is as follows.


$$
\mathrm{d}\left( \dfrac{\partial G}{\partial \xi}\right)\_{T,P} = \mathrm{d}\mu\_\ce{B} - \mathrm{d}\mu\_\ce{A}
$$


Consider the [Gibbs-Duhem Equation](https://en.wikipedia.org/wiki/Gibbs%E2%80%93Duhem_equation) at constant $T$ and $P$.


$$
\mathrm{d}\mu\_\ce{B} = -\dfrac{n\_\ce{A}}{n\_\ce{B}}\mathrm{d}\mu\_\ce{A}
$$


By substituting into Eq. (4), since $n\_\ce{A} + n\_\ce{B} = 1$, we obtain the following relation.


$$
\mathrm{d}\left( \dfrac{\partial G}{\partial \xi}\right)\_{T,P} = -\dfrac{\mathrm{d}\mu\_\ce{A}}{n\_\ce{B}}
$$


Also, since we have taken only one mole of $\ce{A}$ and $\ce{B}$ combined, $\xi = n\_\ce{B}$.


$$
\mathrm{d}\left( \dfrac{\partial G}{\partial \xi}\right)\_{T,P} = -\dfrac{\mathrm{d}\mu\_\ce{A}}{\xi} = \dfrac{\mathrm{d}\mu\_\ce{B}}{1-\xi}
$$


Here onwards, it is semi-empirical analysis that is going to help us. If someone could carry on the derivation theoretically, I would greatly appreciate it.


 8

UPDATE: In the comments to this and other answers, the question came up why the Gibbs energy of mixing is related to chemical reactions. In a chemical reaction, reactant turns into product (or vice versa). The amounts of species change, as do their concentrations. So if I want to compare the Gibbs energy at two points in the reaction, I have to consider both the change in amounts (no matter how the reaction is set up) and, unless each species has their own phase, the Gibbs energy of mixing.


For finding the difference in Gibbs energy, it does not matter whether the reaction actually happens, or if I just add species in the right amounts to reflect the state before and after (because the Gibbs energy is a state function). To be relevant for a reaction, I do have to make sure my two states have the same set of atoms and the same charge (just like a balanced equation). Using this method, I could even experimentally measure how far a reaction mixture is from equilibrium for a hypothetical reaction that is so slow it never happens (until you find a suitable catalyst).
END OF UPDATE.



> 
> [OP] How this graph of Gibbs free energy between reaction coordinate is made because because ∆G = ∆G° + RT ln Q and since ∆G° and T is constant hence the graph should be like that of ln(x)?
> 
> 
> 


You are confusing $\Delta G$ with $\Delta\_r G$. The first is a generic change in Gibbs energy between two states, whereas the second one is the derivative of G with respect to the extent of reaction $\xi$. One hint are the dimensions. $\Delta G$ has dimensions of energy, the extent of reaction $\xi$ has dimensions of amount of substance, and $\Delta\_r G$ (as the derivative of the first with respect to the second), dimensions of energy per amount of substance.


The curve shows $G$, the Gibbs energy, with an arbitrary zero point. In the simplest case of a reaction $\ce{A(g) -> B(g)}$, the shape of the curve is


$$\frac{G\_\mathrm{relative}}{R T} = \xi \cdot \ln \frac{\xi}{n} + (1 - \xi) \cdot \ln \frac{(1-\xi)}{n} + \xi \cdot \frac{\Delta G}{R T}$$


The logarithm terms represent the entropy of mixing, and $\Delta G$ the difference in Gibbs energy of pure reactant and product.


Here is an example:


[![enter image description here](https://i.stack.imgur.com/rsdkPm.png)](https://i.stack.imgur.com/rsdkPm.png)


Source: <https://www.desmos.com/calculator/kmrjrjat7x>
If you follow the link, you can play with the parameters, having the equilibrium (where the slope is zero) closer to pure reactants or products.


To get $\Delta\_r G$, you have to take the slope of this curve. You can explore this [here](https://www.desmos.com/calculator/tzy8hw1lmy).


Often in textbooks, this curve is sketched rather than plotted, and the slope for $\xi = 0$ and $\xi = 1$ is too small. Below is an attempt to overlay a curve of the correct shape on the textbook figure:


[![enter image description here](https://i.stack.imgur.com/J1PF9.png)](https://i.stack.imgur.com/J1PF9.png)


As you can see, the equilibrium position is a bit off, and the curvature of the overlayed calculated curve is larger than that of the sketched curve (and, as stated above, the slope at the two extremes is different). As a caveat, the shape does change for reactions with more than one reactant and product, and then also depends on whether one of the reactant (or products) is in excess or if you have stoichiometric amounts.


 7