The diffraction grating formula relates the angle of diffraction maxima to the wavelength of light and the spacing between the grating lines. By knowing the grating spacing and the angle for a specific order of maximum, the wavelength can be calculated.