Define:
$$\rho \qquad \text{Density}$$
$$P \qquad \text{ Pressure}$$
$$H=\frac 1 a \frac{da}{dt} \qquad \text {Hubble Factor}$$
Assuming FRW metric, then from the Friedmann equations we get (for a perfect fluid Universe):
$$\frac{d\rho}{dt} = -3H(\rho+P) \qquad \text{Continuity Equation}$$
How do I prove: $$dE=-PdV$$
where $dE=\frac{d(\rho L^3 a^3)}{dt}$ is the energy inside a volume element $dV=a^3 L^3$ of co-moving size $L^3 $