When x-rays are diffracted from a crystal surface, each plane of crystal atoms reflects the wave. The separately reflected waves will remain in phase if their respective path lengths differ by an integer multiple of the wavelength. The paths of two such waves are shown in Fig. 1.

Fig. 1 - Bragg diffraction