system
Given the following post, respond as if you're commenting on Reddit:
human
Why does the the cosmic background radiation have a uniform temperature of 2.7 K?

I know that light is red shifted by traveling over cosmological distances, and the CMB was hotter and bluer in the past. What I don't understand is how it stays in thermal equilibrium as the universe expands. Does the light it come to an equilibrium temperature by interacting with matter? Does redshift change the wavelength distribution of light in such a way that it stays in thermal equilibrium?
gpt
The light is redshifted not because it has traveled, but because the universe has expanded.

In the early universe, the photons were in thermal equilibrium with matter. When the universe was about 375000 years old, atoms formed, and the light *decoupled*, meaning that, generally speaking, it was no longer regularly interacting with other things.

At that time, the light was in thermal equilibrium at a temperature of 3000K. As the universe expanded, as you suspected, the redshift keeps the spectrum a thermal spectrum, just at gradually lower temperatures.