🌈

Diffraction Gratings and Spectroscopy

Light from N illuminated slits of pitch d and width a interferes into sharp orders at d(sin θm − sin θi) = mλ. Follow a real lamp spectrum through a grating spectrometer and compare the ideal resolving power mN with what a finite entrance slit and a pixelated detector actually deliver.

Every slider has a number box • Hover a plot for a cursor readout • Click the detector plot to move the zoom
1/d 600 Lines per mm
N 3000 Illuminated slits
m 1 Detector order
mN 3000 Ideal resolving power
R Instrument λ/FWHM
δλ Instrument FWHM

Far-field angular intensity I(θ) Fraunhofer, scalar

Normalised so that the zero order of the whole source is 1 (line weights sum to 1). The strip above the axes shows the colour you would see on a distant screen; dashed markers are the orders of λc. Peaks narrower than a pixel are drawn at their true height (per-column maximum).

Hover the plot (or focus it and use ←/→, Shift = ×10) to read θ, I and the wavelength that each order puts there.

Detector: signal versus position, calibrated wavelength scale order 1

Bottom axis: position x on the detector (mm). Top axis: wavelength in the chosen order from λ = d[sin(θc + arctan(x/fcam)) − sin θᵢ]/m. The strip shows the true colour of all light reaching each pixel, so light from other orders appears in its own colour. Dashed: grating only (point slit); solid: after the slit image; steps: pixel signal. Each curve is peak-normalised: the slit and pixel stages conserve power but lower and widen the peaks (the CSV export holds the absolute pixel signal in zero-order units).

Hover (or focus and use ←/→) for x, pixel number and wavelength; click or press Enter to set the zoom centre.

Zoom: ideal grating versus instrument

Same three stages as the detector plot (dashed: grating only; solid: after the slit; steps: pixels, each peak-normalised) around the zoom centre, on the calibrated wavelength axis. Markers are the true line wavelengths.

Spectrometer layout schematic

Angles are measured from the grating normal, positive counter-clockwise. The camera axis points at order m of λc. Lengths are schematic; angles are to scale.

Pitch d / slit a
θm of λc
Propagating orders (λc)
Missing orders
Angular dispersion dθ/dλ
Reciprocal linear dispersion
Ideal R = mN
Rayleigh limit λ/(mN)
Grating FWHM (point slit)
Slit image w′ (in λ)
Pixel (in λ)
Instrument FWHM
Instrument λ/FWHM
Limited by
Free spectral range λc/m
N needed λ/(mΔλ)
Dip, ideal grating
Dip, detector pixels
Analytic vs direct sum

Orders of λc

Diffraction orders of the detector centre wavelength
m θm (°) Envelope sinc²(πma/d) dθ/dλ (mrad/nm) R = |m|N FSR λ/|m| (nm) Status
💡 How to Use

Learn with this tool

Learning objectives

  • Predict the angles, the missing orders and the angular dispersion of a grating from d, a, θᵢ and λ, and check them against the rendered pattern.
  • Derive the ideal resolving power λ/Δλ = mN from the array factor and use the Rayleigh criterion to decide whether two lines are resolved.
  • Separate the grating limit from the instrument limit: estimate the slit-image and pixel widths in wavelength units and name the factor that limits a real spectrometer.

Prerequisites

Model

A plane wave of vacuum wavelength λ falls at angle θᵢ on N slits of width a with centres d apart. In the far field (or the focal plane of a lens) every slit adds a phasor. The phase step between neighbouring slits is 2β, and the phase across one slit spans 2α:

I(θ)/I₀ = [sin α / α]² · [sin(Nβ) / (N sin β)]²,  α = πa(sin θ − sin θᵢ)/λ,  β = πd(sin θ − sin θᵢ)/λ

principal maxima: d(sin θm − sin θᵢ) = mλ,  propagating only if |sin θm| < 1

