About Diffraction & Interference
This simulation shows a plane wave striking a barrier with one or more slits. By Huygens' principle, each slit becomes a source of circular wavelets that interfere to build a characteristic intensity pattern on a distant screen. The diffracted field is summed point by point across a 160×120 grid, while the yellow curve on the right plots the analytical Fraunhofer intensity, which for a double slit follows I = I₀ cos²(πd sinθ/λ) sinc²(πa sinθ/λ).
You choose between single slit, Young's double slit and a multi-slit grating, then adjust wavelength λ, slit width a, slit separation d and (for the grating) the number of slits N. The stats panel reports the central maximum, the first single-slit minimum, the fringe spacing and the source count. Diffraction matters everywhere waves meet apertures: it sets the resolution limit of telescopes and microscopes and underpins spectrometers.
Frequently Asked Questions
What is diffraction and interference?
Diffraction is the spreading of a wave as it passes through an opening or around an obstacle. Interference is the way overlapping wavelets reinforce one another where crests meet and cancel where a crest meets a trough. Together they produce the bright and dark bands you see on the screen.
How does the simulation compute the wave field?
Each slit is replaced by a set of point sources spanning its width. For every pixel past the barrier the program sums sin(k·r − ωt) from each source, divided by √r to mimic the falloff of a cylindrical wave. The combined amplitude is mapped to a red-black-blue colour scale showing crests and troughs in real time.
What do the three slit modes do?
Single slit gives a broad central maximum that narrows as the slit widens. Double slit produces closely spaced interference fringes modulated by the single-slit envelope. Grating uses N slits to create sharp, bright maxima that become narrower and more intense as N increases.
What is the equation behind the intensity curve?
For two slits the Fraunhofer intensity is I = I₀ cos²(πd sinθ/λ) sinc²(πa sinθ/λ). The cos² term is the two-slit interference, the sinc² term is the single-slit diffraction envelope, and for the grating the cos² factor is replaced by the N-slit term sin²(Nδ)/sin²(δ).
What do the controls change?
Wavelength λ sets the spacing between fringes; longer λ spreads the pattern wider. Slit width a controls the diffraction envelope; a wider slit gives a narrower central maximum. Slit separation d sets the fringe spacing through Δy = λL/d, and N adds more grating slits for sharper peaks.
Why are the fringes evenly spaced for the double slit?
For small angles sinθ is roughly θ, so the bright fringes fall at regular intervals Δy = λL/d on the screen, where L is the slit-to-screen distance. The simulation reports this fringe spacing directly. The single-slit envelope then dims the outer fringes, which is why they fade away from the centre.
Is the simulation physically accurate?
The plotted intensity uses the exact Fraunhofer formula, so the positions of maxima and minima are correct. The animated field is a simplified Huygens sum with a few discrete sources per slit rather than a continuous integral, so it captures the qualitative pattern faithfully while keeping the calculation fast in the browser.
What is the difference between Fraunhofer and Fresnel diffraction?
Fraunhofer (far-field) diffraction assumes the screen is far enough that the wavefronts arriving at it are effectively plane, giving the clean formulas used here. Fresnel (near-field) diffraction applies close to the aperture, where the curvature of the wavefronts matters and the pattern is more complex. This simulation models the Fraunhofer regime.
Why does increasing N sharpen the grating peaks?
With more slits, the N-slit interference term sin²(Nδ)/sin²(δ) has narrower principal maxima and N−2 small secondary maxima between them. As N grows the bright lines become thinner and brighter, which is exactly why high-quality diffraction gratings use thousands of lines per millimetre to separate colours precisely.
What are the real-world uses of diffraction?
Diffraction gratings split light into spectra for chemical analysis in spectrometers and astronomy. Diffraction also sets the resolving power of telescopes and microscopes through the Rayleigh criterion, explains the colours on CD and DVD surfaces, and is the basis of X-ray crystallography used to determine molecular structures.