# How does entropy work with mixing?

Imagine a hypothetical box filled with water, with two equal-volume partitioned sections: one at 40 degrees, and the other at 60 degrees. There is thus an energy associated with the difference in temperature that could be harnessed.

In this first box we remove the partition, the water mixes, and the potential to extract energy is lost through entropy generation.

Imagine now a second similar box that has a Stirling engine between these two partitions, whose power output is directed towards a heater/agitator on the warmer side.

When both boxes have reached steady-state equilibrium, are they the same temperature? If so, is this temperature exactly 50 degrees, or slightly greater due to the energy potential being converted to heat?

• The title of your post is addressable. But I cannot understand the text that follows. Jul 9 at 21:54
• Please indicate what, if any, aspects of the revised question are unclear. Jul 10 at 14:55

Yes; conservation of energy dictates that if the temperature difference is eliminated through a heat engine that dumps the output work back into the system, then the final temperature is 50 degrees, just as if the partition were removed with no heat engine.

Note that since the heat engine exists within the box, any inefficiencies simply heat the box with the box’s extractable energy; this wouldn’t be the case for a real engine outside the box, which would heat the surroundings through inefficiencies, thus cooling the box somewhat.

Interestingly, for constant heat capacity, a perfect-efficiency engine leaves us with the geometric mean of the original absolute temperatures: $$T_\text{final}=\sqrt{T_1T_2}=322.8\,\text{K}=49.8^\circ\text C$$, whereas just pulling out the partition to allow mixing gives us the arithmetic mean of $$T_\text{final}=\frac{T_1+T_2}{2}=50^\circ\text C$$.

I derive this result here; the sketch of the proof is that irreversible thermal contact is governed by conservation of energy (i.e., the energy leaving the hotter side enters the colder side ), whereas a reversible heat engine is governed by conservation of entropy (i.e., the entropy leaving the hotter side enters the colder side, and any extra energy in this process can be output as work).

We thus extract as work the energy corresponding to the difference of $$0.2^\circ\text C$$ multiplied by the total heat capacity of the water in the box. No real engine, including a real Stirling engine, can do better.

(We can further generalize the result as $$T_\text{final}=\sqrt[N]{\prod_i^NT_i}$$ (with $$\prod$$ referring to the product) and $$T_\text{final}=\frac{1}{N}\sum_i^N T_i$$ for the two processes for $$N$$ equal-size bodies of constant heat capacity.)

Since in your thought experiment this work is returned to the hotter side and the engine continues to operate until the temperature difference is eliminated, we obtain a final temperature of 50 degrees.

The exact plots comparing these two scenarios appear under "A semiquantitative perspective" at the link:

• Yes. That .2 degree difference explains my question. I suppose the question might have been more clear with a third scenario, where the engine energy is expended outside the closed system Jul 10 at 15:44

When they reach equilibrium both sides will be 50 degrees. We arrive at this simply by using conservation of energy. We can do that because your heat engine spent its work-energy back into the water. If it has spent it outside the system then Mr. Chemomechanics answer would be relevant.