How the Diffraction Grating Equation Works
A diffraction grating is a surface ruled with many closely spaced, parallel slits or grooves. When light of wavelength λ passes through (or reflects off) the grating, each slit acts as a source of secondary wavelets. These wavelets interfere with each other, and bright fringes — called diffraction orders — appear only at the specific angles where light from every slit arrives in phase. This calculator uses the grating equation to find the diffraction angle, the physical slit spacing, the highest order the grating can produce, and where that order lands on a screen.
Deriving d sin θ = mλ
Consider two adjacent slits separated by distance d. Light leaving the two slits at angle θ from the grating's normal travels an extra path length of d sin θ compared to light from the neighboring slit. Constructive interference — a bright fringe — occurs whenever that extra path is a whole number of wavelengths: d sin θ = mλ, where m = 0, ±1, ±2, ... is the diffraction order. The m = 0 order is the undiffracted, straight-through beam; m = 1 is the first-order maximum, and so on. Because sin θ can never exceed 1, only a finite number of orders exist for a given d and λ — once m would push mλ/d above 1, the equation has no real solution and that order simply is not produced.
Line density, spacing, and units
Gratings are usually specified by how many lines (grooves) are ruled per unit length — commonly lines per millimeter, though some gratings are rated in lines per centimeter or lines per inch. The spacing between adjacent slits is the reciprocal of that density: d = 1/N. A 600 lines/mm grating, for example, has 1/600 mm ≈ 1667 nm between slits. This calculator converts wavelength and line density to a common nanometer/lines-per-mm basis internally, but when working by hand keep every quantity in compatible units — mixing micrometers with lines-per-inch without converting is a common source of order-of-magnitude errors.
Real-world applications
Diffraction gratings are the heart of spectrometers and monochromators, which spread light into its component wavelengths for spectroscopy, astronomy, and quality control in manufacturing. CDs and DVDs act as reflection gratings because their data tracks are regularly spaced grooves, which is why they show rainbow reflections under white light. Grating spectrometers use the fringe-position formula (y = L tan θ) to convert a diffraction angle into a physical distance on a detector or viewing screen, letting engineers pick the right detector spacing for a target wavelength range.