Emission and Absorption Spectra
When an element is given enough energy it emits light. This light can be analysed by passing it through a prism. This separates the light into it's component frequencies. If all possible frequencies are present, the result will be a continuous spectrum. However, typically all frequencies are not spectrum. Typically some frequencies will be missing, showing up as black lines in the spectrum.
These missing frequencies correspond to differences in the energy levels of the electrons in atoms. The black lines are due to the absorption of light of those frequencies being absorped by atoms, raising the electrons to higher energy levels.
For every absorption spectrum there is a corresponding emission spectrum.
Soon after the electron absorbs a photon, it emits a photon with exactly the same frequency, so the absorption spectrum complements the emission spectrum exactly. The photon may be emitted in any direction, so an emission spectrum may be visible from any direction. An absorption spectrum is only seen when there is some intervening matter between source and observer.
Emission and absorption spectra are unique to each element and may be used in a variety of ways, to identify elements and molecules (molecules also have emission and absorption spectra), and calculate the speed of a star for example by find the Doppler shift by inspection of it's spectra.