# What is the entropy of mixing of two ideal gases starting out with different pressures?

The entropy of mixing of ideal gas is given by this equation:

$\Delta S_{mix} = -nR(x_1\ln x_1 + x_2\ln x_2)$

1. Does this equation works only when the initial conditions of both compartments are at the same pressure?

2. If ideal gas 1 at initial conditions $n_1,P_1,V_1,T$ and ideal gas 2 at $n_2,P_2,V_2,T$ are mixed, which equation should I use to obtain $\Delta S_{mix}$ given that $P_1 ≠P_2$? Assume $V_1 + V_2 = V_{tot}$, and $T_1 = T_2 = T$. • To 1.: No you can't use this equation. Pressure has an effect on the entropy. To 2.: Have you tried anything to solve this yourself? Do you have an idea how to go about it? – Philipp Oct 20 '14 at 10:37
• @Philipp I tried dS = -RdP/P and integrate from P1 to Pavg and P2 to Pavg and summing the entropy change. – t.c Oct 20 '14 at 15:12

A strategy that often works is to look at the initial and the final states and then compare them. A good place to start is usually the Gibbs free energy of the system (with the intention to use $\Delta_{\mathrm{mix}} S = - \frac{\partial \Delta_{\mathrm{mix}}G}{\partial T} \big|_{p, \{ n_{i} \}}$ later): for isothermal and isobaric conditions it is

\begin{equation} G = \sum_{i} n_{i} \mu_{i} + \mathrm{constant} = n_{\mathrm{tot}} \sum_{i} \underbrace{x_{i}}_{= \, \frac{n_{i}}{n_{\mathrm{tot}}}} \mu_{i} + \mathrm{constant} \hspace{4em} (1) \end{equation}

with $n_{i}$, $\mu_{i}$, and $x_{i} = \frac{n_{i}}{n_{\mathrm{tot}}}$ being the amount, the chemical potential, and the mole fraction of the $i$th component in the system, respectively, and $n_{\mathrm{tot}} = \sum_{i} n_{i}$ being the total amount of gas in the system. So, now we need an expression for the chemical potential of an ideal gas. It can be shown that this is given by

\begin{equation} \mu_{i} = \mu_{i}^{0} + R T \ln\biggl(\frac{p_{i}}{P^{0}}\biggr) \hspace{18em} (2) \end{equation}

where $\mu_{i}^{0}$ is the chemical potential of the $i$th component in a given standard state, $R$ is the universal gas constant, $T$ is the temperatur, $p_{i}$ is the partial pressure of the $i$th component, and $P^{0}$ is the standard pressure (i.e. the pressure connected to the standard state). For ideal gases we can apply Raoult's law stating that

\begin{equation} p_{i} = x_{i} P_{\mathrm{tot}} \end{equation}

where $P_{\mathrm{tot}}$ is the total pressure of the system. Using this with equation (2) we get

\begin{equation} \mu_{i} = \mu_{i}^{0} + R T \ln\biggl(\frac{x_{i} P_{\mathrm{tot}}}{P^{0}}\biggr) = \mu_{i}^{0} + R T \ln x_{i} + R T \ln\biggl(\frac{P_{\mathrm{tot}}}{P^{0}}\biggr) \hspace{6em} (3) \end{equation}

Furthermore, it is known that the partial pressures in a system must add up to the total pressure, i.e.

\begin{equation} P_{\mathrm{tot}} = \sum_{i} p_{i} \end{equation}

Ok, now that the stage is set we simply have to apply equations (1) and (3) to the initial and the final state of the mixing process. At the initial state the chambers are seperated (whereby chamber $i$ contains only one sort of gas labeled by $i$) and so these subsystems are completely independent from each other. Thus, the Gibbs free energy of the total system of chambers is simply the sum of the Gibbs free energies of each chamber, whereby the gas in each of the chambers feels the pressure $P_{\mathrm{tot}} = P_{i}$ in the system (whereby $P_{i}$ is the ambient pressure in chamber $i$), since $x_{i} = 1$ (each chamber/independent subsystem holds just one kind of gas). According to equation (1) the Gibbs free energy of the $i$th chamber is then given by

\begin{align} G_{i} &= n_{i} \mu_{i} = n_{i} \biggl( \mu_{i}^{0} + R T \underbrace{\ln 1}_{= \, 0} + R T \ln\biggl(\frac{P_{i}}{P^{0}}\biggr) \biggr) \\ &= n_{i} \biggl( \mu_{i}^{0} + R T \ln\biggl(\frac{P_{i}}{P^{0}}\biggr) \biggr) \end{align}

and the Gibbs free energy of the total system at the initial state is

