Diffraction
In X-ray diffraction a beam strikes a crystal and diffracts into many specific directions. The angles and intensities of the diffracted beams indicate a three-dimensional density of electrons within the crystal. X-rays produce a diffraction pattern because their wavelength is typically the same order of magnitude (0.1-10.0 nm) as the spacing between the atomic planes in the crystal.
Each atom re-radiates a small portion of an incoming beam's intensity as a spherical wave. If the atoms are arranged symmetrically (as is found in a crystal) with a separation d, these spherical waves will be in synch (add constructively) only in directions where their path-length difference 2d sin θ is equal to an integer multiple of the wavelength λ. The incoming beam therefore appears to have been deflected by an angle 2θ, producing a reflection spot in the diffraction pattern.
X-ray diffraction is a form of elastic scattering; the outgoing X-rays have the same energy, and thus same wavelength, as the incoming X-rays, only with altered direction. By contrast, inelastic scattering occurs when energy is transferred from the incoming X-ray to an inner-shell electron exciting it to a higher energy level. Such inelastic scattering reduces the energy (or increases the wavelength) of the outgoing beam. Inelastic scattering is useful for probing such electron excitation, but not in determining the distribution of atoms within the crystal.
Longer-wavelength photons (such as ultraviolet radiation) would not have sufficient resolution to determine the atomic positions. At the other extreme, shorter-wavelength photons such as gamma rays are difficult to produce in large numbers, difficult to focus, and interact too strongly with matter, producing particle-antiparticle pairs.
Similar diffraction patterns can be produced by scattering electrons or neutrons. X-rays are usually not diffracted from atomic nuclei.
Read more about this topic: X-ray Optics