Diffraction gratings, like prisms, disperse white light into individual colors. Interference between light waves is the reason that thin films, such as soap bubbles, show colorful patterns. This is known as thin-film interference, because it is the interference of light waves reflecting off the top surface of a film with the waves reflecting from the bottom surface. To obtain a nice colored pattern, the thickness of the film has to be similar to the wavelength of light. An important consideration in determining whether these waves interfere constructively or destructively is the fact that whenever light reflects off a surface of higher index of refraction, the wave is inverted.
Peaks become troughs, and troughs become peaks.
This is referred to as a 180 phase shift in the wave, but the easiest way to think of it is as an effective shift in the wave by half a wavelength. This relative shift includes any phase shifts introduced by reflections off a higher-n medium, as well as the extra distance traveled by the wave that goes down and back through the film. Note that one has to be very careful in dealing with the wavelength, because the wavelength depends on the index of refraction. Generally, in dealing with thin-film interference the key wavelength is the wavelength in the film itself. The overall goal is to figure out the shift of the wave reflecting from one surface of the film relative to the wave that reflects off the other surface.