Optics
Thin-Film Interference
Soap bubbles, oil slicks, peacock feathers — colors from light reflecting off thin layers
When light reflects off the top and bottom of a thin film, the two reflected beams interfere. Constructive interference produces bright reflection at certain wavelengths; destructive cancels others. Result — colorful patterns on soap bubbles, oil slicks, peacock feathers, and beetle shells. Used in anti-reflective coatings, dichroic filters, and structural coloration in nature.
- Path difference2·n·t·cos θ_t (round trip in film)
- Constructive (reflection)2·n·t = (m + ½)·λ (with phase shift); 2·n·t = m·λ (without)
- Phase shift180° flip when reflecting off denser medium
- Soap bubbleAir-soap-air; 1 phase flip → constructive at 2nt = (m+½)λ
- Oil on waterAir-oil-water; 2 flips → constructive at 2nt = mλ
- Anti-reflection coatingQuarter-wave at design λ; reflects ~zero
Interactive visualization
Press play, or step through manually. The visualization is yours to drive — try it before reading on.
Watch the 60-second explainer
A condensed visual walkthrough — narrated, captioned, under a minute.
The setup
Light hits a thin film of refractive index n and thickness t. Two reflections happen:
- From top surface (air-film boundary).
- From bottom surface (film-substrate boundary).
The two reflected beams interfere. Constructive or destructive depends on:
- Geometric path difference: 2·n·t·cos θ_t (where θ_t is the angle inside the film).
- Phase shifts at the boundaries: 180° flip when reflecting off a denser medium.
Phase shifts at reflection
| Reflecting from | Phase shift |
|---|---|
| Less-dense medium (e.g., air-water from air side) | 180° flip |
| More-dense medium (e.g., air-water from water side) | No shift |
| Same medium (n equal) | No shift |
Constructive/destructive conditions
For normal incidence, with N phase flips total at the two reflections:
| Number of flips | Constructive (bright reflection) | Destructive (dim) |
|---|---|---|
| 0 (e.g., glass on glass) | 2·n·t = m·λ | 2·n·t = (m + ½)·λ |
| 1 (e.g., soap bubble) | 2·n·t = (m + ½)·λ | 2·n·t = m·λ |
| 2 (e.g., oil on water if n_oil < n_water) | 2·n·t = m·λ | 2·n·t = (m + ½)·λ |
Real-world thin films
| System | Configuration | Why colors appear |
|---|---|---|
| Soap bubble | Air-soap-air | 1 flip; varying thickness → varying colors |
| Oil slick on water | Air-oil-water | 2 flips (if n_oil < n_water); thickness gradient → rainbow |
| Peacock/butterfly | Multilayer biological film | Structural; viewing angle changes color |
| Anti-reflective lens coatings | MgF₂ on glass | Designed thickness for AR at 550 nm |
| Dielectric mirror | Many alternating thin layers | Each reflects at a wavelength; sum is high reflectivity |
| Newton's rings | Air gap between lens and flat | Varying air-gap thickness → concentric rings |
| Iridescent shells | Layered nacre | Multilayer interference |
JavaScript — thin-film calculations
// For thin film at normal incidence
// 1 phase flip (e.g., soap bubble): constructive at 2nt = (m + 0.5)·λ
function constructiveWavelengthSoap(thickness, n_film, m_max = 5) {
const results = [];
for (let m = 0; m < m_max; m++) {
const wavelength = (2 * n_film * thickness) / (m + 0.5);
if (wavelength > 380e-9 && wavelength < 750e-9) {
results.push({ m, wavelength_nm: wavelength * 1e9 });
}
}
return results;
}
// Soap film, n = 1.33, t = 200 nm
console.log(constructiveWavelengthSoap(200e-9, 1.33, 3));
// m=0: 2·1.33·200/0.5 = 1064 nm (IR — invisible)
// m=1: 1064/3 = 355 nm (UV — invisible)
// Hmm — this thickness shows no visible color at first orders
// Better example: soap film of t = 100 nm
console.log(constructiveWavelengthSoap(100e-9, 1.33, 3));
// m=0: 532 nm (green)
// m=1: 178 nm (UV)
// 2 flips (air-oil-water, n_oil=1.5, n_water=1.33): constructive at 2nt = m·λ
function constructiveWavelengthOil(thickness, n_film, m_max = 5) {
const results = [];
for (let m = 1; m < m_max; m++) {
const wavelength = (2 * n_film * thickness) / m;
if (wavelength > 380e-9 && wavelength < 750e-9) {
results.push({ m, wavelength_nm: wavelength * 1e9 });
}
}
return results;
}
// Oil 200 nm thick, n = 1.5
console.log(constructiveWavelengthOil(200e-9, 1.5, 5));
// m=1: 600 nm (orange/red)
// m=2: 300 nm (UV)
// Anti-reflection coating: design thickness for given target wavelength
function ARThickness(targetWavelength, n_coating) {
// Quarter-wave: t = λ / (4n)
return targetWavelength / (4 * n_coating);
}
// MgF₂ (n = 1.38) AR for 550 nm (peak human vision)
console.log(`MgF₂ AR thickness: ${(ARThickness(550e-9, 1.38) * 1e9).toFixed(1)} nm`); // ~99.6 nm
// Color of soap film vs thickness
function colorOfFilm(thickness_nm, n_film = 1.33) {
// Find which visible wavelength has constructive at 2nt = (m+0.5)·λ
const t = thickness_nm * 1e-9;
const targets = [];
for (let m = 0; m < 5; m++) {
const wavelength = (2 * n_film * t) / (m + 0.5);
if (wavelength > 380e-9 && wavelength < 750e-9) {
targets.push({ m, wavelength_nm: wavelength * 1e9 });
}
}
return targets;
}
// Sweep thicknesses
[100, 150, 200, 250, 300, 350, 400].forEach(t => {
console.log(`${t} nm soap: ${colorOfFilm(t).map(x => x.wavelength_nm.toFixed(0) + ' nm').join(', ')}`);
});
// Newton's rings: ring radii on a curved lens
function newtonsRingRadius(R_lens, m, wavelength) {
// Air gap at distance r: t ≈ r²/(2R). Constructive at 2t = (m+½)λ → r = √((m+½)·λ·R)
return Math.sqrt((m + 0.5) * wavelength * R_lens);
}
// 1 m radius lens, 633 nm laser
for (let m = 0; m <= 5; m++) {
console.log(`Ring m=${m}: r = ${(newtonsRingRadius(1, m, 633e-9) * 1000).toFixed(2)} mm`);
}
Where thin-film interference matters
- Anti-reflection coatings. Camera lenses, eyeglasses, solar cells — single-layer or multilayer designs.
- Dielectric mirrors. High-reflectivity at specific wavelengths; used in lasers, telescopes.
- Optical filters. Interference filters pass narrow bandwidths.
- Color in nature. Peacocks, butterflies, beetles, abalone — structural coloration via thin films.
- Soap bubbles and oil slicks. Most familiar examples; demonstrate physics directly.
- Industrial inspection. Thickness measurement of coatings via interference; Newton's rings for lens shape.
- Photonic devices. Laser diodes, photonic crystals, multilayer reflectors.
Common mistakes
- Forgetting phase shifts. Reflection off denser medium → 180° phase flip. Forgetting these flips gets the constructive/destructive conditions wrong.
- Confusing reflection vs transmission interference. Constructive REFLECTION condition is destructive TRANSMISSION condition (energy conservation).
- Treating the geometric path difference alone. Path difference = 2nt for normal incidence. For oblique incidence, use 2nt·cos θ_t.
- Using vacuum wavelength inside the film. Light wavelength in the film is λ/n (slower → shorter λ). Path difference uses the wavelength IN the film.
- Assuming a single color. Most films show multiple wavelengths simultaneously (different m's). Color is a mix; what you see depends on which wavelengths add constructively.
- Forgetting incidence angle dependence. Oblique angles change the path difference, so the colors observed depend on viewing angle (peacock feathers, etc.).
Frequently asked questions
How does thin-film interference produce color?
Light reflects from top (air-film) and bottom (film-substrate) of a thin layer. Path difference depends on thickness AND wavelength. At certain wavelengths, the two reflections constructively interfere → bright reflection at those colors. Other wavelengths destructively interfere → dim. Result — selective enhancement of some colors, producing iridescent patterns. Different thicknesses → different colors visible.
Why does a soap bubble look black just before it pops?
As soap film drains, it gets thinner (~λ/4 or less). For very thin film, top reflection (180° phase flip) and bottom reflection (no flip in this case) destructively interfere across all visible wavelengths. Net result — almost no reflected light, so it looks dark/black. Just before popping, all colors cancel.
Why does oil on water show colors?
Two reflections — air→oil (180° flip) and oil→water (also 180° flip if water n > oil n). Both flips cancel. Path difference = 2nt. Constructive interference at 2nt = mλ for some m and λ. Different oil thicknesses → different colors. Common after rain when oil floats on puddles.
How do anti-reflection coatings work?
Coat a lens with material of intermediate n (like MgF₂, n=1.38, between air n=1 and glass n=1.5). Coating thickness = λ_target/(4·n_coating). The two reflected beams (from top and bottom of coating) destructively interfere at the design wavelength → no net reflection. Reduces 4% per surface to 0.5% or less. Multilayer coatings achieve <0.1% over wide ranges.
What about peacock feathers?
Peacock feathers don't contain blue/green pigments — colors come from STRUCTURAL effects. Tiny barbules contain regular arrays of melanin rods (~140 nm spacing) embedded in keratin. Light interferes with this regular structure (a 1D photonic crystal) — different wavelengths reflect at different angles. As you move, color shifts. Same physics: morpho butterflies, beetles, hummingbirds.
What are Newton's rings?
Concentric rings of color seen between a curved lens and flat surface. Air gap thickness varies radially. At each radius, certain wavelengths constructively interfere. Used historically by Newton to study light's wave nature; modern use — testing lens curvature in optics labs. Pattern depends on n_air, lens radius, and wavelength.
How precise are these effects?
Very. Films can produce pure colors at the 10-nm-thickness level. Modern dielectric mirrors using multilayer thin films achieve >99.99% reflectivity at specific wavelengths. Used in lasers, telescopes (advanced), camera filters, photonic devices. Manufacturing requires Å-level (0.1 nm) thickness control.