The Colors of a Soap Film

Hacker News Top News

Summary

A physics blog post explaining why soap films display bands of color, deriving the reflected spectrum as a cosine in 1/λ from the Fresnel coefficients and showing how thin-film interference plus CIE color-matching functions determine the perceived color at each thickness.

No content available
Original Article
View Cached Full Text

Cached at: 10/28/26, 01:27 PM

# The colors of a soap film | Aseem Raj Baranwal Source: [https://aseemrb.me/blog/colors-of-a-soap-film/](https://aseemrb.me/blog/colors-of-a-soap-film/) A soap film is a sheet of water between two layers of soap molecules, often thinner than a micrometer\. A vertical film drains under gravity and is thinner at the top, so in white light it shows bands of color ordered by thickness\. Newton watched them on bubbles kept under a glass cover \([*Opticks*](https://www.gutenberg.org/ebooks/33504), Book II, Part I, Observation 17\): colored rings formed at the top, widened and moved down as the water drained, and a[black spot](https://en.wikipedia.org/wiki/Soap_film#Black_spots)grew at the top before the bubble broke\. The color at thicknessddfollows from two ingredients: the fraction of light the film reflects at each wavelengthλ\\lambda, and the three[color\-matching functions](https://en.wikipedia.org/wiki/CIE_1931_color_space#Color_matching)that the[CIE](https://cie.co.at/)\(the International Commission on Illumination\) uses to reduce a spectrum to a color\. The first is a single cosine in1/λ1/\\lambda, so the color is a fixed white minus the[cosine transform](https://en.wikipedia.org/wiki/Sine_and_cosine_transforms)of the color\-matching functions, evaluated at2nd2nd, the extra optical path traveled by light reflected from the film’s back surface, wherennis the refractive index of water\. The computed colors agree with the table of thicknesses that Newton compiled for them\. ## The reflected spectrum is a cosine Consider light of wavelengthλ\\lambdathat travels normal to the film, perpendicular to its two surfaces\. Two beams return toward the eye\. One is reflected by the front surface\. The other crosses the film, is reflected by the back surface, and crosses the film again\. Light is an electromagnetic wave: an electric field and a magnetic field that oscillate together as the wave travels\. The**amplitude**of a beam is the size of its electric field’s oscillation, and the brightness of the beam is proportional to the square of its amplitude\. In the figure, each beam is labeled with its amplitude as a multiple of the incoming beam’s amplitude\. d1rt−rt−rtt′≈ −rair, index 1front surfacewater, indexnback surfaceairfront\-surface waveback\-surface wavetheir sum, the reflected lightτdirection of travel → All the beams in the figure travel along the same line, normal to the film\. They are drawn side by side so that each one can be labeled\. The right half shows the two returning waves at one instant\. The back\-surface wave is the front\-surface wave turned upside down, and it trails the front\-surface wave by a distanceτ\\tau, derived below\. The light that reaches the eye is the sum of the two waves\. **How much each surface reflects\.**When light travels normal to a surface, its electric and magnetic fields both lie parallel to the surface\. In a medium of refractive indexnn, the amplitude of the magnetic field is proportional tonntimes the amplitude of the electric field\. Suppose a beam of amplitude11crosses a boundary from a medium of indexn1n\_1into a medium of indexn2n\_2\. It splits into a reflected beam of amplituderrand a transmitted beam of amplitudett\.[Maxwell’s equations](https://en.wikipedia.org/wiki/Maxwell%27s_equations)require each field to take the same value on both sides of the boundary\. For the electric field, this condition reads1\+r=t1 \+ r = t\. The reflected beam travels in the opposite direction, so its magnetic field points the opposite way, and the condition for the magnetic field readsn1\(1−r\)=n2tn\_1\(1 \- r\) = n\_2\\,t\. Solving these two equations gives the[Fresnel coefficients](https://en.wikipedia.org/wiki/Fresnel_equations#Normal_incidence)for normal incidence, r=n1−n2n1\+n2,t=2n1n1\+n2\.r = \\frac\{n\_1 \- n\_2\}\{n\_1 \+ n\_2\}, \\qquad t = \\frac\{2n\_1\}\{n\_1 \+ n\_2\}\.In the soap film, the index is11for air andnnfor water\. At the front surface, light passes from air into water, sor=\(1−n\)/\(1\+n\)r = \(1\-n\)/\(1\+n\)andt=2/\(1\+n\)t = 2/\(1\+n\)\. Forn=1\.33n = 1\.33,r=−0\.142r = \-0\.142\. At the back surface, light passes from water into air\. The two indices trade places, and the reflection coefficient becomes\(n−1\)/\(n\+1\)=−r\(n\-1\)/\(n\+1\) = \-r\. The two reflections therefore have opposite signs\. On its way out, the back\-surface beam passes through the front surface from water into air, with transmission coefficientt′=2n/\(1\+n\)t' = 2n/\(1\+n\)\. This beam is transmitted, reflected and transmitted again, so it returns with amplitude t\(−r\)t′=−r⋅4n\(1\+n\)2=−r\(1−r2\)\.t\\,\(\-r\)\\,t' \\;=\\; \-r\\cdot\\frac\{4n\}\{\(1\+n\)^2\} \\;=\\; \-r\\,\(1 \- r^2\)\.The last step uses\(1\+n\)2−\(1−n\)2=4n\(1\+n\)^2 \- \(1\-n\)^2 = 4n\. For water,1−r2=0\.981 \- r^2 = 0\.98\. From here on I approximate0\.98≈10\.98 \\approx 1, which changes the back\-surface beam’s amplitude by2%2\\%, so the two returning beams have amplitudesrrand−r\-r\. **How far the second beam trails the first\.**The back\-surface beam travels an extra distance2d2dinside the water, where the wavelength shortens toλ/n\\lambda/n\. It therefore falls behind the front\-surface beam by2d/\(λ/n\)=τ/λ2d/\(\\lambda/n\) = \\tau/\\lambdawavelengths, where τ=2nd\\tau = 2ndis the[optical path difference](https://en.wikipedia.org/wiki/Optical_path_length#Optical_path_difference)between the two beams\. In air, where the wavelength isλ\\lambda, this is a distanceτ\\tau, as in the figure\. Each wavelength of delay is one full cycle of the oscillation, so the back\-surface wave is shifted in its cycle by the angleφ=2πτ/λ\\varphi = 2\\pi\\tau/\\lambda\. This angle is called the**phase**difference\. Two waves with different phases are added by writing each one as a complex number whose magnitude is the amplitude and whose angle is the phase, as in the[Euler’s identity post](https://aseemrb.me/blog/eulers-identity)\. A shift by the angleφ\\varphimultiplies the complex number byeiφe^\{i\\varphi\}\. The light reflected by the film therefore has amplitude r−reiφ=r\(1−eiφ\),φ=2πτλ\.r \- r\\,e^\{i\\varphi\} \\;=\\; r\\,\\big\(1 \- e^\{i\\varphi\}\\big\), \\qquad \\varphi = \\frac\{2\\pi\\tau\}\{\\lambda\}\.The**reflectance**RRis the fraction of the incoming light that the film reflects\. Brightness is proportional to the square of the amplitude, soRRis the squared magnitude of this complex number\. Since∣1−eiφ∣2=\(1−cos⁡φ\)2\+sin⁡2φ=2−2cos⁡φ\|1 \- e^\{i\\varphi\}\|^2 = \(1 \- \\cos\\varphi\)^2 \+ \\sin^2\\varphi = 2 \- 2\\cos\\varphi, R\(λ\)=2r2\(1−cos⁡2πτλ\)=4r2sin⁡2⁣\(πτλ\)\.R\(\\lambda\) \\;=\\; 2r^2\\Big\(1 \- \\cos\\frac\{2\\pi\\tau\}\{\\lambda\}\\Big\) \\;=\\; 4r^2 \\sin^2\\\!\\Big\(\\frac\{\\pi\\tau\}\{\\lambda\}\\Big\)\.Takingn=1\.33n = 1\.33constant across the visible band,r2=0\.0201r^2 = 0\.0201, soRRlies between00and4r2=8\.0%4r^2 = 8\.0\\%\. In the[**wavenumber**](https://en.wikipedia.org/wiki/Wavenumber)σ=1/λ\\sigma = 1/\\lambda,R=2r2\(1−cos⁡2πστ\)R = 2r^2\(1 \- \\cos 2\\pi\\sigma\\tau\)is a single cosine with period1/τ1/\\tau\. Light can also bounce back and forth inside the film several times before it leaves\. Summing all of these reflections gives the exact Airy formula \(Born and Wolf, §7\.6\)\. Its higher harmonicscos⁡\(2πkστ\)\\cos\(2\\pi k\\sigma\\tau\), for integersk≥2k \\ge 2, shrink by a factorr2≈0\.02r^2 \\approx 0\.02from eachkkto the next, and the two\-beam formula stays within about4%4\\%of it\. ## Three numbers from a spectrum For the[CIE 1931**standard observer**](https://en.wikipedia.org/wiki/CIE_1931_color_space#CIE_standard_observer), light with spectral powerP\(λ\)P\(\\lambda\)is described by three[**tristimulus values**](https://en.wikipedia.org/wiki/CIE_1931_color_space#Computing_XYZ_from_spectral_data) X=∫Pxˉdλ,Y=∫Pyˉdλ,Z=∫Pzˉdλ,X = \\int P\\,\\bar x\\,d\\lambda, \\qquad Y = \\int P\\,\\bar y\\,d\\lambda, \\qquad Z = \\int P\\,\\bar z\\,d\\lambda,wherexˉ,yˉ,zˉ\\bar x, \\bar y, \\bar zare the tabulated color\-matching functions\. Two lights with the same\(X,Y,Z\)\(X, Y, Z\)look identical to the standard observer, and sinceyˉ\\bar yis the eye’s sensitivity to brightness,YYis the[luminance](https://en.wikipedia.org/wiki/Luminance)\. Light reflected by the film hasP=SRP = SRfor an illuminant with spectrumSS\. I use[D65](https://en.wikipedia.org/wiki/Illuminant_D65), the CIE’s standard representation of average daylight \(Newton viewed his bubbles “by Reflexion of the Skies when of a white Colour”\), normalized so that a perfect reflector has the[**white point**](https://en.wikipedia.org/wiki/White_point)W=\(0\.950,1,1\.089\)W = \(0\.950,\\ 1,\\ 1\.089\)\. The[sRGB](https://en.wikipedia.org/wiki/SRGB)standard specifies the3×33 \\times 3matrix and the encoding curve that take\(X,Y,Z\)\(X, Y, Z\)to the color a screen displays\. ## The color is a cosine transform SubstituteRRinto the three integrals and change variables toσ=1/λ\\sigma = 1/\\lambda\. Define three weight curves on the wavenumber axis by wx\(σ\)dσ=S\(λ\)xˉ\(λ\)dλ∫Syˉdλ,w\_x\(\\sigma\)\\,d\\sigma \\;=\\; \\frac\{S\(\\lambda\)\\,\\bar x\(\\lambda\)\\,d\\lambda\}\{\\int S\\,\\bar y\\,d\\lambda\},andwyw\_y,wzw\_zlikewise, so that their integrals are the three components ofWW\. Withw=\(wx,wy,wz\)w = \(w\_x, w\_y, w\_z\), the tristimulus values of the film are \(XYZ\)⁣\(d\)=2r2\(W−c^\(τ\)\),c^\(τ\)=∫w\(σ\)cos⁡\(2πστ\)dσ,τ=2nd\.\\begin\{pmatrix\} X \\\\ Y \\\\ Z \\end\{pmatrix\}\\\!\(d\) \\;=\\; 2r^2\\big\(W \- \\hat c\(\\tau\)\\big\), \\qquad \\hat c\(\\tau\) = \\int w\(\\sigma\)\\cos\(2\\pi\\sigma\\tau\)\\,d\\sigma, \\qquad \\tau = 2nd\.The vectorc^\(τ\)\\hat c\(\\tau\)is the cosine transform \(the real part of the Fourier transform\) of the three weight curves, evaluated at the path difference\. **The black film\.**Atd=0d = 0the cosine equals11at every wavelength, soc^\(0\)=W\\hat c\(0\) = Wand the film reflects nothing: the two reflections cancel exactly\. For smalldd,R\(λ\)≈4r2\(πτ/λ\)2R\(\\lambda\) \\approx 4r^2\(\\pi\\tau/\\lambda\)^2is proportional to1/λ21/\\lambda^2, so the first light reflected by a thin film is weighted toward short wavelengths\. Its[chromaticity](https://en.wikipedia.org/wiki/Chromaticity), in the CIE coordinates\(x,y\)=\(X,Y\)/\(X\+Y\+Z\)\(x, y\) = \(X, Y\)/\(X \+ Y \+ Z\), is\(0\.266,0\.281\)\(0\.266, 0\.281\), bluer than the white point at\(0\.313,0\.329\)\(0\.313, 0\.329\)\. This bluish gray is the faint blue that Newton lists right after black\. Atd=10d = 10nm the film reflects0\.18%0\.18\\%of the light, less than a tenth of the2%2\\%reflected by a single water surface but not zero, and Newton could see “the Images of some things \(as of a Candle or the Sun\) very faintly reflected” from the black spot\. **The orders\.**The luminanceY=2r2\(1−c^y\(τ\)\)Y = 2r^2\\big\(1 \- \\hat c\_y\(\\tau\)\\big\)is smallest when the wavelengths at the center ofwyw\_yare extinguished, that is, whenτ\\tauis a multiple ofλˉ=554\\bar\\lambda = 554nm, the reciprocal of the mean wavenumber ofwyw\_y\. The computed minima are atd=207d = 207,416416,626626and837837nm, spaced byλˉ/2n=208\\bar\\lambda/2n = 208nm\. With the middle of the spectrum removed, red and blue light remain, and these purple bands separate the**orders**: the second and third orders run through blue, green, yellow and red, and from the fourth order on, greens and pinks alternate and grow paler\. The widget evaluates the formula from the CIE tables at55nm steps: the reflectance with the productsSxˉS\\bar x,SyˉS\\bar y,SzˉS\\bar zdashed, the[chromaticity diagram](https://en.wikipedia.org/wiki/CIE_1931_color_space#Chromaticity_diagram)with the film’s path up to the currentdd, and the color for everyddup to2μ2\\ \\mum\. In the first order the peak ofRR, atλ=2τ\\lambda = 2\\tau, moves from the ultraviolet into the visible band\. Atd=104d = 104nm it sits at553553nm,RRstays above half its maximum across the band, and the film is white\. The zero ofRRatλ=τ\\lambda = \\tauenters the band atd=143d = 143nm, which turns the film yellow and then red, and reaches the green atd=208d = 208nm\. The chromaticity path goes once around the white point in each of the first three orders\. After that, it swings between the green and pink sides of the white point, at a distance that shrinks in every order after the second\. ## The colors fade to white Asddgrows,c^\(τ\)→0\\hat c\(\\tau\) \\to 0by the[Riemann–Lebesgue lemma](https://en.wikipedia.org/wiki/Riemann%E2%80%93Lebesgue_lemma)\(the Fourier transform of an integrable function tends to zero at infinity\), so a thick film reflects the illuminant’s own color at2r2≈4%2r^2 \\approx 4\\%, the reflectance of two water surfaces whose reflections add without interfering\. The cosine inRRhas period1/τ1/\\tauinσ\\sigma, and the visible band holdsτ\(1/380−1/780\)nm−1\\tau\\,\(1/380 \- 1/780\)\\ \\text\{nm\}^\{\-1\}of its periods:1\.81\.8atd=0\.5μd = 0\.5\\ \\mum and5\.45\.4atd=1\.5μd = 1\.5\\ \\mum\. A weight curve that spans several periods averages the cosine to nearly zero\. The widths of the weight curves set the rate of decay\. Replacingwyw\_yby a Gaussian with the same meanσˉ=1/λˉ\\bar\\sigma = 1/\\bar\\lambdaand standard deviationssgives c^y\(τ\)≈cos⁡\(2πσˉτ\)e−2π2s2τ2,\\hat c\_y\(\\tau\) \\;\\approx\\; \\cos\(2\\pi\\bar\\sigma\\tau\)\\; e^\{\-2\\pi^2 s^2 \\tau^2\},the oscillation that produces the orders, under a Gaussian envelope\. For the tabulated D65 andyˉ\\bar y,s=0\.136μm−1s = 0\.136\\ \\mu\\text\{m\}^\{\-1\}, and the envelope falls to1/e1/eatτ=1/\(2πs\)=1\.65μ\\tau = 1/\(\\sqrt\{2\}\\,\\pi s\) = 1\.65\\ \\mum, a thickness of0\.62μ0\.62\\ \\mum\. The modulus of the exact transform of the tabulated curve stays within0\.0320\.032of this envelope up tod=1\.2μd = 1\.2\\ \\mum\. The transform of a narrower weight curve would decay more slowly\. This is the width trade\-off of the Fourier transform from the[Heisenberg post](https://aseemrb.me/blog/heisenberg-uncertainty-as-fourier-duality)\. Computed from the formula, the chromaticity stays within0\.030\.03of the white point for everyd≥1\.25μd \\ge 1\.25\\ \\mum and within0\.010\.01for everyd≥1\.61μd \\ge 1\.61\\ \\mum\. ## Newton’s table Newton measured the[rings of color](https://en.wikipedia.org/wiki/Newton%27s_rings)in the thin film of air between two lenses pressed together, and compiled a table of the thickness “at which each Colour is most intense and specifick”, in millionths of an inch, for films of air, water and glass \(Book II, Part II\)\. Selected entries of his water column, converted at25\.425\.4nm per millionth of an inch, next to the computed color at that thickness: orderNewton’s colorNewton \(10⁻⁶ in\)dd\(nm\)computed1stwhite3⅞981styellow5⅓1351stred6¾1712ndviolet8⅜2132ndblue10½2672ndgreen11⅔2963rdpurple15¾4003rdgreen18⁹⁄₁₀4804thgreen26½6737thruddy white57¾1467The brightest computed film, at104104nm, is Newton’s white of the first order at9898nm\. His violet of the second order, at213213nm, sits next to the first luminance minimum at207207nm, and his last entry, the**ruddy white**of the seventh order at14671467nm, comes out as a pinkish white near the white point\. Newton also viewed the bubble obliquely \(Observation 19\)\. At angleθ\\thetato the normal inside the film the path difference is2ndcos⁡θ2nd\\cos\\theta, so a color seen at thicknessddat normal incidence appears where the film isd/cos⁡θd/\\cos\\thetathick\.[Snell’s law](https://en.wikipedia.org/wiki/Snell%27s_law)givessin⁡θ≤1/n\\sin\\theta \\le 1/n, so the largest factor, at grazing incidence, isn/n2−1=1\.52n/\\sqrt\{n^2 \- 1\} = 1\.52for water\. Newton’s ratio for his most oblique view: “By the best of my Observations it was between 15 and 15\-1/2 to 10\.” ## The Michel\-Lévy chart A plate of a[birefringent](https://en.wikipedia.org/wiki/Birefringence)crystal between crossed[polarizers](https://en.wikipedia.org/wiki/Polarizer), at45°45°to them, transmits the fractionsin⁡2\(πΓ/λ\)\\sin^2\(\\pi\\Gamma/\\lambda\)of the polarized light, where the**retardation**Γ\\Gammais the optical path difference between the plate’s two polarizations\. That isR/4r2R/4r^2withΓ=τ\\Gamma = \\tau, so the strip in the widget is also the[interference color chart](https://en.wikipedia.org/wiki/Interference_colour_chart)that mineralogists use to identify minerals in[thin section](https://en.wikipedia.org/wiki/Thin_section), with2nd2ndas the retardation \(for the same illuminant, and with the birefringence taken constant across the band\)\.[Sørensen \(2013\)](https://doi.org/10.1127/0935-1221/2013/0025-2252)recomputed that chart from first principles\. ## References - Isaac Newton\.[*Opticks: or, a Treatise of the Reflections, Refractions, Inflections and Colours of Light*](https://www.gutenberg.org/ebooks/33504)\. London, 1704\. Fourth edition, 1730\. Book II, Part I, Observations 17–19 on soap bubbles, and Part II, the table of thicknesses of colored plates\. - Max Born and Emil Wolf\.[*Principles of Optics*](https://doi.org/10.1017/CBO9781139644181), 7th edition\. Cambridge University Press, 1999\. Chapter 7: two\-beam interference in a plane\-parallel plate \(§7\.5\) and multiple\-beam interference \(§7\.6\)\. - CIE\.[*Colour\-matching functions of CIE 1931 standard colorimetric observer*](https://doi.org/10.25039/CIE.DS.xvudnb9b)\. Dataset, 2019, from ISO/CIE 11664\-1:2019\. - CIE\.[*CIE standard illuminant D65*](https://doi.org/10.25039/CIE.DS.hjfjmt59)\. Dataset, 2019, from ISO/CIE 11664\-2:2022\. - IEC 61966\-2\-1:1999\.*Multimedia systems and equipment – Colour measurement and management – Part 2\-1: Colour management – Default RGB colour space – sRGB*\. - Bjørn Eske Sørensen\.[*A revised Michel\-Lévy interference colour chart based on first\-principles calculations*](https://doi.org/10.1127/0935-1221/2013/0025-2252)\. European Journal of Mineralogy, 25\(1\):5–10, 2013\.

Similar Articles

The Color of White Light

Hacker News Top

The article explains the inaccuracies in RGB color photography and details the construction of a DIY spectrograph to analyze light spectra, addressing common color-matching issues in daily life.

Quantifying Colour

Hacker News Top

The article discusses how colors are quantified using physical measurements of light wavelengths to enable precise color reproduction in monitors, covering historical naming challenges and scientific principles.

Where to Find the Colors Your Screen Can't Show You

Hacker News Top

An article explaining that screens cannot display certain real-world colors, particularly cyans, due to the limitations of RGB color spaces and human cone cell response, and describing how to find these colors in nature.

Linear Cosine Palettes(2025)

Hacker News Top

Blog post explaining linear cosine palettes for generating continuous color palettes using R, based on Inigo Quilez's procedural palette method.