dθm/dλ = m/(d cos θm),  λ/Δλ = mN (Rayleigh),  FSR = λ/m

Sign convention. All angles are directions of travel measured from the grating normal, positive counter-clockwise, on the transmitted side. The zero order is the undeviated beam θ₀ = θᵢ, and a positive order is deviated towards larger θ.

N
number of coherently illuminated slits (beam width / d)
d, 1/d
grating pitch; groove density in lines/mm
a
transparent width of one slit (a ≤ d)
θᵢ, θm
incidence angle and angle of order m
m
diffraction order (integer)
w, w′
entrance slit width and its image on the detector, w′ = w (fcam/fcol) cos θᵢ / cos θm
p
detector pixel pitch
dx/dλ
linear dispersion fcam m/(d cos θm); its inverse is quoted in nm/mm

Assumptions and validity: scalar Fraunhofer diffraction with no obliquity factor and no polarization dependence; a perfectly periodic, infinitely thin amplitude grating in air; uniform, fully coherent illumination of N slits; incoherent sum over spectral lines. The spectrometer treats the entrance slit as an incoherent line source whose image adds a rectangle of width w′ (linearised about the camera axis), with ideal aberration-free lenses and a detector of 2048 square pixels with 100 % fill factor. The white-light continuum uses the order-integrated result, valid when the spectrum is smooth over λ/(mN) (the tool warns for N < 10).

Derivation: array factor, resolving power and instrument profile

Array factor. The slits sit at xn = nd. A far-field direction θ adds the phase k d(sin θ − sin θᵢ) = 2β per slit, so the field is a geometric series: Σn=0N−1 e2iβn = ei(N−1)β sin(Nβ)/sin β. Dividing by N normalises it to 1 at β = 0. Integrating across one slit multiplies by sin α/α.

Removable singularity. At every principal maximum β = mπ both sines vanish. Writing β = mπ + ε gives sin(Nβ)/(N sin β) = (−1)m(N−1) sin(Nε)/(N sin ε) → (−1)m(N−1). The code reduces β to ε first and uses 1 − (N² − 1)ε²/6 + … when |Nε| < 10⁻⁴, so the peaks are exactly 1 times the envelope.

Missing orders. The envelope vanishes at α = kπ. At order m, α/β = a/d, so α = πma/d, which is a multiple of π when m = k·d/a. Those orders are missing even though the grating equation allows them.

Resolving power. The first zero next to a principal maximum sits at Nε = π, a shift of Δ(sin θ) = λ/(Nd). A second line of wavelength λ + Δλ has its order-m peak shifted by mΔλ/d. Rayleigh's criterion puts the second peak on the first zero, so mΔλ/d = λ/(Nd), which gives λ/Δλ = mN. For equal lines the sum dips to 8/π² ≈ 81 % between the peaks; the tool uses that dip as its "resolved" test.

Dispersion and FSR. Differentiating d(sin θ − sin θᵢ) = mλ at fixed θᵢ gives d cos θ dθ = m dλ. The same angle carries λ in order m + 1 and λ + λ/m in order m, so a band wider than λ/m overlaps the next order.

Instrument profile. Each point of the entrance slit is an independent source at a slightly different θᵢ. Its spectrum is the same grating response shifted on the detector, so the recorded profile is the grating response convolved with the slit image (width w′), then integrated over each pixel (a second rectangle of width p) and sampled at the pixel centres. The widths add roughly in quadrature for similar sizes and the largest one wins otherwise. Only the first factor scales with N.

Exercise 1: resolving the sodium doublet

  1. The Na D lines are 588.995 and 589.592 nm. How many illuminated slits does a grating need to resolve them in first order? In second order?
  2. Press Na D, N = 500, then type N = 800, 1000, 1200 and 2000. Repeat at N = 600 with m = 2 (set λc = 589.3 nm).
  3. Read Dip, ideal grating and N needed. Find the smallest N that gives a dip.
  4. Why does going to second order halve N, and why does the dip appear gradually rather than suddenly?
