Blackbody radiation through quantum mechanics perspective While explaining black body radiation, the body is assumed as a cavity radiator and the radiations are due to the oscillating electrons.
But we know that the electromagnetic radiation emitted is quantized, energy of these radiation is in the form of photons which are emitted due to electrons going from higher energy level to lower energy level.
But how does this picture fit into explaining black body radiation? Specifically, I cannot understand how, by increasing the temperature, the peak of the frequency shifts to higher energy density in terms of these photon emission?
 A: Photons have spin 1, hence they can be treated inside the cavity as a Bose gas. Their distribution obeys the Bose-Einstein statistics:
$$\bar{n}_r = \frac {1}{e^{\beta\epsilon_r}-1}$$
where $\bar{n}_r$is the mean occupation number of the energy level $r$, $\epsilon_r$ is the energy of the energy level $r$, and $\beta = \frac{1}{k_bT}$, $k_b$ being Boltzmann constant and $T$ the temperature of the system.
It follows directly from this distribution that the peak frequency shifts with increased temperature. (mind that $\epsilon_r = hf$ for photons)
A: When deriving Planck's law, the setting is that photons at all frequencies are in a thermal equilibrium. This is not a small assumption, although it is more or less valid for various macroscopic objects.
For such a thermal equilibrium to be possible, there has to be a black body, an object that can absorb and emit all frequencies. Ideally, a black body should have a continuous spectrum of energy levels, as the frequency of a photon can be any real number.
The black body being at a higher temperature means that there are more total energy available in the system and it becomes easier to emit photons with higher energy. It is certainly not in disagreement with the fact that radiation originates from transition of electrons between energy levels, as the black body assumption implies that there is a continuous spectrum.
From what I have described so far, it is obvious that we cannot use a dilute gas of hydrogen atoms (assuming that the  temperature is low enough so that ionization is practically impossible) to generate a black body radiation. This system can equilibrate only with photons with frequencies corresponding to the spectral line of the atomic hydrogen.