\begin{align} G_{\mathrm{ini}} &= \sum_{i} G_{i} \\ &= \sum_{i} \underbrace{n_{i}}_{= \, x_{i} n_{\mathrm{tot}}} \biggl( \mu_{i}^{0} + R T \ln\biggl(\frac{P_{\mathrm{tot}}}{P^{0}}\biggr) \biggr) \\ &= n_{\mathrm{tot}} \biggl( \underbrace{\sum_{i} x_{i} \mu_{i}^{0}}_{= \, G_{\mathrm{ini}}^{0}} + \sum_{i} x_{i} R T \ln\biggl(\frac{P_{i}}{P^{0}}\biggr) \biggr) \\ &= n_{\mathrm{tot}} \biggl( G_{\mathrm{ini}}^{0} + \sum_{i} x_{i} R T \ln\biggl(\frac{P_{i}}{P^{0}}\biggr) \biggr) \ . \hspace{7em} (4) \end{align}

For a multicomponent system with more than two components I would simply use this equation. But for a system with exactly two components we can introduce some substitutions that will simplify the final equations a little. For that purpose we want to establish a relationship between the initial pressures $P_{1}$ and $P_{2}$ and the final pressure $P_{\mathrm{fin}}$. In order to get there we use the ideal gas law and the additivity relations for the volumes and amounts: From

\begin{equation} n_{\mathrm{tot}} = n_{1} + n_{2} \ , \qquad V_{\mathrm{tot}} = V_{1} + V_{2} \\ P_{1} V_{1} = n_{1} R T \ , \qquad P_{2} V_{2} = n_{2} R T \ , \qquad P_{\mathrm{fin}} V_{\mathrm{tot}} = n_{\mathrm{tot}} R T \end{equation}

it follows that

\begin{align} P_{1} V_{1} + P_{2} V_{2} = P_{\mathrm{fin}} V_{\mathrm{tot}} \ . \end{align}

Now, we can express $P_{2}$ in terms of $P_{\mathrm{fin}}$ by introducing the deviation factor $\alpha$ which is defined by $P_{2} = (1 - \alpha) P_{\mathrm{fin}}$ and use this in the previous equation

\begin{align} P_{1} V_{1} + P_{2} V_{2} &= P_{\mathrm{fin}} V_{\mathrm{tot}} \\ P_{1} V_{1} + (1 - \alpha) P_{\mathrm{fin}} V_{2} &= P_{\mathrm{fin}} V_{\mathrm{tot}} \\ P_{1} V_{1} &= P_{\mathrm{fin}} \bigl( \underbrace{V_{\mathrm{tot}} - V_{2}}_{= \, V_{1}} + \alpha V_{2} \bigr) \\ P_{1} &= \biggl( 1 + \alpha \frac{V_{2}}{V_{1}} \biggr) P_{\mathrm{fin}} \end{align}

which gives us the relation between $P_{1}$ and $P_{\mathrm{fin}}$. Introducing these equations into equation (4) yields

\begin{align} G_{\mathrm{ini}} &= n_{\mathrm{tot}} \biggl( G_{\mathrm{ini}}^{0} + x_{1} R T \ln\biggl(\frac{P_{1}}{P^{0}}\biggr) + x_{2} R T \ln\biggl(\frac{P_{2}}{P^{0}}\biggr) \biggr) \\ &= n_{\mathrm{tot}} \biggl( G_{\mathrm{ini}}^{0} + x_{1} R T \ln\frac{\bigl( 1 + \alpha \frac{V_{2}}{V_{1}} \bigr) P_{\mathrm{fin}}}{P^{0}} + x_{2} R T \ln\frac{(1 - \alpha) P_{\mathrm{fin}}}{P^{0}} \biggr) \\ &= n_{\mathrm{tot}} \biggl( G_{\mathrm{ini}}^{0} + x_{1} R T \ln\biggl( 1 + \alpha \frac{V_{2}}{V_{1}} \biggr) + x_{2} R T \ln(1 - \alpha) + \underbrace{(x_{1} + x_{2})}_{= \, 1} R T \ln\biggl( \frac{P_{\mathrm{fin}}}{P^{0}} \biggr) \biggr) \\ &= n_{\mathrm{tot}} \biggl( G_{\mathrm{ini}}^{0} + x_{1} R T \ln\biggl( 1 + \alpha \frac{V_{2}}{V_{1}} \biggr) + x_{2} R T \ln(1 - \alpha) + R T \ln\biggl( \frac{P_{\mathrm{fin}}}{P^{0}} \biggr) \biggr) \ . \end{align}

At the final state the chambers are connected and the gases mix, so the chambers are not independent subsystems anymore and the Gibbs free energy cannot be broken down into independent parts like before. Also, the ambient pressure in the system changes to $P_{\mathrm{tot}} = P_{\mathrm{fin}}$. Now, the complete system of connected chambers must be treated via equation (1)

