In order for two waves to simultaneously strenghen each other (that is, constructively interfere), they must be in phase. After reflection from a thin crystal grating with spacing \(d\), two waves are in the same phase only if the additional distance $l$ that one reflected wave must travel is an integer multiple of the wavelength \(\lambda\) longer than the distance that a second reflected wave must travel.
The wavelength difference \(l\) between the two waves depends on the incoming wave's angle of incidence \(\theta\) and the spacing \(d\) of the grating planes.
Geometrical considerations give the result$$l=2\cdot d\cdot \sin(\theta)$$ where the factor of 2 arises because the overall additional path includes the distance traveled by both the incoming and outgoing waves.
The so called Bragg's-Lawtion for constructive interference is given by $$\bbox[8px,border:2px solid red]{\text n\cdot \lambda=2\cdot d\cdot \sin(\theta)}$$where n ∈ N0 is the order of the interference maximum.
Note: In the graphic, the wave picture for \(n=2\) is depicted. The travelling distance difference of the waves is two wavelengths to create the second order interference maximum.