The famous double-slit experiment that reveals wave-particle duality. Watch individual particles pass through two slits and gradually build up an interference pattern — proof that matter behaves as waves.
Wave interference: each slit acts as a wave source. Where crests meet crests (constructive) we see bright bands; where crests meet troughs (destructive) we see darkness.
Adjust slit width, separation and wavelength. Watch particles accumulate one by one to form the interference pattern.
Richard Feynman called the double-slit experiment "the only mystery of quantum mechanics". Even firing electrons one at a time, the interference pattern still forms — each electron interferes with itself.
This simulation renders a top-down view of monochromatic light using a GLSL fragment shader. Two coherent slits act as wave sources, and the field is computed as A = cos(k·r1 − ωt)/√r1 + cos(k·r2 − ωt)/√r2 with k = 2π/λ, displayed as intensity A². Where wavefronts arrive in phase they reinforce; where they arrive out of phase they cancel, producing the classic interference pattern.
A bar along the right edge shows the time-averaged fringe intensity that would build up on a detector screen, following I(y) ∝ cos²(πd·sinθ/λ) · sinc²(πa·sinθ/λ). The three sliders set wavelength λ (380–700 nm, which also tints the spectral colour), slit width a (2–20), and slit separation d (10–80). This experiment is the foundational demonstration of wave-particle duality in quantum mechanics.
What does this simulation actually show?
It shows monochromatic light waves spreading out from two narrow slits and overlapping in the region beyond them. Bright bands appear where the two waves arrive in phase and add together, and dark bands appear where they cancel. The vertical bar on the right represents the steady fringe pattern that would accumulate on a screen.
How is the wave field calculated?
Each slit is treated as a point source emitting a circular wave. For every pixel the shader sums the two contributions, A = cos(k·r1 − ωt)/√r1 + cos(k·r2 − ωt)/√r2, where r1 and r2 are the distances to the slits and k = 2π/λ. The displayed brightness is the squared amplitude A², scaled into the visible range.
What do the three sliders control?
The λ slider sets the wavelength from 380 to 700 nm, which changes both the fringe spacing and the on-screen colour. Slit width adjusts the single-slit diffraction envelope that modulates fringe brightness, and slit separation controls how closely the interference fringes are packed together. Pause freezes the animation and Reset restores the defaults (540 nm, width 6, separation 30).
Fringe spacing is proportional to λ divided by the slit separation d, so reducing d spreads the bright bands further apart. The readout in the simulation reflects this with an estimate proportional to λ/d. Increasing the wavelength has the same widening effect, which is why red fringes are broader than blue ones.
Each slit has a finite width a, so light diffracting through it forms its own broad diffraction pattern described by a sinc function. This envelope multiplies the two-slit interference fringes, making central fringes bright and outer ones progressively dimmer. Widening the slit narrows this envelope and concentrates the light near the centre.
It captures the correct physics qualitatively and uses the standard two-slit equation under a single-slit envelope. However, the spatial scales are remapped so the fringes are visible on screen rather than at true micron and metre dimensions, and the colour is an approximate spectral mapping. It is an accurate teaching model rather than a metrologically exact instrument.
It is the clearest demonstration that light, and indeed matter, behaves as a wave. When the experiment is performed with single particles fired one at a time, the interference pattern still emerges, implying each particle interferes with itself. Richard Feynman called it the only mystery of quantum mechanics.
If a detector determines which slit each particle passes through, the interference pattern disappears and you see two plain bands instead. Acquiring which-path information destroys the coherence between the two routes. This simulation models the undisturbed wave case, so the full interference pattern is always shown.
Yes. The interference pattern has been observed with electrons, neutrons, atoms and even large molecules, confirming that wave-particle duality is universal rather than a quirk of light. The relevant wavelength is the de Broglie wavelength, λ = h/p, which is far shorter for massive particles.
In two dimensions a circular wave spreads its energy over an ever-growing circumference, so its intensity falls as 1/r and its amplitude as 1/√r. The shader uses this 1/√r factor so distant parts of the field correctly appear fainter, mimicking how real waves attenuate as they propagate outward.
Interference and diffraction underpin diffraction gratings used in spectrometers, thin-film coatings, holography, and the resolution limits of microscopes and telescopes. The same principles guide electron and neutron diffraction for probing crystal structures, and matter-wave interferometry for precision measurement and quantum sensing.