In my college level thermodynamics class, the teacher gave us the example of a closed system which consisted of a box thermally insulated. A piston fully divides the box in two parts, and each is filled with some ideal gas (lets call them G1 and G2). The gases can't exchange heat through the piston and so, according to the First Law of Thermodynamics, all work done by the gas must correspond to a variation of internal energy.
Now, suppose G1 and G2 have the same pressure, but different temperatures. The teacher told us that, even though the pressure was the same, the piston would move towards the gas with the lowest temperature until an equilibrium in which both pressure and temperature were equal.
Why does it happen??
Thanks in advance!