# Fun with Diffraction Gratings

A laser beam passing through a transmission diffraction grating straight on gives the standard diffraction pattern we all know and love.  It's a bit more interesting, though, if the beam hits the grating at an angle:

figure 1

Most intro optics books cover this situation, and the result is (equation 1):

$a[\sin(\theta_{m}) - \sin(\theta_{i})] = m\lambda$

where $a$ is the grating spacing, $\theta_{m}$ is the angle of the mth maxima, $\theta_{i}$ is the incident angle, $m$ is the maxima order, and $\lambda$ is the wavelength. We can rewrite this (homework) in a more useful way as (equation 2):

$\theta_{m}=\arcsin[\frac{m\lambda}{a} + \sin(\theta_{i})]$

A similar, but slightly more complicated situation happens when you rotate the grating instead of the lazer:

figure 2

With a rotated grating (figure 2), the laser is still hitting the grating at an angle as it is in figure 1.  So, starting with equation 2 and using some geometry we get the angles that satisfy the maxima condition:

$\theta_{m'}=\arcsin(\frac{m\lambda}{a}) + \sin(\theta_{g}) - \theta_{g}$

This seemed liked a fun thing to model in Mathematica, especially since I had never played with any of the graphics features before.

You can view the source here.

You need Wolfram's CDF player, but it's totally worth because then you can look through all of the awesome demonstrations they have online.