Reference: Daniel V. Schroeder, An Introduction to Thermal Physics, (Addison-Wesley, 2000) – Problem 5.18.
The Helmholtz and Gibbs free energies both tend to decrease for a system that is allowed to come to equilibrium while being in contact with a large thermal reservoir. Schroeder gives the derivation for a system at constant volume in thermal contact with a reservoir at temperature and shows that the total entropy change (of system + reservoir) is
For a system at constant pressure, the derivation is similar, so here goes. The total entropy change is
where refers to the system and to the reservoir. Using the thermodynamic identity for energy :
we have for a reservoir at constant pressure and particle number :
Since the entire system is at constant pressure, is the same for the system and the reservoir and, since the whole system is at thermal equilibrium, is the same as well. Thus the energy lost (or gained) by the system is gained (or lost) by the reservoir (by conservation of energy) and likewise for the volume, so and . Therefore
Note that these results have expressed the total entropy change of the system + reservoir in terms of the state variables of the system alone.
This derivation seems quite dodgy to me, since and that and therefore . A derivation that makes more sense (to me, anyway) goes like this. Rather than consider differentials, we’ll consider the actual entropies and energies of the system and reservoir. Then the entropy of the universe is now
At equilibrium, must be a maximum, from the second law. The energies obey the relation
And the volumes:
Taking the particle numbers and to be constants, the entropy of the reservoir is, for constant pressure:
The total entropy is then
The last term is a constant, so if we want to maximize , we need maximize only the first two terms on the RHS. That is
Since , this is equivalent to
In other words, for a system at constant number, temperature and pressure, maximizing the total entropy of the universe requires minimizing .
A similar analysis at constant number, temperature and volume results in minimizing , since in that case the second term in 13 becomes a constant and we must maximize instead of .
To minimize , we must reduce and/or increase . For example, if we drop a brick onto the ground from some height, then as it is falling, the brick’s energy (potential + kinetic, neglecting air resistance) remains constant, but when it hits the ground (ground = reservoir), its kinetic energy is reduced to zero while its potential energy remains constant at the value it has at ground level. From this point of view, the brick has certainly lost energy, but the kinetic energy just gets redistributed into thermal motion of the molecules that make up the brick and the patch of ground where the brick landed. Thus an amount of energy is transmitted from the brick to the reservoir.