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.

• " 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". Where did you hear that? Entropy, unlike energy, is not a conserved property. Jan 22 at 23:36
• @BobD In cosmology, during the radiation era, entropy is conserved. Jan 22 at 23:40
• @AdriEscañuela Without specifying which definition of entropy one is using, any statement about entropy is meaningless. Notwithstanding the claims of many cosmologists, it is not easy to connect some "entropy of the universe" with the usual thermodynamic concept. Moreover, it is not clear what $f$ is in your question. Jan 22 at 23:55
• @GiorgioP yeah, I know that people that work with thermodynamics have another understanding of "universe", but that's why the title says "in cosmology". Also, the question has been edited, I hope it's clearer now. Jan 23 at 0:17
• Can you please give a link on your "some books give in order to prove that the entropy of the universe is conserved (S is constant)." or a book reference?. I am afraid you have misunderstood something. Jan 23 at 8:25

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.