When a wave (of light, sound, water, etc.) passes from one medium (e.g., glass or air) into another, its speed will change. If the wave hits the boundary between the substances at an oblique angle, the change in speed will cause it to bend. This phenomenon is called refraction, and is described by Snell’s law. Waves bend toward the normal when they slow down, and away from the normal when they speed up.
Refraction is a key principle used in the manufacture of lenses for eyeglasses, telescopes, and cameras. It is also responsible for mirages, rainbows, and the perceived bending of straws in drinks.
Diffraction occurs when waves bend around obstacles or spread out after passing through aperatures. This effect is most pronounced when the scale of the obstacle is about the same as the wavelength of the waves. If the wavefront passes through several closely-spaced openings, an interference pattern of light and dark regions will form.
Diffraction causes the edges of shadows to blur, and allows sound to travel around objects. The iridescent colors observed on peacock feathers, sea shells, and CDs are caused by these materials acting as diffraction gratings.