The idea in this method is to keep track of energy going in and out of a system to infer the energy change.
If the energy is conserved then the left hand side vanishes.
Adiabatic Expansion Edit
If a system is expanding adiabatically, it experiences non radiative energy losses. If it expands at a constant velocity, this loss can be accounted for, by making a slight change to the above equation
The reason this works is that the energy of a spherical radiation dominated gas is reciprocal in the radius
Where we assumed that the displacement of each fluid element is much greater than its initial radius.