Isaac Newton was the first to discover that light from the sun was composed of multiple frequencies. In 1666, by using a prism to break sunlight into its component colors, and then recombining them with a second prism, he showed that the light coming from the sun consisted of a continuous array of colors. Until then, some believed that the colors shown by a prism were generated by the prism itself, and were not intrinsic to the sunlight.
Later experiments showed that some light sources, such as gas discharges, emit at only certain well-defined frequencies rather than over a continuous distribution of colors; the resultant image is called an emission spectrum. (plural, spectra). Still other sources were found to produce nearly continuous spectra (i.e., smooth rainbows of color) with distinct gaps at particular locations; these are known as absorption spectra. By making observations of a variety of objects, Gustav Kirchhoff was able to formulate three laws to describe spectra. Kirchhoff's laws can be put into modern form as follows: (1) an opaque object emits a continuous spectrum; (2) a glowing gas has an emission line spectrum; and (3) a source with a continuous spectrum which has a cooler gas in front of it gives an absorption spectrum.
The observation of spectra was used to discover new elements in the 1800s. For example, the element helium, although it exists on Earth, was first discovered in the Sun by observing its spectrum during an eclipse.
Observations of particular elements showed that each had a characteristic spectrum. In 1885, Johann Balmer developed a simple formula which described the progression of lines seen in the spectrum of hydrogen. His formula showed that the wavelengths of the lines were related to the integers via a simple equation. Others later discovered additional series of lines in the hydrogen spectrum, which could be explained in a similar manner.
Niels Bohr was the first to explain the mechanism by which spectral lines occur at their characteristic wavelengths. He postulated that the electrons in an atom can be found only at a series of unique energy levels, and that light of a particular wavelength was emitted when the electron made a transition from one of these levels to another. The relationship between the wavelength of emitted light and the change in energy was given by Planck's law, which states that energy is inversely proportional to wavelength (and hence directly proportional to frequency). Thus, for a given atom, light could only be emitted at certain discrete wavelengths, corresponding to the energy difference between electron energy levels. Similarly, only wavelengths corresponding to the difference between energy levels could be absorbed by an atom. This picture of the hydrogen atom, known as the Bohr atom, has since been found to be too simplified a model to describe atoms in detail, but it remains the best physical model for understanding atomic spectra.