# Why does the temperature of the early Universe decrease as it expands? [duplicate]

This question already has an answer here:

According to the Big Bang theory, the universe cooled down as it expanded. I would like to know why does the temperature decrease? And by "why" I mean how. What causes the temperature to decrease, what's is the physical process?

For simplicity, let's consider the early Universe after protons and neutrons formed but before the molecules appeared, so we have something resembling a monatomic gas. Temperature of such gas is defined in terms of the average kinetic energy $\epsilon_{avg}$ of the particles: $$T = \frac{2}{3}\frac{\epsilon_{avg}}{K_{boltzmann}}$$

If the temperature $T$ decreases, then the $\epsilon_{avg}$ must decrease. By what causes $\epsilon_{avg}$ to decrease? A popular explanation for an ideal gas in a cylinder is that the particles do work on the retracting piston and lose energy. But can we apply this explanation to the expanding Universe? I don't think so. If the particles lose energy, where does this energy go? The particles do not collide with the edge of the universe (the imaginary "piston"), since there is nothing for them to collide with. There is no edge, since the whole space is expanding.