Consider two systems, 1 and 2, which can exchange heat and do only the mechanical p-V work. They are isolated from the rest of the world. At equilibrium they have the common pressure, say ˉp. Then if we nudge them slightly from equilibrium, then we must have, because of isolation, that (I denote by E the internal energies)
total increase in energy =(dE1−ˉpdV1)+(dE2−ˉpdV2)=d(E1+E2−ˉp(V1+V2))
be zero, and hence
E1+E2=ˉp(V1+V2)+const.
Now, assuming that the systems are independent,
Stot(E1,E2,V1,V2)=S1(E1,V1)+S(E2,V2).
Now, maximizing (2) subject to (1) leads that, at equilibrium,
∂S1∂E1=∂S2∂E2
which we identify as
1/T, and
∂S1∂V1=−ˉpT,
which
contradicts the oft-stated result with the minus sign flipped.
In hindsight, there must be a minus sign on the RHS of the constraint (1), but I don't see why.
Question: What exactly has gone awry in the above reasoning of mine?