Calculating the Gibbs Free Energy of Mixing

This is a Physical Chemistry Question and comes from the Atkins Physical Chemistry book.

Suppose that $$2.0~\mathrm{mol}$$ $$\ce{H2}$$ at $$2.0~\mathrm{atm}$$ and $$25~^\circ\mathrm{C}$$ and $$4.0~\mathrm{mol}$$ $$\ce{N2}$$ at $$3.0~\mathrm{atm}$$ and $$25~^\circ\mathrm{C}$$ are mixed at constant volume. Calculate $$\Delta_\text{mix}G$$. What would be the value of $$\Delta_\text{mix}G$$ had the pressures been identical initially?

The answers are given but I don't understand how to get to $$-9.7~\mathrm{kJ}$$ for the first part of the question (when initial pressures are different. The gases are initially at different pressures but does that make a difference. Can I still use Raoult's Law?

• Let’s start with the last question: Calculate $\Delta_\text{mix}G$ when the pressures are equal in both compartments before mixing. Most physical chemistry textbooks treat this case (including Atkins), and the expression of $\Delta_\text{mix}G$ is: $$\Delta_\text{mix}G= nRT(x_1\ln x_1 +x_2\ln x_2)$$ In this exercise, $1$ denotes hydrogen, $2$ denotes nitrogen $n=6\ \text{mol}$, $x_1=\frac{2}{6}$ and $x_2=\frac{4}{6}$. So, by substituting these values in the above expression, we find: $$\Delta_\text{mix}G= 6\ \text{mol}\times 8.314\ \frac{\text{J}}{\text{mol}\cdot\text{K}}\times 298\ \text{K}\times(\frac{2}{6}\ln\frac{2}{6} +\frac{4}{6}\ln\frac{4}{6})= -9462\ \text{J}$$ As $\Delta_\text{mix}G<0$ at constant temperature and pressure, this means that the mixing of two ideal gases is a spontaneous process .
• Let’s now treat the first question with two different pressure in the two compartments. The initial Gibbs energy is $$G_\text{i}=n_1(\mu_1^0 +RT\ln p_1)+n_2(\mu_2^0 +RT\ln p_2)$$ Where $n_1=2\ \text{mol}$, $n_2=4\ \text{mol}$, $p_1=2\ \text{atm}$, $p_2=3\ \text{atm}$. $$G_\text{i}=2\ \text{mol}\times(\mu_1^0 +RT\ln2)+4\ \text{mol}\times(\mu_2^0 +RT\ln3)$$ When the partition is removed, and each gas occupies the volume $V_1+V_2$. The partial pressure of hydrogen is $$p^\prime_1=\frac{2\ \text{mol}\times RT}{V_1+V_2}$$ The partial pressure of nitrogen is $$p^\prime_2= \frac{4\ \text{mol}\times RT}{V_1+V_2}$$ On the other hand: $$V_1=\frac{2\ \text{mol}\times RT}{2\ \text{atm}}=1\frac{\text{mol}}{\text{atm}}\times RT$$ $$V_2=\frac{4\ \text{mol}\times RT}{3\ \text{atm}}=\frac{4}{3}\frac{\text{mol}}{\text{atm}}\times RT$$ i.e. $$V_1+V_2=\frac{7}{3}\frac{\text{mol}}{\text{atm}}\times RT$$ So $$p^\prime_1=\frac{2\ \text{mol}\times RT}{(7/3\ \text{mol/atm})RT}=\frac{6}{7}\ \text{atm}$$ $$p^\prime_2= \frac{4\ \text{mol}\times RT}{(7/3\ \text{mol/atm})RT}=\frac{12}{7}\ \text{atm}$$ The final Gibbs energy is $$G_\text{f}=n_1(\mu_1^0 +RT\ln p^\prime_1)+n_2(\mu_2^0 +RT\ln p^\prime_2)$$ $$G_\text{f}=2\ \text{mol}\times(\mu_1^0 +RT\ln\frac{6}{7})+4\ \text{mol}\times(\mu_2^0 +RT\ln\frac{12}{7})$$ The Gibbs energy of mixing is the difference between $G_\text{f}$ and $G_\text{i}$ $$\Delta_\text{mix}G= 2\ \text{mol}\times RT\ln\frac{6/7}{2} +4\ \text{mol}\times RT\ln\frac{12/7}{3}$$ $$\Delta_\text{mix}G= 2\ \text{mol}\times RT\ln\frac{6}{14} +4\ \text{mol}\times RT\ln\frac{12}{21}$$ $$\Delta_\text{mix}G= 2\ \text{mol}\times 8.314\frac{\text{J}}{\text{mol}\cdot\text{K}}\times 298\ \text{K}\times(\ln\frac{3}{7} +2\times\ln\frac{4}{7})= -9744\ \text{J}\approx{-9.7\ \text{kJ}}$$ In this case, the value of $\Delta_\text{mix}G$ is the sum of two contributions: the mixing itself and the changes of pressure of the two gases to their final total pressure.
• Why isn't zero? I mean at constant $T$ and $p$ it follows that $dG=-SdT + Vdp=0$. Jun 17, 2020 at 12:37