Show answer

λ/Δλ = 589.3/0.597 ≈ 987, so N ≈ 990 in first order and ≈ 494 in second. For two equal lines the model first shows a dip near N ≈ 840 (0.85 of λ/(mΔλ)) and reaches the Rayleigh value 8/π² ≈ 81 % at N = 987. The real D1 line is only half as strong as D2, so it is swallowed by the flank of D2 until N ≈ 1100; with N = 1200 the dip is 60 % of the D1 peak. The phase step between slits at order m is 2πm, so a wavelength change shifts the peak m times further while the peak width depends only on N.

Exercise 2: missing orders

  1. With a = d/3 at 550 nm and 100 lines/mm, which orders vanish? What happens when a → d, and when a → 0?
  2. Press Missing orders. Then drag a/d to 0.999, 0.5 and 0.05.
  3. Read the envelope column and the Missing orders readout; check that the plotted peaks follow sinc²(πma/d).
  4. Why is a fully open aperture (a = d) not a grating at all?
Show answer

m = ±3, ±6, ±9, ±12, ±15, ±18 vanish (m = k·d/a with d/a = 3; |m| ≤ 18 propagate). At a = d the envelope zeros land on every order m ≠ 0: the transmission is uniform, so only the zero order (a single diffraction-limited beam) remains. At a = 0.5d every even order vanishes. As a → 0 the envelope flattens and all orders approach equal height, the limit of point sources.

Exercise 3: grating limit or slit limit?

  1. For the Slit-limited preset (N = 5000, 600 lines/mm, fcol = fcam = 500 mm), estimate the slit width at which the slit image equals the Rayleigh limit λ/(mN).
  2. Press Slit-limited, then reduce the slit from 300 µm in steps.
  3. Watch Limited by, Instrument FWHM and Dip, detector pixels. Note the slit width where the doublet reappears on the pixels.
  4. Why does increasing N not help once the slit dominates?
Show answer

λ/(mN) = 0.118 nm and dx/dλ = 0.321 mm/nm, so w′ ≈ 38 µm, which is w ≈ 35 µm after the cos θᵢ/cos θm = 1.07 anamorphic factor. The doublet (0.597 nm apart) reappears on the pixels once w′ ≲ 0.5 nm × 0.321 mm/nm ≈ 160 µm, i.e. w ≈ 150 µm. The slit image depends on w and the focal lengths, not on N, so a bigger grating only narrows the part of the profile that is already negligible.

Exercise 4: order overlap with white light

  1. A 300 lines/mm grating is used in second order for 400–700 nm. At what second-order wavelength does third-order violet (400 nm) start to overlap? What is the free spectral range at 400 nm in second order?
  2. Press White light overlap.
  3. Hover the detector near the red end and read the other-order wavelengths; find the step in the signal and read the overlap note under the readouts.
  4. How would an order-sorting filter fix this, and which filter?
Show answer

Overlap starts where 2λ₂ = 3 × 400 nm, λ₂ = 600 nm. From there to the red end the detector signal steps up because third-order 400–467 nm light (weaker: envelope 0.024 against 0.055, and λ/|m| per unit angle) lands on the same pixels as second-order red. The FSR at 400 nm in second order is 400/2 = 200 nm, so only 400–600 nm is free of overlap. A long-pass filter cannot remove 400–467 nm without also cutting the wanted band, so spectrometers split the range: a filter blocking λ < 470 nm is inserted when recording the 600–700 nm part.

Exercise 5 (limiting case): from one slit to a grating

  1. Choose Single line at 550 nm, 100 lines/mm, a/d = 0.3. Predict the angular pattern for N = 1, N = 2 and N = 10. How many weak secondary maxima lie between neighbouring orders?
  2. Type N = 1, 2, 3 and 10 with the angular plot set to Around the detector order m.
  3. Count the minima between orders 0 and 1 and read the width of the order-1 peak with the cursor.
  4. Which parts of the pattern belong to the slit and which to the lattice?
