Entropy Changes in Mixing Ideal Gases

Download the CDF file to view the simulation using the free Wolfram CDF player.

In this Demonstration, ideal gases A and B are mixed isothermally by keeping the total volume constant ("remove barrier" option) or by adding gas A to gas B so the final volume is the same as the initial volume of B ("compress right" option). Select the "mix gases" play button to initiate mixing. For the "remove barrier" option, the entropy change of each gas is the same as that of a gas expanding into a vacuum. When the partial pressure decreases, entropy increases. For the "compress right" option, if the partial pressure of a gas does not change, its entropy does not change, even when mixed with another gas. The total entropy change is the sum of the entropy changes of each gas. Gas A is colored red and gas B is colored blue, and when the gases mix, different shades of purple result, depending on the ratio of moles of each species. As the number of moles increases, the color becomes more intense. When the initial pressures of A and B are equal and the "remove barrier" option is selected, which corresponds to mixing at constant pressure, the entropy of mixing is: 
 ΔSmix = -nARlnxA - nBRlnxB
where xA and xB are the mole fractions of A and B in the final mixture.