text: In a classical ideal gas with massive particles, the energy of the particles is distributed according to a Maxwell–Boltzmann distribution. This distribution is established as the particles collide with each other, exchanging energy (and momentum) in the process. In a photon gas, there will also be an equilibrium distribution, but photons do not collide with each other (except under very extreme conditions, see two-photon physics), so the equilibrium distribution must be established by other means. The most common way that an equilibrium distribution is established is by the interaction of the photons with matter. If the photons are absorbed and emitted by the walls of the system containing the photon gas, and the walls are at a particular temperature, then the equilibrium distribution for the photons will be a black-body distribution at that temperature.
  A very important difference between a generic Bose gas (gas of massive bosons) and a photon gas with a black-body distribution is that the number of photons in the photon gas is not conserved. A photon may collide with an electron in the wall, exciting it to a higher energy state, removing a photon from the photon gas. This electron may drop back to its lower level in a series of steps, each one of which releases an individual photon back into the photon gas. Although the sum of the photon energies of the emitted photons are the same as the absorbed photon, the number of emitted photons will vary. It can be shown that, as a result of this lack of constraint on the number of photons in the system, the chemical potential of the photons must be zero for black-body radiation.
  The thermodynamics of a black-body photon gas may be derived using quantum mechanical arguments. The derivation yields the spectral energy density u which is the energy per unit volume per unit frequency interval, given by Planck's law:
  where h is Plancks constant, c  is the speed of light, ν  is the frequency, k  is the Boltzmann constant, and T'  is temperature.
  Integrating over frequency and multiplying by the volume, V, gives the internal energy of a black-body photon gas:
  The derivation also yields the (expected) number of photons N:
  where  is the Riemann zeta function. Note that for a particular temperature, the particle number N varies with the volume in a fixed manner, adjusting itself to have a constant density of photons.
  If we note that the equation of state for an ultra-relativistic quantum gas (which inherently describes photons) is given by
  then we can combine the above formulas to produce an equation of state that looks much like that of an ideal gas:
  The following table summarizes the thermodynamic state functions for a black-body photon gas. Notice that the pressure can be written in the form , which is independent of volume (b is a constant).