Show answer

N = 1 is the single-slit sinc² with no orders at all. N = 2 multiplies it by cos²β: Young's fringes. For N slits there are N − 1 zeros and N − 2 secondary maxima between neighbouring principal maxima, and the principal peak width (centre to first zero) is Δ(sin θ) = λ/(Nd). The envelope (zeros at sin θ = kλ/a) belongs to the single slit; the positions of the orders belong only to the lattice pitch d.

Worked example: a teaching spectrometer on the sodium doublet

A 600 lines/mm grating is illuminated over 2.0 mm at normal incidence. Collimator and camera both have f = 500 mm, the entrance slit is 20 µm and the pixels are 5 µm. Is the Na doublet (588.995/589.592 nm) resolved? Set N = 1200 and the values above (start from Na D, N = 2000) to check each step.

  1. d = 1/600 mm = 1.667 µm and N = 2.0 mm/d = 1200. First order: sin θ₁ = 589.3 nm/1.667 µm = 0.3536, θ₁ = 20.71°.
  2. Angular dispersion dθ/dλ = 1/(d cos θ₁) = 0.641 mrad/nm, so the lines are 0.383 mrad apart. Linear dispersion f dθ/dλ = 0.321 mm/nm (3.12 nm/mm): 192 µm on the detector.
  3. Ideal resolving power mN = 1200 > 987 needed, Rayleigh limit 0.491 nm. The grating-only FWHM is 0.886 λ/(mN) = 0.435 nm.
  4. Slit image w′ = 20 µm × (500/500) × cos 0°/cos 20.71° = 21.4 µm → 0.067 nm. One pixel = 5 µm → 0.016 nm. Both are well below 0.435 nm: this instrument is diffraction (grating) limited, with a measured FWHM of 0.437 nm, λ/FWHM ≈ 1350.
  5. The model gives a dip to 60 % of the weaker (D1) peak for the ideal grating and about 62 % on the pixels: resolved. Widening the slit to 200 µm makes w′ ≈ 0.67 nm and the dip disappears, although mN is unchanged.

When the model fails

  • Real groove profiles and blazing: reflection gratings with sawtooth grooves concentrate power into one order. The efficiency of each order then comes from rigorous (vector) electromagnetic theory, not from a sinc² envelope, especially when d is close to λ.
  • Polarization and Wood anomalies: near the angle where an order becomes grazing (|sin θ| → 1) the power redistributes abruptly and differently for TE and TM. The scalar model simply drops that order.
  • Obliquity and large angles: the scalar formula has no obliquity factor, so relative order heights at large θ are only approximate.
  • Partial coherence and finite beams: N is taken as uniformly and coherently illuminated slits. A Gaussian beam or a partially coherent source apodises the array factor, changing the side lobes and the exact FWHM (the peak positions stay).
  • Grating errors and aberrations: periodic ruling errors create ghosts, random errors add scattered light, and real lenses add coma and field curvature. Rowland-circle and Czerny–Turner layouts correct some of this.
  • Detector physics: the pixel signal has no noise, crosstalk or finite fill factor; see the radiometry tool for photon and read noise.

References

  • E. Hecht, Optics, 5th ed. (Pearson, 2017), §10.2.8 the diffraction grating and resolving power.
  • M. Born and E. Wolf, Principles of Optics, 7th ed. (Cambridge, 1999), §8.6 diffraction gratings.
  • C. Palmer and E. Loewen, Diffraction Grating Handbook, 8th ed. (MKS Newport, 2020), chapters on dispersion, resolving power and spectrometer bandpass.
  • J. James, Spectrograph Design Fundamentals (Cambridge, 2007): slit image, anamorphic magnification and sampling.
  • NIST Handbook of Basic Atomic Spectroscopic Data (Na, Hg and H wavelengths).