Answer to diffraction grating problem