Every quantum algorithm's advantage ultimately comes down to interference: arranging for the amplitudes leading to wrong answers to cancel while the amplitude leading to the right answer reinforces. This simulator isolates that idea in the simplest possible circuit — Hadamard, phase shift, Hadamard — and shows the two contributing amplitude paths as both phasors and waves.
• A phase-shift slider controlling the relative phase applied to the |1> branch mid-circuit. • A phasor diagram showing both path contributions to the |0> outcome and their vector sum. • A paired sine-wave visualization illustrating the same combination as overlapping waves. • One-click jumps to fully constructive (phi=0) and fully destructive (phi=180) interference. • Live final-measurement probability bars computed directly from the combined amplitude.
• Jump to constructive interference and confirm P(0) reaches 100% — both paths reinforce completely. • Jump to destructive interference and confirm P(0) drops to 0% — both paths cancel completely, and the qubit is certain to measure 1. • Sweep the phase slider continuously between the two extremes and watch the phasor sum shrink, vanish, then regrow as the waves shift from in-phase to out-of-phase and back.
Neither path is ever "turned off" — both amplitudes are always present and always contribute. What interference changes is how they combine at the point they meet again. This is exactly the mechanism quantum algorithms use deliberately: route computation so that undesired outcomes' amplitudes end up out of phase and cancel, while the desired outcome's amplitudes end up in phase and reinforce, concentrating the final measurement onto the useful answer.
It is the combination of two or more probability amplitudes heading toward the same measurement outcome. Depending on their relative phase, they can add constructively (reinforcing each other, increasing that outcome's probability) or destructively (canceling, decreasing or eliminating that outcome's probability).
Because amplitudes are complex numbers, not plain probabilities, two paths contributing to the same outcome can have opposite phase and sum to zero amplitude for that outcome — exactly the way two sound waves out of phase can cancel to silence at a particular point, even though neither wave individually is silent.
It is the same underlying physics of amplitude combination, applied to a qubit's two computational-basis paths instead of a photon's two spatial paths through two slits. Both are expressions of the same rule: sum the complex amplitudes for every way an outcome can occur, then square the magnitude of that sum to get the probability.
A well-designed quantum algorithm arranges its gates so that amplitudes leading to wrong answers interfere destructively and cancel, while amplitudes leading to the right answer interfere constructively and reinforce — concentrating measurement probability onto the useful outcome far more efficiently than checking every possibility one at a time classically.