← Back to Prism Riddle

Diffraction Grating Simulator: Orders, Color and Energy

A grating creates several possible diffraction directions. Explore their angles and colors with a clearly defined three-order model, then inspect the power on each screen.

Try the diffraction experiment

Free, live optical simulation. Change one setting and observe the result.

The controls and explanation below describe this experiment. A browser with Canvas support is required to draw the rays.

Preparing the optical trace…

Open this setup in Free lab →

Only transmission orders −1, 0, +1 are included, with prescribed power efficiencies 40/20/40. Their angles obey the grating equation; groove microstructure and inter-order interference are not modeled.

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

  1. Begin at 600 lines per millimeter with the White source.
  2. Look for the central zero-order beam and the two first-order spectra.
  3. Choose the −1, 0 or +1 detector readout to inspect that screen's measured wavelengths.
  4. Change line density. The screens remain in fixed positions, so a moving spectrum may no longer fit on them.
  5. 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.

Frequently asked questions

Does a grating bend red more than blue?

At normal incidence, the magnitude of the same nonzero diffraction order angle increases with wavelength. The zero order is not dispersed.

Are the 40/20/40 efficiencies real measurements?

No. They are the explicitly prescribed power fractions of this ideal three-order element. Real grating efficiencies depend on construction and operating conditions.

Why does a detector lose power when line density changes?

The screens are fixed while diffraction directions move. Some light can miss a screen or leave the scene.

What does unresolved order mean?

An assigned order has no propagating direction for the selected incidence and period. Its power is left unresolved and the trace is not marked complete.

Can I use higher diffraction orders?

Not in this model. Only −1, 0 and +1 are included; it is not a full wave or groove-microstructure solver.

Play the first three chambers free →