For a heat-added system, $$ dU + P dV = dQ = \partial Q = T dS $$
where $U$ is total energy, $P$ is pressure, $V$ is volume, $Q$ is heat, $S$ is entropy. For the adiabatic case, $dU + P dV = 0$. Heat is any disorganised form of energy. There is nothing outside the universe, so no heat can be added to universe and, hence, the expansion of the universe is adiabatic ($dQ=0$).
The word observable universe is misleading because it is delimited only by the electromagnetic horizon. But astronomy is becoming much more multi-messenger now-a-days and we might be able to ‘see’ beyond the electromagnetically observable universe using gravitational waves, for example.
Now $U$ is the total energy and can be written in terms of energy density ($\rho$, energy per unit volume) considering the universe as sphere again,
$$ U = \rho V = \rho \frac{4\pi}{3} a^3 $$
where $a$ is the scale factor defined in Lecture 1.
The $4\pi/3$ factor will be canceled out in the adiabatic equation. So the equation will be the same for any shape. The only condition is that the expansion must be isotropic (same in all directions) so that we can use the scale factor $a$. Therefore, our $U \sim \rho a^3$ if $V\sim a^3$. Now dividing the equation by $dt$,
$$ \frac{dU}{dt} + P \frac{dV}{dt} = \frac{d(\rho a^3)}{dt} + P \frac{d(a^3)}{dt} = 0 $$
$$ \Rightarrow \frac{d\rho}{dt}a^3 + \rho 3a^3 \dot{a} + 3 a^2 \dot{a} P = 0.$$
Divide by $a^3$ throughout and we get
$$ \frac{d\rho}{dt} + (P+\rho) \frac{\dot{a}}{a} = 0 .$$
Now we need the constituent relation between pressure $P$ and energy density $\rho$, that is $P=f(\rho)$.
For ideal fluids, the Bernoulli relation says, $P = mn\bar{c^2}/3$. If we write it in terms of energy,
$$ PV = \frac{2}{3} E \Rightarrow P = \frac{2}{3} \frac{E}{V} = \frac{2}{3} \rho $$
which means $P \propto \rho$. $P=2\rho/3$ is valid for non-relativistic fluids.
In a non-relativistic fluid, different particles have different speed and hence the speed $c$ in Bernoulli relation has to be actually the rms (root-mean-square) speed. But for relativistic things, for example light, fortunately the speed is same for each particle; each photon travels at the same speed. If all particles have the same speed, variance is zero and hence the average or the rms are nothing but the speed of the individual particles.
So for relativisitc case, $P = mnc^2/3 = nE/3$ and hence we will get $P=\rho/3$.