A diffraction grating is an optical device used to disperse light into a spectrum. It is ruled with closely-spaced, fine, parallel grooves, typically several thousand per cm, that produce interference patterns in a way that separates all the components of the incoming light. A diffraction grating can be used as the main dispersing element in a spectrograph.
The diffraction pattern produced by the grating is described by the equation m × λ = d sin θ, where m is the order number, λ is a selected wavelength, d is the spacing of the grooves, and θ is the angle of incidence of light.
A transmission grating has grooves ruled onto a transparent material, such as glass or Perspex, so that a beam of light passed through the grating is partly split into sets, or orders, with spectra on either side of it; the blue light is diffracted the least and the red light the most in each order. The orders of spectra increase in dispersion and faintness with distance from the direct beam.
A reflection grating has grooves ruled onto a reflective coating on a surface that may be plane or concave, the latter being able to focus light. Its advantage over a transmission grating is that it produces a spectrum extending from ultraviolet to infrared, since the light doesn't pass through the grating material.