When waves encounter obstacles like slits, they diffract or bend around the edges. Diffraction can be explained by Huygens' principle, which says each point on a wavefront acts as a new source. For a single slit, the new wavefront shape is determined by combining spherical wavelets from points across the slit. There are two types of diffraction: Fresnel, where distances are finite, and Fraunhofer, where incident waves are plane waves. X-ray diffraction uses wavelengths comparable to atomic sizes to determine crystal and molecular structures.