A photon entering mode 0 carries a complex probability amplitude. Each node is a Mach–Zehnder interferometer (MZI): a phase shifter φ on one arm followed by two 50/50 beamsplitters whose effective mixing angle θ is set by a second internal phase. Together they act as a programmable 2×2 unitary:
T(θ,φ) = e^(iθ/2)·
[ e^(iφ)sin(θ/2) cos(θ/2) ]
[ e^(iφ)cos(θ/2) −sin(θ/2) ]
Chaining six of these across a triangular 4-mode mesh (the Clements/Reck layout used on real silicon-photonic chips) builds up any 4×4 unitary matrix — the same primitive that programs a linear-optical quantum processor for boson sampling or a cluster-state computation. The bars on the right are the Born-rule probabilities |amplitude|² at each output port; they always sum to 1 because the mesh is unitary — interference only ever redistributes the photon, never destroys it.
- θ (split) — 0° sends the photon straight through that node's pair of modes; 180° swaps them completely; 90° is a balanced 50/50 mix.
- φ (phase) — shifts the relative phase between the two arms before they recombine, which is what makes the two paths interfere constructively or destructively rather than just averaging.
- Randomize — every θ/φ jumps to a random value, showing that generic mesh settings scramble the photon across all four outputs.
- Identity / Balanced — presets that route the photon straight through, or split it evenly, so you can see the two extremes before exploring in between.