X-ray crystallography is a technique used to determine the atomic and molecular structure of crystals. When a beam of X-rays hits a crystal, the crystal causes the beam to diffract into specific directions. From this diffraction pattern, the electron density within the crystal can be determined, allowing the mean positions of atoms to be found. Bragg's law relates the angles and wavelengths of incident and diffracted X-ray beams to the spacing of crystal planes. X-ray crystallography instruments consist of an X-ray source, wavelength selector, sample holder, and detector. This technique is used in applications such as determining protein and viral structures, material science, and polymer characterization.