Diffraction Grating Back
Wave Optics / Interference & Diffraction

Diffraction Grating Simulator

Adjust grating spacing, wavelength, incident angle, and number of slits to compute diffraction angles, angular dispersion, and resolving power in real time. Animated white light rainbow dispersion on canvas.

Parameters
Grating Spacing d (µm)
µm
Wavelength λ (nm)
nm
Incident Angle θi (°)
°
Number of Slits N
Selected Order m
Diffraction Order m
All Orders (m = −3 to 3)
Order mθm (°)Valid
Results
Diffraction Angle θm (°)
Angular Disp. (°/nm)
Resolving Power R
Min. Resolvable δλ (nm)
Intensity Pattern (Angle vs Relative Intensity)
White Light Rainbow Dispersion (m = 1, Canvas)

First-order (m=1) white light dispersion — diffraction angles for 380–780 nm color-coded by wavelength

Theory & Key Formulas

$$d(\sin\theta_m - \sin\theta_i) = m\lambda$$

Angular dispersion: $\dfrac{d\theta_m}{d\lambda}=\dfrac{m}{d\cos\theta_m}$

Resolving power: $R=mN$

What is a Diffraction Grating?

🙋
What exactly is a diffraction grating? It sounds like a fancy filter.
🎓
Basically, it's a surface with a huge number of parallel, equally spaced grooves. When light hits it, each groove acts like a tiny source of light waves. These waves interfere with each other, creating a pattern of bright and dark spots. In the simulator above, you can see this pattern change in real-time as you adjust the Grating Spacing (d) slider.
🙋
Wait, really? So the bright spots are the "orders" mentioned in the tool? What determines where they appear?
🎓
Exactly! The position of those bright spots, or diffraction orders, is governed by a precise condition. For instance, if you shine a red laser (λ = 650 nm) on a grating with 1000 lines/mm (d = 1 µm), the first-order red spot appears at a specific angle. Try it in the simulator: set λ to 650 and d to 1.0, and watch the angle for m=1. The governing rule is the Grating Equation.
🙋
Okay, I see the equation. But why are some orders brighter than others? And what does the Number of Slits (N) control do?
🎓
Great question! The Grating Equation tells us where the bright spots are, but N controls how sharp they are. More slits mean the waves interfere more precisely, making the bright peaks narrower and more defined. Slide N up and down—you'll see the peaks get sharper or broader. This sharpness is crucial for the grating's Resolving Power, its ability to distinguish two very close wavelengths.

Physical Model & Key Equations

The core of diffraction grating physics is the condition for constructive interference. When the path difference between light from adjacent slits is an integer multiple of the wavelength, the waves add up to create a bright fringe (a diffraction order).

$$d(\sin\theta_m - \sin\theta_i) = m\lambda$$

d: Grating spacing (distance between adjacent slits). θi: Incident angle of the light. θm: Diffraction angle for order m. m: Diffraction order (0, ±1, ±2...). λ: Wavelength of the light.

Two key performance metrics derived from the grating equation are Angular Dispersion and Resolving Power. Dispersion tells us how much the angle changes for a given change in wavelength, which is vital for separating colors. Resolving power defines the smallest wavelength difference the grating can distinguish.

$$\text{Angular Dispersion: }\frac{d\theta_m}{d\lambda}=\frac{m}{d\cos\theta_m}\quad \quad \text{Resolving Power: } R = mN$$

A higher m (order) or a smaller d (spacing) increases dispersion, spreading the spectrum more. The resolving power R increases with both the order m and the total N (number of illuminated slits), making spectral lines sharper and more separable.

Frequently Asked Questions

White light is a mixture of light of various wavelengths. According to the grating equation d(sinθm - sinθi) = mλ, the diffraction angle θm depends on the wavelength λ, so light of different wavelengths is diffracted at different angles. As a result, the diffracted light of each order appears separated into rainbow colors.
Increasing the number of slits N improves the resolution R = mN, allowing for the separation of slight differences in wavelength. At the same time, the width of the principal maxima (bright lines) becomes narrower, resulting in sharper and clearer interference fringes. However, the overall brightness increases in proportion to the number of slits.
In the grating equation d(sinθm - sinθi) = mλ, changing the incident angle θi alters the diffraction angle θm even for the same order m and wavelength λ. For example, increasing the incident angle continuously changes the angles of diffracted light other than the zero order, and in some cases, specific orders may no longer be observable.
To maximize the resolution R = mN, increase the order m or the number of slits N. To increase the order m, reduce the grating spacing d or increase the wavelength λ, but note that the light intensity decreases at higher orders. Additionally, setting the incident angle appropriately allows efficient extraction of higher-order diffracted light.

