When light falls on a soap bubble, part of the light gets reflected. Some light enters the bubble and gets reflected from the other side of the bubble surface. Some of the light rays gets refracted. When we look at a bubble, we are seeing all these light rays. Since the bubble film is very thin, the the reflected rays gets a little out of sync with each other. Since the light travels in the form of a wave, this going out of sync causes some of the waves to cancel out or reinforce each other. White light is made up of seven colours with each colour corresponding to a particular wave length. When the light waves cancel out or reinforce, some of the wavelengths gets a boost and some disappears. This gives rise to the colour of the bubble of the colour of an oil film on water. Since the bubble or the film is not uniformly thick, each region of the film produces a different colour. The phenomenon is called interference in physics.
The colors of a soap bubble come from white light, which contains all the colors of the rainbow. When white light reflects from a soap film, some of the colors get brighter, and others disappear.
You can think of light as being made up of waves—like the waves in the ocean. When scientists talk about waves, they often talk about a wave's frequency. Frequency is the number of times that a wave vibrates in a second. For ocean waves, frequency measures the number of times a passing wave makes a surfer bob up and down in a second. For light waves, frequency measures how many electromagnetic vibrations happen in a second.
The frequency of a light wave determines which color light you see. Violet light, for instance, is the highest frequency light that you can see; it vibrates 723,000 times in a billionth of a second. White light is made up of light waves of many different frequencies.
Two waves can be in the same place at the same time. Suppose two ocean waves of equal size meet. Each wave pushes up and down on the water in its path. Where the waves meet, there are two different forces acting on the water, one from each wave. If both waves push up on the water, the water moves twice as high as it would move if it were pushed by one wave alone. This is called constructive interference.
If one wave pushes up and the other pushes down, the two pushes cancel each other and the water doesn't move at all. When this happens, it's called destructive interference
What does all this have to do with the colors of bubbles?
Light waves, like water waves, can interfere with each other. A bubble film is a sort of sandwich: a layer of soap molecules, a filling of water molecules, and then another layer of soap molecules. When light waves reflecting from one layer of soap molecules meet up with light waves reflecting from the second layer of soap molecules, the two sets of waves interfere. Some waves add together, making certain frequencies or colors of light brighter. Other waves cancel each other, removing a frequency or color from the mixture. The colors that you see are what's left after the light waves interfere. They're called interference colors.The interference colors depend on how far the light waves have to travel before they meet up again--and that depends on the distance between the layers or the thickness of the soap film. Each color corresponds to a certain thickness of the soap film. By causing the liquid bubble film to flow and change in thickness, a puff of wind makes the bubble colors swirl and change.
The very thinnest film—one that's only a few millionths of an inch thick—looks black because all the reflecting wavelengths of light cancel. When the soap film looks black, it's just about to pop.
What's the best set-up for seeing colors in a bubble?
Interference colors on a bubble look brightest when there's white light shining on the bubble and a black background behind it. The colors come from light that's reflecting from the soap film. You want to be on the same side of the bubble as the light source so that light will bounce back to your eyes. The black background keeps light that's shining through from the other side of the bubble from washing out the colors.In this soap-bubble closeup, you can see how the thickness of the soap film varies from place to place.
Exactly the same thing happens when gasoline (petrol) or diesel sits on water in the street. On a street puddle, the oil is generally thickest in the center of a puddle, which is why blue (which occurs where a thin film is at its thickest) is often (but not always!) one of the central colors.
IInterference on the surface of a soap bubble: An incoming light ray is partly reflected by the top surface of the soap film and partly reflected by the bottom surface. The wave reflected from the bottom surface has traveled further (an extra distance equal to twice the thickness of the film) so emerges out of step with the top wave. When the two waves meet, they add together, and some colors are removed by destructive interference. Where the film is thickest, the bubble appears more blueish; where it's thinner, it will look more violet or magenta.