In short
A diffraction grating is a regular array of N parallel slits, spaced a distance d apart. Illuminated by monochromatic light of wavelength \lambda, it produces bright "principal maxima" at angles \theta satisfying the
where n is called the order of the maximum.
Between consecutive principal maxima there are N - 1 tiny secondary peaks and N - 1 dark minima — but with many slits, those side structures shrink to nothing. The angular width of each principal peak falls as 1/N, so a grating with thousands of slits produces pencil-thin bright lines at the orders' positions.
Resolving power — the smallest wavelength difference the grating can separate in the n-th order:
A 10,000-line grating used in the third order resolves wavelengths to one part in 30,000 — the reason gratings are the standard tool of spectroscopy, from the laboratory bench to the spectrographs ISRO flew to the Sun and the Moon.
Hold a compact disc flat under a ceiling light. Tilt it slowly. A smear of colour fans out across the shiny surface — red here, green there, blue at the far edge — in a clean linear sequence you can reproduce every time you tilt the disc the same way. The CD is not pigmented; it is a metallic mirror. The colours are not reflected colours; they are diffracted colours. You are looking at a reflection grating: the spiral data track of the CD is a set of regularly spaced grooves, and each groove acts like a slit in the single-slit and double-slit experiments. With thousands of grooves, the pattern becomes a spectrum.
This is a diffraction grating. Take the double-slit idea and keep adding slits. With two slits you get bright fringes equally spaced at d\sin\theta = n\lambda. With twenty slits the fringes are still at the same angles, but each fringe is now ten times sharper. With twenty thousand slits they are ten thousand times sharper — sharp enough that two spectral lines of sodium, whose wavelengths differ by 0.6 nm, stand cleanly apart.
Gratings are how astronomers read what stars are made of. The spectrograph on ISRO's Aditya-L1 mission, launched in 2023 to study the Sun from the L1 Lagrange point, uses a reflection grating to split solar ultraviolet light into its wavelength components. The Kodaikanal Solar Tower at the Indian Institute of Astrophysics has been photographing the Sun's spectrum through gratings since 1909 — its archive of a century of grating spectra is one of the longest solar datasets in the world. Understanding how a grating works is understanding how an entire branch of science takes its measurements.
From two slits to N — the bright-fringe condition
In the double-slit experiment, bright fringes occur when the path difference between the two slits is a whole number of wavelengths: d\sin\theta = n\lambda. That condition came from demanding that the two waves arrive in phase.
Now add a third slit, evenly spaced a distance d from the second. The path difference between slit 1 and slit 2 is d\sin\theta. The path difference between slit 2 and slit 3 is the same d\sin\theta. So the path difference between slit 1 and slit 3 is 2d\sin\theta — also a whole number of wavelengths if d\sin\theta = n\lambda. All three waves arrive in phase.
Add a fourth slit. Same story. The path difference between slit 1 and slit k is (k-1)\cdot d\sin\theta, which is a whole number of wavelengths whenever d\sin\theta is. So at the angles \theta where d\sin\theta = n\lambda, all N waves arrive simultaneously in phase, regardless of N. The principal bright fringes sit at the same angles the double slit put them — but they are now the sum of N amplitudes, not two.
So the grating equation is the same shape as the double-slit equation:
Each integer n names an order. The n = 0 order is the undeflected bright spot straight through the grating. The n = \pm 1 orders are the first-order principal maxima, one on each side. The n = \pm 2 orders are the second-order maxima, at larger angles. The number of visible orders is limited by the requirement |\sin\theta| \leq 1, which gives |n| \leq d/\lambda.
The surprise of the grating is not the position of the peaks. It is their sharpness.
Why the peaks get sharp — the N-slit intensity
Between the principal maxima, the N waves are not in phase. Their amplitudes partially cancel. With just two slits, there is only one way they can fail to add in phase — half a wavelength out of phase — and you get one dark fringe in between. With N slits, there are many ways to get cancellation, and most of the region between the maxima is dark.
Start with the key observation: at a principal maximum, all N waves add in phase. So the amplitude is N times the amplitude from one slit, and the intensity (which goes as amplitude squared) is N^2 times the single-slit intensity.
Now slide the angle off the principal maximum a tiny bit. Let the phase difference between neighbouring slits — instead of being 2\pi n — now be 2\pi n + \delta, where \delta is small. The phases across the N slits spread evenly from 0 to (N-1)\delta. The waves no longer add all in phase; they add around a polygonal arc.
The total amplitude E_\text{tot} from N evenly phased waves can be summed with the geometric-series identity:
Why: the sum 1 + r + r^2 + \cdots + r^{N-1} = (r^N - 1)/(r - 1) for any r \neq 1. Here r = e^{i\delta}. After factoring out e^{i(N-1)\delta/2} from numerator and denominator symmetrically, both turn into 2i\sin(\cdot) terms, and the 2is cancel.
The intensity is the magnitude squared:
Here I_1 is the intensity a single slit would send in the same direction. The relation between \delta and the angle \theta is \delta = (2\pi/\lambda)d\sin\theta.
This formula describes everything the grating does. Let us read it.
Principal maxima — the bright orders
When \delta = 2\pi n, both the numerator \sin(N\delta/2) = \sin(N\pi n) and the denominator \sin(\delta/2) = \sin(\pi n) vanish. The ratio is indeterminate, but L'Hôpital's rule (or a direct Taylor expansion) gives \lim_{\delta\to 2\pi n}(\sin(N\delta/2)/\sin(\delta/2)) = N. So
The intensity at a principal maximum is N^2 times the single-slit intensity. A grating of 10,000 slits produces principal maxima that are 100 million times brighter than a single slit — and a correspondingly sharper dark background between them.
Subsidiary minima — where the grating goes dark
Between principal maxima, the numerator \sin(N\delta/2) passes through zero while the denominator \sin(\delta/2) stays finite. The numerator is zero when N\delta/2 = m\pi for integer m, that is, when
The values m = N, 2N, 3N, \ldots correspond to the principal maxima themselves (they are the cases where the denominator also vanishes). The values m = 1, 2, \ldots, N-1 between two neighbouring principal maxima are the subsidiary minima — perfectly dark points between the principal peaks.
So between any two consecutive principal maxima there are exactly N - 1 dark lines and N - 2 very weak subsidiary bright lines. For large N, the weak subsidiary lines are essentially invisible compared to the towering N^2 principal peaks.
Width of a principal maximum — the 1/N rule
The first subsidiary minimum adjacent to a principal maximum at \delta = 2\pi n sits at \delta = 2\pi n + 2\pi/N. So the angular width (from peak to first zero) corresponds to a phase shift of 2\pi/N, which translates through \delta = (2\pi/\lambda)d\sin\theta to
For small angles, \sin\theta \approx \theta, so the angular half-width is
Key insight: the width of each principal peak is inversely proportional to N. Double the number of slits, halve the line width. This is the superpower of a grating: more slits mean sharper lines.
Explore the slit count
Drag the slider below to change the number of slits N from 2 to 50, with spacing d and wavelength \lambda fixed so that d/\lambda = 1.5. The full intensity (\sin(N\delta/2)/\sin(\delta/2))^2 plotted against d\sin\theta / \lambda redraws in real time.
Notice how quickly the peaks sharpen: by N = 10, each peak is a thin spike and the subsidiary ripples between them are barely visible. By N = 50, the pattern is effectively three vertical lines separated by pure darkness. The grating has turned the continuous "interference" of two slits into the discrete "spectrum" of many.
Why a grating makes spectra — multiple colours, multiple angles
The grating equation d\sin\theta = n\lambda contains the wavelength. Send through light of two different wavelengths — a longer wave \lambda_\text{red} and a shorter wave \lambda_\text{blue} — and the red maxima sit at larger angles than the blue maxima. The zeroth order (n = 0) is white, because d\sin 0 = 0 regardless of \lambda. But the n = \pm 1 and higher orders are rainbows, with red at the outer edge and blue at the inner edge.
For white light (containing all wavelengths \sim 400–700 nm), the first-order band is a continuous rainbow. This is why a CD, a DVD, a Blu-ray disc, or a finely scratched piece of metal throws rainbows on a white wall when light catches it at the right angle. It is the grating doing what a grating always does.
In a laboratory spectrometer, the incoming light first passes through a narrow slit to produce a clean beam, then through (or onto) a grating, then onto a screen or camera. Each wavelength in the light is diffracted to a specific angle by the grating equation; the camera records the spectrum as a one-dimensional map of angle. A sodium vapour lamp produces a pair of bright lines in the yellow at 589.0 nm and 589.6 nm — the famous sodium doublet. The two lines' angular separation in the n-th order of a grating of spacing d is
Whether the two lines are separable or blend into one blob depends on whether \Delta\theta is larger or smaller than the angular width \Delta\theta_\text{peak} = \lambda/(Nd\cos\theta) of a single peak. Setting them equal gives the criterion for just separable:
The smallest wavelength difference a grating can resolve is \Delta\lambda_\text{min} = \lambda/(nN). Inverting gives the resolving power:
This is an astonishingly clean result. The resolving power depends only on two numbers: the order n you are looking at, and the total number of illuminated slits N. Not on the wavelength, not on the spacing, not on the angle. A grating ruled with 600 lines per millimetre over a usable width of 50 mm has N = 30{,}000 lines — in the second order it resolves \lambda/\Delta\lambda = 60{,}000, which separates wavelengths differing by about 0.01 nm at visible wavelengths. That is sharp enough to see the two sodium-doublet lines effortlessly, sharp enough to measure stellar radial velocities, sharp enough to identify the molecules in an exhaled breath by which infrared transitions they absorb.
Worked examples
Example 1: A 600-line-per-millimetre grating in a school lab
A diffraction grating has 600 lines per millimetre. It is illuminated by monochromatic sodium light of wavelength \lambda = 589 nm. Find the angles of the first- and second-order principal maxima, and determine whether the third order is visible.
Step 1. Find the slit spacing d.
Why: the number of lines per millimetre is the inverse of the spacing between them. 600 lines/mm means neighbouring lines are 1/600 mm apart.
Step 2. Solve d\sin\theta_1 = \lambda for the first-order angle.
Why: the first order sits wherever the path difference between neighbouring slits is one full wavelength. At 20.7° from the straight-through direction, every slit is \lambda ahead of the previous one, and all waves add in phase.
Step 3. Solve d\sin\theta_2 = 2\lambda for the second-order angle.
Why: the second-order maximum occurs where the path difference is two wavelengths. The sine value happens to be \sqrt{2}/2, which your calculator identifies as exactly 45° — a coincidence, not a law, but a pretty one.
Step 4. Check whether the third order exists.
Since \sin\theta cannot exceed 1, the third order does not exist at this wavelength with this grating. A grating with smaller d (more lines per mm) would cut off even earlier; a grating with larger d (fewer lines) would admit more orders.
Why: the physical meaning — the grating equation d\sin\theta = n\lambda requires |n| \leq d/\lambda. Here d/\lambda = 1.667/0.589 = 2.83, so only n = -2, -1, 0, +1, +2 are allowed.
Result: First-order at \theta_1 = 20.7°, second-order at \theta_2 = 45°, third-order not visible.
What this shows: A grating of modest line density (600 lines/mm — readily available in any school optics kit) deflects sodium light by tens of degrees. The high diffraction angle is what makes a grating useful: small wavelength differences become measurable angular differences a human can see with a travelling microscope.
Example 2: Resolving the sodium doublet
The sodium D-lines are two closely spaced yellow lines at \lambda_1 = 589.00 nm and \lambda_2 = 589.59 nm — a wavelength difference \Delta\lambda = 0.59 nm. What is the minimum number of illuminated slits N that a grating must have to resolve these two lines in the first order?
Step 1. Use the resolving-power formula R = nN.
Why: for "just resolved" by Rayleigh's criterion, the resolving power must at least equal \lambda/\Delta\lambda. Use the average wavelength (589.00 + 589.59)/2 \approx 589.3 nm in the numerator, since \Delta\lambda \ll \lambda and the difference is negligible.
Step 2. Solve for N with n = 1.
Why: in the first order (n = 1), the grating's resolving power equals the number of slits. You need at least 1000 illuminated slits to separate the two D-lines.
Step 3. How wide a grating does 1000 slits require?
If the grating has 600 lines per mm (as in Example 1), then 1000 slits occupy 1000/600 = 1.67 mm. The incoming beam must illuminate at least this width of grating.
Why: N in the formula is the number of illuminated slits, not the total engraved on the substrate. A 10-cm-wide grating illuminated over only 1 mm of its width acts as a 600-slit grating in the formula.
Step 4. Going to higher order.
In the second order (n = 2), the same grating has R = 2N. The required slit count drops to N = R/n = 999/2 \approx 500 — a 500-slit grating in second order is as sharp as a 1000-slit grating in first order. Gratings used near their highest usable order give the most resolution for their physical size.
Result: About 1000 illuminated slits are needed in the first order; about 500 in the second order.
What this shows: Resolving the sodium doublet — a measurement that used to require a large prism spectroscope — falls to a grating the size of your thumbnail. The same principle scales: the Echelle spectrograph on the Keck telescope uses a grating of \sim 30{,}000 lines at high order, giving R \sim 100{,}000, which separates velocity shifts of a few metres per second on stellar spectra — enough to detect an Earth-like planet tugging its star.
Common confusions
-
"A grating is just a double slit with more slits." It is, but the consequence is qualitatively different. Two slits produce a sinusoidal fringe pattern — half light, half dark, graded smoothly. A grating with many slits produces discrete peaks separated by darkness — a spectrum, not a fringe pattern. The transition from "interference" to "diffraction" language happens around N \sim 5.
-
"The grating equation's n is the same as the single-slit equation's n." Same letter, opposite meaning. In the single-slit formula a\sin\theta = n\lambda, n labels the minima (dark bands). In the grating formula d\sin\theta = n\lambda, n labels the principal maxima (bright bands). Both come from path-difference arguments but for different combining waves.
-
"A wider grating always has higher resolving power." Only if you illuminate all of it. R = nN uses the illuminated slit count. Shining a narrow laser beam onto one corner of a 10 cm grating only uses a fraction of the slits — and your effective resolving power is correspondingly lower.
-
"Higher orders are just dimmer copies of the first order." They carry different information. Each order is its own spectrum; wavelengths that overlap in the first order (for example, \lambda = 700 nm in order 1 lands at the same angle as \lambda = 350 nm in order 2) must be separated by a filter or a second grating. But higher orders give higher resolution (R = nN), which is why spectroscopists often work in orders 30 or 50 with Echelle gratings.
-
"Reflection gratings and transmission gratings are different physics." No — the same grating equation applies, with the path difference now measured on the reflection side. A CD is a reflection grating; a ruled transmission grating on glass is a transmission grating; both satisfy d(\sin\theta_i + \sin\theta_d) = n\lambda (where \theta_i and \theta_d are the incidence and diffracted angles measured from the normal).
-
"The grating equation gives the exact positions of all bright lines." It gives the positions of the principal maxima. Between them there are N - 2 much weaker subsidiary maxima — usually invisible but real, and occasionally an issue in ultra-high-resolution measurements.
If you came here to learn the grating equation, use it to solve problems, and understand resolving power, you have what you need. What follows is the blazing-grating efficiency argument, the connection to the single-slit envelope, and the Echelle geometry used in astronomical spectrographs.
The single-slit envelope — why some orders are dim
A real grating has slits of finite width a, not line sources. Each slit independently produces a single-slit diffraction pattern with angular scale \lambda/a. The total intensity from a grating of N slits of width a spaced d apart is the product of the single-slit diffraction envelope and the grating interference function:
where \beta = \pi a \sin\theta/\lambda is the single-slit phase and \delta = 2\pi d\sin\theta/\lambda is the between-slit phase.
Missing orders. If the single-slit envelope (\sin\beta/\beta)^2 has a zero at the same angle where the grating function has a principal maximum, that order disappears. The envelope is zero when \beta = m\pi, i.e. a\sin\theta = m\lambda. The grating maximum of order n is at d\sin\theta = n\lambda. Dividing, if d/a = n/m at any integer ratio, the n-th order is killed by the m-th single-slit zero. Most common: d = 2a (slits half the grating period) kills every even-order maximum.
Blazed gratings. In a real reflection grating, the shape of each individual ruled groove determines where the single-slit envelope concentrates its light. By tilting each groove at a precise angle (the blaze angle), the maximum of the single-slit envelope can be steered onto a chosen order — say the third. A grating "blazed for 500 nm in third order" has almost all its diffracted intensity in that order at that wavelength, and very little in the zeroth or first. Efficiency of 80% in the chosen order is routine. This is how space spectrographs concentrate precious photons.
The Echelle grating — high-resolution spectroscopy
A standard grating typically uses n = 1 or n = 2, with d much larger than \lambda so the diffraction angles are moderate. An Echelle grating inverts this: it uses very high orders, typically n = 30 to n = 100, and works at grazing angles where \sin\theta is close to 1.
From R = nN, a 30,000-slit Echelle working at n = 60 has R = 1.8 \times 10^6 — enough to resolve \lambda/\Delta\lambda of nearly two million, or wavelength shifts of 10^{-6} \lambda. At optical wavelengths this corresponds to Doppler velocities of
with interferometric tricks pushing the floor down to the 1 m/s level where rocky extrasolar planets begin to show up in stellar radial velocities. The HARPS and ESPRESSO instruments on the La Silla and Paranal telescopes are Echelle spectrographs of this class. India's own GIRAFFE and PARAS-2 spectrographs at the Mount Abu observatory use similar Echelle designs to measure stellar velocities for exoplanet searches.
Free spectral range — the overlap problem
Because each order is a complete spectrum, high orders overlap: the red end of order n lands at the same angle as the blue end of order n+1. The wavelength window \Delta\lambda_{\text{FSR}} within one order that does not overlap with the next is called the free spectral range:
At order n = 1, the free spectral range is the full wavelength (so there is no overlap — first-order spectra are clean). At n = 60, the free spectral range is \lambda/60 \approx 10 nm at visible wavelengths: you see only a tiny slice of the spectrum before the next order crosses it. Echelle spectrographs therefore use a cross-disperser — a second, lower-order grating placed perpendicular to the Echelle — to spread the overlapping orders onto different parts of a two-dimensional detector, producing the characteristic stepped-spectrum image of modern spectrographs.
Gratings as Fourier analysers
Here is a perspective that unifies everything. The intensity pattern from a grating is the squared modulus of the Fourier transform of the grating's transmission function. A grating of N equal slits of width a spaced d apart has a transmission function that is a comb of N rectangles. Its Fourier transform is the product of a \text{sinc} (from each rectangle) with a Dirichlet kernel (from the comb of N points) — exactly the two factors in the intensity formula above.
A continuously varying transmission pattern produces a continuously varying diffraction pattern: any wave-shape in the transmission domain produces its Fourier transform on the screen. Holograms, computer-generated diffractive optical elements, and the Fourier-transform spectrometer all exploit this fact. The grating is the simplest periodic case, but the principle is completely general — far-field diffraction is the Fourier transform, and each diffraction pattern teaches you the spatial frequencies in the object that produced it.
Where this leads next
- Diffraction — Single Slit — the one-slit pattern that modulates the grating's orders, and the origin of the \sin\alpha/\alpha envelope.
- Young's Double Slit Experiment — the N = 2 case, which already contains the principal-maxima condition but without the sharpness.
- Resolving Power of Optical Instruments — the Rayleigh criterion in full, and how diffraction sets the resolution limit of every microscope and telescope.
- Scattering of Light — a related wave-optical phenomenon (not interference of ordered sources, but scattering off disordered particles), responsible for the blue sky and the red sunset.
- Coherence and Conditions for Interference — why monochromatic and coherent light is required for a grating to produce sharp peaks.