Real-World Applications

Spectroscopy: This is the most critical application. Gratings are the heart of spectrometers used in chemistry labs to identify materials, in astronomy to determine the composition and velocity of stars, and in environmental monitoring to detect pollutants. They separate light into its constituent wavelengths with high precision.

Laser Tuning & Pulse Compression: In advanced optics labs, diffraction gratings are used inside lasers to select a specific output wavelength. They are also key components in systems that compress ultra-short laser pulses, which is essential for cutting-edge research in physics and biology.

Optical Telecommunications (DWDM): Dense Wavelength Division Multiplexing (DWDM) systems use diffraction gratings (often in the form of arrayed waveguide gratings) to combine and separate dozens of different data-carrying laser channels in a single optical fiber, vastly increasing data capacity.

Consumer Electronics: The reflective, rainbow-colored patterns on CDs, DVDs, and Blu-ray discs are a form of diffraction grating. The data is stored in a spiral track of microscopic pits, which acts as a reflective grating when illuminated by white light.

Common Misconceptions and Points to Note

First, note that "making the grating spacing d too small does not mean everything will be seen clearly." While reducing d does increase angular dispersion and sharpen color separation, real diffraction gratings have a design parameter called the "blaze angle," optimized to concentrate light energy into a specific order (e.g., m=1). If you set d to an extremely small value (e.g., below 0.5µm) in the simulator and use a high order (m), higher-order images (like m=5) may appear in theory. However, in actual spectrometers, these higher-order beams are often very dim and impractical. Always be mindful of the trade-off between "brightness" and "resolution."

Next, the rainbow you see in the white light simulation is not just the 'first-order spectrum'. If you press the white light button and switch to, say, m=2, you should see the rainbow spread out even further. This is the 'second-order spectrum'. In fact, in these higher-order rainbows, "spectral overlap" occurs where long-wavelength red from one order overlaps with short-wavelength violet from the next order. For example, with visible light (400-700nm), light of 700nm for m=2 and light of 467nm for m=3 can emerge at the same angle. When designing a spectrometer, you need to consider the concept of "free spectral range" to avoid this overlap.

Finally, not all the 'bright fringes' on the simulator have the same intensity. This tool prioritizes understanding and indicates angles of constructive interference with lines. However, the actual light intensity distribution is limited by the envelope of diffraction from a single slit. Typically, the center (m=0) is brightest, and intensity decreases for higher orders. Also, the change in the "sharpness of the interference fringes" due to the finite total number of slits N is a key point. With fewer N, the fringes blur; with more N, they sharpen. The resolution formula R=mN represents this effect of N.

How to Use

  1. Enter grating spacing (d) in micrometers—typical diffraction gratings range 0.5–2 µm for visible light applications.
  2. Set wavelength (λ) between 400–700 nm using the slider; longer wavelengths produce wider diffraction patterns.
  3. Adjust observation angle (θ) to calculate diffraction order positions where intensity maxima occur at d·sin(θ) = m·λ.
  4. Specify the number of slits (N) to determine resolving power R = m·N; more slits sharpen spectral lines.
  5. Read diffraction angle, angular dispersion (°/nm), resolving power, and minimum resolvable wavelength difference from output labels.

Worked Example

Consider a reflection grating with d=1.67 µm (600 grooves/mm), observing 632.8 nm He-Ne laser light in first order (m=1). The grating equation yields sin(θ)=632.8/1670≈0.379, so θ≈22.3°. With N=1800 slits total, resolving power R=1×1800=1800, giving minimum resolvable separation δλ=632.8/1800≈0.35 nm. Angular dispersion dθ/dλ=m/(d·cos(θ))≈0.408°/nm, enabling detection of sodium doublet splitting (589.0/589.6 nm).

Practical Notes

  1. Grating equation d(sin(θ_m)−sin(θ_i))=m·λ assumes normal incidence; oblique angles require modified geometry.
  2. Higher orders (m=2,3) suffer reduced intensity due to diffraction envelope effects; blazed gratings concentrate light into preferred orders.
  3. Resolving power degrades significantly near grating edges where effective slit count drops; center 80% of the grating aperture yields best results.
  4. Temperature changes alter grating spacing by ~5×10⁻⁶ per °C for aluminum substrates; precision spectroscopy requires thermal stabilization.