Using a Diffraction Grating for Spectroscopy

Diffraction gratings are very useful for accurately measuring the wavelength of light. Gases, for instance, give off light of particular colors - each element has its own characteristic fingerprint of emission lines. When astronomers look through diffraction gratings at stars, for instance, they can tell what elements the star is composed of by measuring the wavelengths of light they see (or the wavelengths of light missing from the spectrum). This is known as spectroscopy.