Understanding the diffraction grating calculator — concept and principle
A diffraction grating splits light into bright spots at specific angles that depend on the wavelength. This calculator finds the diffraction angle for a chosen order, the spot's position on a screen and how many orders appear.
How it is calculated
- Grating equation (normal incidence): d sin θ = mλ, with m = 0, ±1, ±2 …
- Line spacing d = 1 ÷ (lines per unit length).
- Highest existing order mmax = floor(d ÷ λ); spots on the screen = 2mmax + 1.
- Position on a flat screen at distance L: y = L tan θ.
The principle
Light from neighbouring slits travels slightly different distances to a point on the screen. Where the path difference d sin θ equals a whole number of wavelengths, the waves arrive in step and reinforce each other, producing a bright spot. With many slits the spots become very sharp, which is why gratings are used in spectrometers to separate wavelengths precisely. Because sin θ cannot exceed 1, only a limited number of orders exist.
Worked example
Default inputs: 600 lines/mm, λ = 532 nm (green laser), first order, screen at 100 cm.
- d = 1 ÷ 600 mm ≈ 1.6667 µm.
- sin θ = 1 × 0.532 ÷ 1.6667 ≈ 0.3192, so θ ≈ 18.61°.
- Spot position = 100 × tan 18.61° ≈ 33.68 cm from the centre.
- Highest order = floor(1.6667 ÷ 0.532) = 3; spots in total = 2 × 3 + 1 = 7.
| Grating lines per millimetre | Diffraction angle θ (°) |
|---|---|
| 150 | 4.58 |
| 300 | 9.18 |
| 450 | 13.85 |
| 600 | 18.61 |
| 750 | 23.52 |
| 900 | 28.61 |
| 1,200 | 39.67 |
How to read the result
Longer wavelengths diffract to larger angles, so white light spreads into a spectrum with red farthest out. Higher line densities give larger angles and better wavelength separation but fewer orders. Measuring y and L lets you work backwards to find an unknown wavelength.
Common mistakes
- Mixing nanometres and micrometres.
- Using lines per centimetre as lines per millimetre.
- Using the small-angle approximation y ≈ Lθ at large angles.
- Forgetting the central (m = 0) spot when counting spots.
Frequently asked questions
What is the grating equation?
d sin θ = mλ for light hitting the grating straight on.
How many orders can a grating produce?
All whole numbers m up to d ÷ λ, on both sides of the centre, plus the central spot.
How do I find wavelength with a grating?
Measure the angle (or y and L), then λ = d sin θ ÷ m.
Sources: Hecht, E., Optics, 5th ed. Pearson (diffraction gratings) · OpenStax, University Physics Volume 3, Section 4.4 Diffraction Gratings