The electrons in an atom can only occupy certain allowed energy levels. When an electron drops from a higher energy level to a lower one, the excess energy is emitted as a photon of light, with its wavelength dependent on the change in electron energy.
The electrons in an atom can only occupy certain allowed energy levels. This was one of the early results of quantum mechanics. Classical physics predicted that a negatively charged electron would fall into a positively charged nucleus emitting a continuous spectrum of light as it did so. This is obviously not the case as if it were there would be no stable atoms. It was discovered later that this didn’t happen because electrons can only occupy discrete energy levels within the atom.
When an electron drops from a higher energy level to a lower one, the excess energy is emitted as a photon of light. The wavelength, ##lamda## of the photon is inversely proportional to the change in electron energy:
##lambda= (c times h) / text(change in electron energy)##
Where c is the speed of light in a vacuum and h is Planck’s constant.
Only certain energy levels are allowed, so only certain transitions are possible and hence specific wavelengths are emitted when an electron drops to a lower energy level. Conversely, an atomic electron can be promoted to a higher energy level when it absorbs a photon. Again because only certain transitions are allowed, only certain wavelengths can be absorbed.