Multiple slits create sharp interference orders
A diffraction grating is a periodic array of many slits (or reflective grooves) spaced at regular intervals. Light passing through produces interference patterns sharper than a double-slit experiment because N slits contribute coherently. The constructive interference condition is d sin(theta) = m lambda, where d is the slit spacing, m is the order (0, 1, 2, ...), and lambda is the wavelength. At the angles satisfying this condition, light from all N slits arrives in phase and adds constructively, producing bright maxima. Between these maxima are dark minima where light from adjacent slits cancels. With hundreds or thousands of slits, the maxima become very narrow and bright, and each wavelength is diffracted to its own angle. This is why gratings are used in spectrometers and spectrographs: white light is spread into a sharp spectrum where each color appears at a precise angle determined by its wavelength.
Spectroscopy and modern applications
Transmission and reflection gratings are the workhorse dispersive elements in spectroscopy. A spectrograph with a grating can analyze light from stars, galaxies, or laboratory samples, revealing absorption or emission lines that indicate chemical composition and physical conditions. Holographic gratings, made by recording an interference pattern in photoresist, can have extremely fine line spacing and custom blazing (optimizing intensity in a particular order). Gratings are also used in wavelength-division multiplexing for fiber-optic communications: different wavelengths are combined onto a single fiber at a grating, transmitted, and then separated at the destination by another grating. The sharpness and efficiency of gratings make them superior to prisms for most applications where high spectral resolution is needed.