In this Demonstration, ideal gases

and

are mixed isothermally by keeping the total volume constant (remove barrier option) or by adding gas

to gas

so the final volume is the same as the initial volume of

(select "compress right"). Click the play button next to "mix gases" to initiate mixing. For "remove barrier", 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 "compress right", 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

is colored red and gas

is colored blue, and when the gases mix, different shades of purple result, depending on the ratio of moles of each species. As the pressures increase, the color becomes more intense. When the initial pressures of

and

are equal and the "remove barrier" is selected, which corresponds to mixing at constant pressure, the entropy of mixing is

, where

and

are the mole fractions of

and

in the final mixture.