The principle of X-ray diffraction (XRD) is:
When X-rays hit a crystal, the atoms inside the crystal are arranged in a regular, repeating pattern. The X-rays bounce off these atomic planes. In some directions, the bounced X-rays line up perfectly, making a strong signal. By measuring the directions and strength of these signals, we can learn about the arrangement of atoms, the distances between them, and the type of crystal.
In short, XRD uses X-rays to “see” how atoms are arranged in a crystal.