Solution (source code)

= Solution

The bright peaks occur when contributions from adjacent grooves have equal phase modulo $2\pi$, so all illuminated grooves contribute by <constructive interference>. Use the reflection-grating convention shown below: $\alpha$ and $\beta$ are positive angles of the incident and outgoing ray lines on the same side of the normal. The incoming and outgoing path differences between neighboring grooves are $d\sin\alpha$ and $d\sin\beta$, respectively. Hence the <grating equation> is
$$
\boxed{g(\alpha,\beta,\lambda,d,m)=d(\sin\alpha+\sin\beta)-m\lambda=0.}
$$
The integer $m$ labels the <diffraction order>. With a different signed-angle convention, the same physical condition contains a difference of sines.

\Image[/past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2019/iii/paper-338-grating-rays.png]
{title=Reflection-grating angle convention}
{description=The incident ray and selected outgoing ray are both drawn on the positive side of the surface normal. Adjacent groove spacing contributes the sum of their two projected path differences.}