With this simulation, you can explore thin-film interference. When light traveling in one medium is incident on a thin film of material that is in contact with another medium, some light reflects off the top (or front) surface of the film, and some light goes through the film, reflects off the bottom (or back) surface of the film, and emerges back into the original medium. These two reflected waves then interfere with one another. The interference can be constructive, destructive, or something in between, depending on the thickness of the film.
Note that, in the simulation, the incident wave is shown on the left. The wave that reflects off the top surface of the film is moved horizontally to the right, so we can see it easily without it being on top of the incident wave. The wave that reflects off the bottom surface of the film is moved even farther to the right. Look at the interference that occurs between the two waves traveling up in the top medium.
We can start our analysis by thinking about the path-length difference that occurs for the two waves. One wave just bounces off the film, while the other wave goes through the film, reflects, and travels through the film again before emerging back into the first medium. If the film thickness is t, then the second wave travels an extra distance of 2t compared to the first wave. The path-length difference, in other words, is 2t.
Based on our previous understanding of interference, we might expect that if this path-length difference was equal to an integer number of wavelengths, we would see constructive interference, and if the path-length difference was an integer number of wavelengths plus half a wavelength, we would see destructive interference. It is just a little more complicated than this, however - there are two more ideas that we need to consider.
First, we have up to three media in this situation, and the wavelength of the light is different in the different media - which wavelength is it that really matters? To satisfy the interference conditions, we need to align the wave that goes down and back in the film with the wave that bounces off the top of the film. Thus, it is the wavelength in the film that really matters.
Note that the wavelength in any medium is related to the wavelength in vacuum by the equation: λmedium = λvacuum / nmedium
Second, we have to account for the fact that when light reflects from a higher-n medium, it gets inverted (there is no inversion when light refllects from a lower-n medium). Inverting a sine wave is equivalent to simply moving the wave half a wavelength. Thus, in our thin-film situation, if both reflections result in an inversion, or neither one does, the 2t path-length difference we derived above is all we need to consider. If only one of the reflections results in an inversion, however, the effective path-length difference is 2t plus or minus (it doesn't really matter which) half a wavelength.
Once we've determined the effective path-length difference between the two waves, we can set that equal to the appropriate interference condition. This gives us an equation that relates the thickness of the thin film to the wavelength of light in the film.