\begin{align} G_{\mathrm{final}} &= \sum_{i} \underbrace{n_{i}}_{= \, x_{i} n_{\mathrm{tot}}} \biggl( \mu_{i}^{0} + R T \ln x_{i} + R T \ln\biggl(\frac{P_{\mathrm{fin}}}{P^{0}}\biggr) \biggr) \\ &= n_{\mathrm{tot}} \biggl( \sum_{i} x_{i} \mu_{i}^{0} + \sum_{i} R T x_{i} \ln x_{i} + \sum_{i} x_{i} \underbrace{R T \ln\biggl(\frac{P_{\mathrm{fin}}}{P^{0}}\biggr)}_{= \, \mathrm{constant}} \biggr) \\ &= n_{\mathrm{tot}} \biggl( \underbrace{\sum_{i} x_{i} \mu_{i}^{0}}_{= \, G_{\mathrm{ini}}^{0}} + R T \sum_{i} x_{i} \ln x_{i} + R T \ln\biggl(\frac{P_{\mathrm{fin}}}{P^{0}}\biggr) \underbrace{\sum_{i} x_{i}}_{= \, 1} \biggr) \\ &= n_{\mathrm{tot}} \biggl( G_{\mathrm{ini}}^{0} + R T \sum_{i} x_{i} \ln x_{i} + R T \ln\biggl(\frac{P_{\mathrm{fin}}}{P^{0}}\biggr) \biggr) \\ &= n_{\mathrm{tot}} \biggl( G_{\mathrm{ini}}^{0} + R T \left( x_{1} \ln x_{1} + x_{2} \ln x_{2} \right) + R T \ln\biggl(\frac{P_{\mathrm{fin}}}{P^{0}}\biggr) \biggr) \ . \end{align}

Now, that we have the Gibbs free energies of the initial and final state we simply need to subtract the former from the latter one in order to obtain the change in Gibbs free energy during the mixing process:

\begin{align} \Delta_{\mathrm{mix}}G &= G_{\mathrm{final}} - G_{\mathrm{ini}} \\ &= n_{\mathrm{tot}} \biggl( G_{\mathrm{ini}}^{0} + R T \left( x_{1} \ln x_{1} + x_{2} \ln x_{2} \right) + R T \ln\biggl(\frac{P_{\mathrm{fin}}}{P^{0}}\biggr) \biggr) \\ &\quad - n_{\mathrm{tot}} \biggl( G_{\mathrm{ini}}^{0} + x_{1} R T \ln\biggl( 1 + \alpha \frac{V_{2}}{V_{1}} \biggr) + x_{2} R T \ln(1 - \alpha) + R T \ln\biggl( \frac{P_{\mathrm{fin}}}{P^{0}} \biggr) \biggr) \\ &= n_{\mathrm{tot}} R T \left( x_{1} \ln x_{1} + x_{2} \ln x_{2} \right) - n_{\mathrm{tot}} R T \biggl( x_{1} \ln\biggl( 1 + \alpha \frac{V_{2}}{V_{1}} \biggr) + x_{2} \ln(1 - \alpha) \biggr) \qquad (5) \end{align}

Now you see why we went through those substitutions for $P_{1}$ and $P_{2}$. This way the $n_{\mathrm{tot}} R T \ln\Bigl(\frac{P_{\mathrm{fin}}}{P^{0}}\Bigr)$ terms cancelled in equation (5).

Differentiating equation (5) with respect to the temperature we get the entropy of mixing since $\frac{\partial G}{\partial T} \big|_{p, \{ n_{i} \}} = - S$

\begin{align} \Delta_{\mathrm{mix}} S &= - \frac{\partial \Delta_{\mathrm{mix}}G}{\partial T} \bigg|_{p, \{ n_{i} \}} \\ &= - n_{\mathrm{tot}} R \left( x_{1} \ln x_{1} + x_{2} \ln x_{2} \right) + n_{\mathrm{tot}} R \biggl( x_{1} \ln\biggl( 1 + \alpha \frac{V_{2}}{V_{1}} \biggr) + x_{2} \ln(1 - \alpha) \biggr) \end{align}

The first term $- n_{\mathrm{tot}} R \left( x_{1} \ln x_{1} + x_{2} \ln x_{2} \right)$ is just the usual entropy of mixing. The second term $n_{\mathrm{tot}} R \Bigl( x_{1} \ln\Bigl( 1 + \alpha \frac{V_{2}}{V_{1}} \Bigr) + x_{2} \ln(1 - \alpha) \Bigr)$ describes the contribution of the pressure equilibration to the entropy.

• Thank you for your answer. Is it possible to use $\Delta{S} = -n_1R\ln\frac{P_{fin}}{P_1} -n_2R\ln\frac{P_{fin}}{P_2}$ and summing this entropy change and that of the one of mixing? – t.c Oct 20 '14 at 17:28
• @t.c Where does this equation for $\Delta S$ come from. – Philipp Oct 20 '14 at 17:41
• I used the ideal gas entropy change equation $\Delta{S} = C_p\ln\frac{T_2}{T_1} - R\ln\frac{P_2}{P_1} = - R\ln\frac{P_2}{P_1}$(at const T). Then I substitute in the initial pressures and the final pressure $P_{fin}$ – t.c Oct 20 '14 at 18:09
• @t.c I don't think you can use this formula for a mixing process. It doesn't account for the mixing contribution. – Philipp Oct 20 '14 at 18:20