Conservation of entropy in cosmology I've been trying to follow the procedure that some books give in order to prove that the entropy of the universe is conserved (S is constant).
It usually goes like this:
Consider the second law of thermodynamics:
$$
TdS=dU+PdV.
$$
Now, using $U=\rho V$, we get:
$$dS=\frac{1}{T} \left( d[(\rho + P)V]-VdP \right) $$
From this moment on, to continue proving the conservation of entropy, I need to use:
$$\frac{\partial P}{\partial T}=\frac{\rho+P}{T},$$
which is the equation I'm struggling to get.
In some books, like Kolb and Turner's Early Universe, they argue that this comes from the following Maxwell relation:
$$
\frac{\partial S}{\partial T\partial V}=\frac{\partial S}{\partial V\partial T}.
$$
This, for me, seems a little harder to grasp (although I'm open to hear responses that are related to this way of dealing with the problem), therefore I tried looking into other books which may have another ways of going through this. In the book Modern Cosmology by Scott Dodelson, we are told to assume $f=f(E/T)$, where $f$ is the distribution function, and subsitute this into the integral expression of $P$,
$$P=g\int \frac{d^3p}{(2\pi)^3}f(p)\frac{p^2}{3E(p)}.$$
Then in order to find $dP/dT$, we rewrite $df/dT$ under the integral sign as $-(E/T)df/dE$ (I don't get this), and by integrating by parts we should get our result. I've been trying to work it out but I don't know how to procced.
References: Cosmology by Baumann pages 55-56, "The Early Universe" by E. Kolb and M. Turner pages 65-66, Modern Cosmology by Scott Dodelson pages 44-45, page 56 exercise 14.
 A: The approximations enabling us to speak meaningfully about an entropy of the universe and its conservation shouldn't be considered useless addenda to ignore. Actually, they are necessary conditions to allow applications of usual thermodynamic formulae.
According to one of your references (Baumann's book),

Since there are far more photons than baryons in the universe, the entropy of the universe is dominated by the entropy of the photon bath (at least as long as the universe is sufficiently uniform). Any entropy production
from non-equilibrium processes is, therefore, total insignificant relative to the total entropy.

These considerations are essential because they give us an argument to neglect the contribution to the thermodynamics from gravitationally interacting bodies, with its well-known peculiarities (particularly the non-extensiveness), and to use the usual thermodynamics. Moreover, they justify the condition on the chemical potential which is essential for deriving the result. Notice that this preliminary observation is the hard part of the answer.
After this introduction, within the usual thermodynamics, derivation of
$$\frac{\partial P}{\partial T}=\frac{\rho+P}{T},$$
is an almost trivial exercise.
Homogeneity of degree $1$ of the internal energy (guaranteed by the dominance of the photon contribution) allows us to write
$$
U=TS-PV+N\mu.\tag{1}
$$
But, again, for the dominance of the photon contribution, $\mu=0$. Therefore, it is possible to rearrange the previous equation in the following form
$$
s=\frac{S}{V}=\frac{P}{T}+\frac{U}{TV} = \frac{P+\rho}{T}.
$$
On the other hand, combining the differential of the terms in equation $(1)$ with the differential expression of the first principle ($dU = TdS-PdV$) gives us the so-called Gibbs-Duhem equation that, in the present case ($\mu=0$), becomes
$$
VdP=SdT,$$ and combining it with the previous result, we finally get
$$
\left.\frac{\partial P}{\partial T}\right|_{\mu=0}=\frac{\rho+P}{T}.
$$
For clarity, I have explicitly indicated that the relation holds under the condition of zero chemical potential.
