Double Slit Experiment Simulator: Electrons One at a Time, Which-Path and Pilot Waves
A free double-slit experiment simulator: send electrons, neutrons, buckyballs or photons through two slits one at a time and watch the interference pattern build up dot by dot; turn on a which-path detector and the stripes go away; see Bohmian pilot-wave paths; and explore the uncertainty principle with wave packets.
Fire a quantum particle (a wave packet) at a barrier that is higher than its energy. A ball would bounce back every time. The wave doesn’t: part of it leaks through and keeps going on the far side. This is the real Schrödinger equation, solved live as you watch. Drag the barrier’s top or edge to reshape it.
Why does the wave leak? Inside a barrier that is higher than the particle’s energy, the Schrödinger equation has no wavy solution. Instead the wave dies away smoothly, like e−κx, with κ = √(2m(V₀−E))/ℏ. It never jumps straight to zero, so if the barrier is thin some of the wave is still there on the far side, and from there it travels on as an ordinary wave. The chance of getting through falls off roughly like e−2κa for a barrier of width a: double the width and the chance is squared.
A ball would bounce back 100%. Classically a particle with less energy than the barrier is always reflected, and a particle with more energy always gets over. Quantum mechanically both rules are broken: waves get through barriers that are too high, and part of a wave reflects even from a barrier it could climb (try “Above the barrier”).
The packet is not split into two particles. |ψ|² gives the probability of where you would find the particle if you looked. After the collision there are two lumps: if you put a detector on the far side, it clicks with probability T and the particle is then entirely there.
How the simulation works (and what is simplified)
The wave is stored on a grid of 1,024 to 4,096 points and moved forward in tiny time steps with the Crank-Nicolson method: each step solves (1 + iHΔt/2ℏ)ψnew = (1 − iHΔt/2ℏ)ψold, a set of equations with only three diagonals that is solved in one sweep. The step is exactly unitary, so no probability is lost except at the two edges (outside the picture), where an absorbing layer quietly removes the wave, as if it flew off to infinity, and counts what it removed on each side. That is how “Reflected” and “Transmitted” keep counting after the lumps leave the picture. (The popular split-operator Fourier method was tried first: at a sudden jump in V its splitting error sprays a little of the wave into very high momenta, which is invisible for big transmissions but doubled tiny ones such as the STM gap.)
The chart below the simulation is computed separately and exactly, with the transfer-matrix method (matching ψ and ψ′ at every edge of a piecewise-constant potential; smooth shapes are cut into 600 thin slices). Because a packet contains a spread of energies, the fair comparison is the exact T averaged over that spread (the ring); the simulated dot lands on it when the run is over.
Units: energies in electronvolts (eV), times in femtoseconds (1 fs = 10−15 s). For an electron, lengths are in nanometres. For a heavier particle the same picture holds with every length shrunk by √(mₑ/m), so a proton needs a barrier about 43 times thinner to tunnel as much. The “alpha decay” preset is the Gamow picture drawn at electron scale; real alpha decay has MeV energies and femtometre distances. This is a one-dimensional model: real barriers are three-dimensional, but the leaking works the same way.
Trap a particle in a well and it can only have certain energies: a ladder of energy levels, each with its own standing wave. Pick a well, then click levels to mix them. A single level just sits there; two or more slosh back and forth in time. In the double well the particle tunnels from one side to the other and back.
The energy ladder
| Pick | Level | Energy | E / E₁ | Gap to the next |
|---|
Why only certain energies? A wave squeezed between walls must fit: in a box of width L only whole numbers of half-wavelengths fit, so the momentum and therefore the energy come in steps, En = n²h²/(8mL²). Smaller box, bigger steps; heavier particle, smaller steps. That is why atoms (tiny boxes for light electrons) have sharp spectral lines, while a marble in a jar seems to have any energy at all.
The shape of the well sets the spacing. Infinite well: gaps grow like n². Harmonic oscillator (a spring): perfectly even steps of ℏω, starting at ½ℏω, never at zero (the zero-point energy). Morse (a real chemical bond): steps that shrink until the molecule falls apart. Finite well: only a few levels fit below the rim, and the waves poke out into the walls a little: that is tunnelling again.
Why does a mix move? Each level’s wave turns in time at its own rate, e−iEnt/ℏ. On its own that turning is invisible (|ψ|² stays put: a “stationary state”). Two levels together beat against each other, and the probability sloshes with period h/ΔE. In the double well the two lowest levels are almost equal, so the beat is slow: the particle sits in one well, then tunnels to the other and back, every h/ΔE. The ammonia maser works on exactly this flip-flop of the nitrogen atom.
How the levels are found
The well is cut into 600 to 1,200 grid points and the Schrödinger equation becomes a large matrix whose only non-zero entries are on three diagonals (the second derivative becomes (ψi−1 − 2ψi + ψi+1)/Δx²). Its eigenvalues are the energies. They are found one by one by Sturm-sequence bisection (counting how many eigenvalues lie below a trial energy, and halving the interval 40-odd times), and each wave by inverse iteration. The test suite checks the results against the exact answers: n² for the box, (n+½)ℏω for the spring, Airy-function zeros for the bouncer, the Morse formula, and the number of levels that fit in a finite well. Hard walls are placed at the ends of the picture; for wells that do not hold every level (finite, Morse), only the truly bound levels are shown.
The H₂ preset uses the usual Morse parameters for hydrogen (well depth about 4.75 eV, width parameter about 1.94 Å⁻¹, bond length 0.741 Å) and the reduced mass of two protons. The model gives a first vibrational gap near 0.52 eV, close to the measured 0.516 eV, and 17 bound levels; real H₂ has 15 (v = 0 to 14), because a real bond is not exactly a Morse curve.
Send particles at a wall with slits. Left: the wave, solved live from the Schrödinger equation (brightness = how likely the particle is there, colour = the wave’s phase). Right: the detector screen far away, where each particle lands as one dot. One dot tells you almost nothing; thousands of them draw the stripes.
Which-path detector
With D = 1 every particle is marked with its slit: the stripes vanish and the screen shows two single-slit humps added together. With a weaker detector the stripes fade to visibility V = √(1 − D²).
Wave picture
What you are seeing. The wave goes through both slits; behind the wall the two parts overlap, and where crest meets crest the wave is strong, where crest meets trough it cancels. Each particle is still detected at one single spot. Where it lands is random, but the chance of each spot follows the wave’s brightness, so the stripes appear only after many particles.
Dark stripes are where the paths from the two slits differ by half a wavelength: d sinθ = (m + ½)λ. The whole pattern sits inside the hump of a single slit, whose first zero is at a sinθ = λ.
Pilot-wave paths (the de Broglie–Bohm interpretation) draw one possible path for each particle, steered by the wave with velocity v = (ℏ/m) Im(∇ψ/ψ). Starting points are drawn at random from |ψ|², and the paths bunch into the bright stripes. Standard quantum mechanics predicts the same dots without saying what path the particle took; interpretations differ on that question, not on the measured pattern.
Honest scaling. Real experiments have slits tens of thousands of wavelengths apart, so the stripes are very close together. The wave picture keeps the real shape (the ratio d : a and the number of slits, so the same number of stripes per hump) but draws the wavelength much bigger so you can see it. The screen on the right uses your real numbers. The wall in the picture is a high potential step a few cells thick; real slits are thin plates.
A wave packet and its momentum are two views of the same wave: one is the Fourier transform of the other. Squeeze the packet (slider, or drag sideways on the left picture) and watch the momentum spread out. The product Δx·Δp can never go below ℏ/2, and only the Gaussian reaches it.
Units in this picture: lengths in a unit u, momentum in ℏ/u, time in m·u²/ℏ (so ℏ = m = 1). The calculators below use real units.
Why it happens. To make a short, sharp bump you have to add up waves of many different wavelengths, and wavelength is momentum (p = h/λ). A long, smooth wave needs only a few. So a packet that is well located (small Δx) has a wide spread of momenta (large Δp). This is a property of waves, not of clumsy measuring.
Let it go. A free packet keeps its momentum spread, so its fast parts run ahead of its slow parts and it spreads out. For any packet whose shape starts out real, Δx(t)² = Δx₀² + (Δp t/m)²; for the Gaussian, Δp = ℏ/(2Δx₀), which gives the formula below. The narrower you make it, the faster it spreads.
Single slit: a narrow slit spreads the beam
Squeezing the beam sideways (slit width a, so Δy ≈ a) forces a sideways momentum spread Δpy ∼ h/a, so the beam fans out by about λ/a.
Real-scale calculator
A source in the middle sends out pairs of entangled particles. Alice (left) and Bob (right) each turn a dial and get a result of +1 or −1 for every particle. Each list on its own looks like coin flips, but compare the two lists and the results match far more strongly than any “the answers were decided at the source” story allows. Run the CHSH test and watch the number S go above the classical limit of 2.
The CHSH scoreboard
| Settings | Angle apart | Pairs | ++ / +− / −+ / −− | E measured | E expected |
|---|
E = (same − different) / pairs, between −1 (always opposite) and +1 (always the same). S = |E(a,b) − E(a,b′) + E(a′,b) + E(a′,b′)|. The ± is one standard error (√((1 − E²)/N) for each E, added in quadrature for S), so with more pairs the measured S settles on the expected one.
Correlation against the angle between the dials
The quantum curve and the straight-line hidden-variable curve touch at 0°, 45° and 90° (photons) but differ in between: the best CHSH angles sit exactly where the gap is largest. Every pair you measure adds a point at its own angle difference, so use “Fixed dials” and turn a dial to fill in the curve.
No faster-than-light messages
Can Alice send Bob a message by choosing her angle? Look at Bob’s results split by what Alice chose:
| Pairs | Bob got +1 | Alice got +1 |
|---|
Bob’s +1 rate stays at 50% whatever Alice does (the small wobble is chance and shrinks as pairs pile up). That is true for every angle, exactly: on his own, Bob only ever sees a fair coin. The pattern appears only when the two lists are brought together and compared, and that comparison has to travel by ordinary means, no faster than light. So entanglement gives correlation without signalling.
The last 24 pairs, newest on the right. “=” means the two results were the same, “≠” different. In CHSH mode the small letters show which angle each side used.
Why 2 is the limit for hidden variables. Suppose each pair leaves the source carrying instructions: “if your dial is at a, say +1; at a′, say −1”, and so on, and that Alice’s answer cannot depend on Bob’s dial (locality). Then for each single pair the four products A(a)B(b) − A(a)B(b′) + A(a′)B(b) + A(a′)B(b′) = A(a)[B(b) − B(b′)] + A(a′)[B(b) + B(b′)]. One bracket is 0 and the other is ±2, so every pair contributes exactly +2 or −2, and the average can never be bigger than 2. Bell’s 1964 model (each pair carries a random hidden angle; each side answers + if its dial is within 45° of it for photons, 90° for spins) reaches exactly 2 at the best angles, which is as well as any local model can do there. Quantum mechanics reaches 2√2.
What this simulation is. The quantum source draws each pair’s two results together from the joint probabilities above, with a seeded random number generator. That is the honest way to reproduce quantum predictions on one computer; it is not a model of how nature does it. The two hidden-variable sources really are local: Alice’s answer is computed from her own dial and the shared hidden angle only. Detectors here are perfect and every pair is counted, which real experiments had to work hard to approach (see the loopholes below).
The real experiments
| Year | Who | What they did |
|---|---|---|
| 1935 | Einstein, Podolsky, Rosen | Argued that quantum mechanics must be incomplete: perfectly correlated far-apart particles should carry their answers with them. |
| 1964 | John Bell | Showed that any such local hidden-variable theory must obey an inequality that quantum mechanics breaks, so the question could be tested. |
| 1969 | Clauser, Horne, Shimony, Holt | The CHSH form of the inequality (the S ≤ 2 used here), suited to real detectors. |
| 1972 | Freedman & Clauser (Berkeley) | Photon pairs from a calcium atomic cascade: the inequality was violated by about six standard deviations, in agreement with quantum mechanics. |
| 1982 | Aspect, Grangier, Roger; Aspect, Dalibard, Roger (Orsay) | Two-channel polarizers gave S = 2.697 ± 0.015 against the quantum prediction of 2.70. A second experiment switched the settings while the photons were in flight. |
| 1998 | Weihs, Zeilinger and colleagues (Innsbruck) | Settings chosen by fast random generators at each end, far enough apart that no light-speed signal could connect them in time. |
| 2015 | Hensen et al. (Delft) | Electron spins in diamond 1.3 km apart, “loophole-free”: S = 2.42 ± 0.20 from 245 heralded trials. |
| 2015 | Giustina et al. (Vienna) and Shalm et al. (NIST, Boulder) | Photon pairs with high-efficiency detectors and fast random settings, also closing the locality and detection loopholes together (they used the Clauser-Horne / Eberhard form of the inequality). |
| 2022 | Nobel Prize in Physics | Alain Aspect, John Clauser and Anton Zeilinger, “for experiments with entangled photons, establishing the violation of Bell inequalities and pioneering quantum information science”. |
Loopholes, one line each
- Locality loophole: if the settings are chosen too slowly, a light-speed signal could tell one side what the other picked. Fix: choose settings at random after the particles leave, far enough apart.
- Detection (fair-sampling) loophole: if many particles go undetected, the counted ones might be a biased sample. Fix: detect a large enough fraction of all pairs.
- Freedom-of-choice loophole: the “random” settings might be correlated with the hidden variables. Narrowed by using quantum random generators, distant starlight and even human choices.
- Memory loophole: hidden variables could use earlier trials; handled by statistics that don’t assume independent trials.
What does it mean? (interpretations)
The experiments settle that no theory with local hidden variables and freely chosen settings matches nature. They do not say which assumption to give up, and physicists still disagree:
Non-locality (e.g. de Broglie-Bohm pilot-wave theory, collapse theories): the measurement on one side really does affect the other, but in a way that cannot be used to send messages. Copenhagen-style views: there were no definite values before measurement; the quantum state is a tool for predicting results. Many worlds: every outcome happens, and the correlation shows up when the branches of Alice and Bob meet. Superdeterminism: the settings were never independent of the particles, so the inequality’s assumption fails. Each fits all the data here; the simulator only shows the predictions.
A Stern-Gerlach magnet has an uneven magnetic field that pushes a magnetic atom up or down depending on which way its tiny magnet points. Classically you would expect a smear. Silver atoms make two spots. Line up to four magnets, turn each one, block an output or recombine them, and fire atoms one at a time to see the quantum rules at work.
Amplitudes, step by step
| Magnet | Angle | Beam arriving | Amplitudes | Probabilities | Atoms arriving (of all) |
|---|
An amplitude is the number whose square is the probability. For spin ½ turned by an angle θ from the beam’s own spin direction the amplitudes are cos(θ/2) and sin(θ/2), so the chances are cos²(θ/2) and sin²(θ/2). A beam from the hot oven has no single spin direction (a 50/50 mixture), so it has no amplitudes, only probabilities.
Z then Z: atoms that came out “up” from the first magnet all come out up again. The answer is repeatable.
Z then X: a magnet turned 90° splits them 50/50. Knowing the spin along Z tells you nothing about X.
Z, X, Z: keep only the up-along-X atoms, then measure Z again: half come out down, although every one of them was up along Z two magnets earlier. Measuring X wiped out the Z information.
Recombined: if the X magnet’s two beams are brought back together with nothing recording which one an atom took (a careful “Stern-Gerlach interferometer”, very hard in practice), the original spin comes back intact and the last magnet sends every atom up. Put a detector on the paths (“watched”) and the 50/50 split returns: it is the which-path record, not the magnet, that destroys the information.
What is drawn. The magnets are drawn side on, splitting beams up and down whatever their angle, with the angle shown on each dial; the passing beam is re-centred before the next magnet. The spot sizes and spacing are schematic. The probabilities are exact quantum mechanics; each atom’s path is picked at random from them.
The 1922 experiment
Otto Stern and Walther Gerlach sent a beam of silver atoms from an oven through an uneven magnetic field in Frankfurt in 1922 and collected them on a glass plate. Classical physics expected the atoms’ magnets to point every which way and paint a continuous band. Instead the deposit split into two separate parts. At the time it was read as proof of Bohr and Sommerfeld’s “space quantization”; the real reason, the electron’s spin (a silver atom’s magnetism comes from one unpaired electron), was only proposed by Uhlenbeck and Goudsmit in 1925. Chains of magnets like the ones above are the classic thought experiments used to teach spin (Feynman, Sakurai); with spin-½ atoms the two spots are the whole story.
The electron in a hydrogen atom is not a little ball on an orbit. It is a standing wave ψnlm around the proton, and |ψ|² tells you where you are likely to find it. Every picture below is drawn from the exact solution of the Schrödinger equation for hydrogen, computed live in your browser.
What you see. A slice shows |ψ|² in one flat plane through the atom: brighter = more likely. The colour is the sign of the wave (orange +, blue −), or with complex m states its phase (the colour wheel turns m times around the z axis). The 3D cloud is a set of random “where was the electron found?” dots, drawn exactly from |ψ|². The radial view adds up all directions: P(r) = r²R² is the chance of finding the electron at distance r.
Nodes. The wave is zero on n − 1 surfaces: n − l − 1 spheres (radial nodes) and l cones or planes (angular nodes). More nodes = more wiggles = higher energy, just like a guitar string.
Energy levels, jumps and the colours of hydrogen
The electron sits on one level. Click another level to make it jump: going down it sends out a photon, going up it must absorb one. The photon’s energy is the gap between the levels, so its wavelength is fixed. That is why hydrogen glows in a few sharp colours.
Bohr’s model and the quantum cloud. Bohr (1913) pictured the electron on circular orbits of radius n²a0 and got these energies exactly right, which is why the line colours match. But it fails elsewhere: it gives the ground state angular momentum ℏ (the real value is 0: a 1s electron does not circle at all), it cannot explain line brightness or atoms with more electrons, and it says nothing about the shapes above. In the full theory the radius n²a0 survives only as the most likely radius of the orbitals with l = n − 1 (try 2p, 3d, 4f in the radial view: the peak sits exactly at 4, 9, 16 a0).
Quick quantum numbers, live as you type. Type a value with its unit (500 nm, 2 eV, 1e-10 m, 0.5c, 25 °C) or pick the unit from the menu. Each card shows the formula, your numbers plugged in, and what the answer means.
de Broglie wavelength
Photon energy, wavelength and frequency
Heisenberg uncertainty
Tunnelling through a rectangular barrier
Particle in a box (and dye colours)
Bohr model (hydrogen-like ions)
Rydberg formula and spectral line finder
Compton scattering
Blackbody radiation
Thermal de Broglie wavelength
Constants: CODATA 2018 (h, e and c are exact in SI). Non-relativistic formulas are used where the card says so; the de Broglie card is fully relativistic. The tunnelling and box cards are idealized models (flat barrier, infinitely high walls).
More quantum and wave pages on MES
The double slit experiment, live in your browser
This free simulator shows the most famous experiment in quantum physics two ways at once. On the left, the wave of a particle is solved live from the Schrödinger equation as it hits a wall with one, two or more slits. On the right, a detector screen far away records particles one at a time, each as a single dot. Each dot lands at a random place, but the chance of each place follows the wave, so after a few hundred or thousand dots the familiar light and dark stripes appear.
What you can do
- Pick a real particle: electrons, neutrons, C60 buckyballs or photons, and set its energy. The page works out the de Broglie wavelength λ = h/p (with relativity for fast electrons) and the stripe spacing λL/d on a screen at distance L, in real units.
- Change the slit width, the slit separation and the number of slits, with the sliders or by dragging the slits in the picture. One slit gives a single wide hump; two slits give stripes inside that hump; five or more slits give the sharp bright lines of a diffraction grating.
- Set how many particles arrive per second, from one at a time (with an optional click per arrival) to thousands per second, and watch the histogram turn into the predicted curve.
- Switch on a which-path detector. When it marks every particle with the slit it used, the stripes disappear and the screen shows two single-slit humps added together. A weaker detector leaves fainter stripes, with visibility V = √(1 − D²).
- Show pilot-wave paths: the trajectories of the de Broglie–Bohm interpretation, where each particle follows the velocity v = (ℏ/m) Im(∇ψ/ψ) set by the wave.
How the simulator works
The wave picture uses the split-operator method: the wave function on a 256 × 256 grid (128 × 128 on phones) is moved forward in small time steps with fast Fourier transforms, with absorbing edges so waves leave the box instead of bouncing back. The wall is a high potential barrier a few cells thick. Real slits are tens of thousands of wavelengths apart, which could never be drawn, so the picture keeps the real shape (the ratio of separation to width and the number of slits) and draws the wavelength larger. The detector screen uses the exact far-field (Fraunhofer) pattern for your real numbers, I(θ) ∝ sinc²(πa sinθ/λ) cos²(πd sinθ/λ), and draws each arrival at random from it.
Real experiments
Thomas Young showed interference of light around 1801. Claus Jönsson made real double slits for electrons in 1961, and in 1989 Akira Tonomura’s team at Hitachi filmed single electrons building up the stripes one dot at a time. Neutrons were sent through a double slit by Anton Zeilinger and colleagues in the 1980s, and in 1999 Markus Arndt, Zeilinger and colleagues showed interference of C60 molecules, 60 carbon atoms each, through a grating with a 100 nm period. The presets use typical values in the style of these experiments, not the exact apparatus.
Uncertainty tab
The second tab shows a wave packet next to its momentum distribution (they are a Fourier pair). Squeeze the packet and the momentum spreads; the product Δx·Δp never goes below ℏ/2, and only a Gaussian reaches that limit. Release it and it spreads as Δx(t)² = Δx₀² + (Δp t/m)², compared live with the formula. A real-scale calculator shows why an electron in an atom moves at hundreds of km/s while a baseball’s uncertainty is far too small to notice.
Questions
Does the particle go through both slits?
The wave goes through both slits, and the measured pattern can only be explained by both parts overlapping. What the particle “really” does between source and screen depends on the interpretation: in the Copenhagen view the question has no answer without a measurement; in the de Broglie–Bohm (pilot-wave) view the particle goes through one slit and the wave through both; in the many-worlds view all possibilities happen. All of them predict the same dots.
Why do the stripes vanish when you watch which slit?
Any detector that can tell the slits apart leaves a mark that is different for the two paths, so the two parts of the wave can no longer interfere. Partial information gives partial stripes: the visibility V and the distinguishability D obey V² + D² ≤ 1.
Why are electron stripes so close together?
A 50 keV electron has a wavelength of about 5 picometres, so even with slits a micrometre apart the stripes on a screen 1 m away are only a few micrometres apart. Real electron experiments magnify the pattern with electron lenses.
Is the pattern different if particles are sent one at a time?
No. Even when only one particle is in the apparatus at a time, the dots still build up the same interference stripes. Each particle interferes with itself, not with the others.
