Solution (source code)

= Solution

Let $V$ be the physical volume of a region with fixed comoving coordinates, so $V\propto a^3$, and write $U=\rho V$. The <first law of thermodynamics> is $dU=T\,dS-P\,dV+\mu\,dN$. Use <extensive quantities>: under replication, $U(\lambda S,\lambda V,\lambda N)=\lambda U(S,V,N)$. The <Euler theorem for homogeneous functions> gives
$$
U=TS-PV+\mu N.
$$
Setting $\mu=0$ yields
$$
\boxed{S=\frac{U+PV}{T}=\frac{\rho+P}{T}V.}
$$
This is the entropy form of the <Gibbs-Duhem equation>; it fixes the normalization by extensivity, rather than adding an arbitrary volume-independent entropy constant.

For equilibrium expansion of the same region, the first law and the <cosmological perfect-fluid continuity equation> imply
$$
T\dot S=\dot U+P\dot V=V\dot\rho+(\rho+P)\dot V=0.
$$
Therefore $\boxed{\dot S=0}$, establishing <cosmological entropy conservation> for adiabatic equilibrium evolution. Here “comoving volume” means a patch moving with the cosmological fluid; its physical volume $V$ changes. The corresponding coordinate volume is constant. The local TeX's $\dot V/P$ in the continuity-equation hint is a transcription error: the PDF correctly has $\dot V/V$.