What is a diffraction grating?
A diffraction grating is a periodic optical structure that directs light into discrete orders. Wavelength and the spacing between repeated features determine the possible outgoing directions. A prism uses refraction through material surfaces; a grating uses periodic structure. The two devices therefore separate colors in different ways.
At normal incidence in air, the direction of order m satisfies d sin θ = mλ, where d is the grating period and λ is wavelength. The zero order continues straight. Positive and negative orders lie on opposite sides. Within the same nonzero order, a longer wavelength has a larger angle. Reference: OpenStax on diffraction gratings.
Use the simulator
- Begin at 600 lines per millimeter with the White source.
- Look for the central zero-order beam and the two first-order spectra.
- Choose the −1, 0 or +1 detector readout to inspect that screen's measured wavelengths.
- Change line density. The screens remain in fixed positions, so a moving spectrum may no longer fit on them.
- Switch to a red or blue source band and compare its nonzero-order direction.
The three detector screens absorb the rays they receive. A lower readout can mean that part of the beam misses a screen; it does not automatically mean the grating absorbed that power. The numerical spectrum table distinguishes wavelength content from the visible brightness of the drawing.
Line density and the grating equation
At 600 lines/mm, the period is 1/600 mm, or about 1666.7 nm. A 550 nm sample in the first order has sin θ = 550/1666.7 = 0.33, giving an angle of approximately 19.27°. The matching negative order has the opposite signed angle.
Rotating a grating changes the incident tangential component as well. In the code's signed surface basis, sin θout = sin θin + mλ/d. The simple normal-incidence formula is a special case. If the right-hand side has magnitude greater than one, that assigned order has no propagating direction in this model.
Which parts are idealized?
This is a defined three-order transmission element, not a microscopic simulation of a manufactured grating. It includes only m = −1, 0 and +1. The prescribed nominal power fractions are 40%, 20% and 40%, respectively. These fractions add to one; they are not calculated from groove depth, blaze angle, duty cycle, coating or polarization.
Real gratings can have other orders and wavelength-, angle- and polarization-dependent efficiencies. Those details are outside this experiment. If one of the assigned orders cannot propagate, its allocated power is reported as unresolved. The program does not silently redistribute it or claim a complete solution.
Why is the central order white?
For m = 0, the grating equation leaves the incident tangential direction unchanged for every sampled wavelength. The White source therefore remains overlapped in the central branch. The first orders separate the wavelengths spatially, so their screens show different positions for different colors.
The source has 27 discrete wavelength samples, rather than an infinitely resolved spectrum. The graph uses their actual wavelength positions and exposes the data in a table. In the default arrangement, the complete −1 and +1 branches each carry 0.4 power units and the zero branch carries 0.2, before any clipping or downstream loss.
Ideas for a light-routing experiment
Open the setup in Free lab to reposition the screens or add a mirror after one branch. Try catching only a portion of a dispersed order, then compare the lost colors in the detector table. A filter can remove unwanted wavelengths, but it cannot move a missed ray back onto a receiver.
To compare with material refraction, place a prism in a separate experiment. In our normally dispersive prism model, shorter wavelengths bend more; the first-order grating angle at normal incidence instead grows with wavelength. These are different physical mechanisms, not two skins for the same tool.
The formal Prism Riddle campaign remains 80 chambers. This new component is available in Free lab and independent experiments first. See the spectral detector guide for measurement limits and the light-guide experiment for a different way of routing light.