The Hadamard Gate: The First Step of Every Quantum Algorithm
> Prerequisite navigation: You need episodes 014 (the H gate table), 017 (left/right bases and the "translator"), and 020 (the three-gate set and rotations). > Next episode preview: 022, "CNOT: The Shortest Path to Entanglement."
A half-silvered mirror is the protagonist of this post.
A piece of glass coated with a film so thin that "half the light passes through, half is reflected"—fire a single photon at it, and it either goes through or bounces back. Looking at just this one mirror, you see the plot of episode 002: a binary choice. But the real show happens at the second mirror: let the photon pass one half-silvered mirror first, then place a second one where the two paths reunite, and you observe something strange—
> When the angle is set correctly, only one output port has light. The other one receives not a single photon.
Even though the first mirror gave the photon two paths, the second mirror keeps one exit permanently dark. This is not a trick of probability (a purely random die cannot produce "always"), but the first time you witness with your own eyes what episode 004 promised: the amplitudes of the two paths cancel each other at the dark exit.
The mathematical identity of this mirror is the protagonist of this post: the H gate.
Straightening Out the Table
Episode 014 first presented the H gate's two-row table, asking you only to memorize two strange numbers:
- H acting on |0⟩ → (1/√2)|0⟩ + (1/√2)|1⟩, i.e., |+⟩ (named in episode 017);
- H acting on |1⟩ → (1/√2)|0⟩ − (1/√2)|1⟩, i.e., |−⟩.
- The total paths "transmit both times" and "reflect both times" converge on the same output port—the two amplitudes point the same way, add up, and the port is fully lit;
- "Transmit then reflect" and "reflect then transmit" converge on the other output port—the two amplitudes are anti-aligned (the minus sign from episode 014's table pays off here), cancel, and the port is fully dark.
- Disanalogy one: a mirror "half transmit, half reflect" sounds like splitting the photon into two halves, each going its own way; in reality the amplitude of the whole photon splits into two branches (the core of episode 013), and both branches fully "belong" to that photon—you can intercept the entire photon on either path, never "half" of one.
- Disanalogy two: everyday reflection happens only when light hits the surface; the two amplitude branches of a quantum beam splitter know of each other's existence (the adding and canceling at the second mirror is the evidence)—this is the wave's territory (episode 013's "add first, square later"); the world of marbles has no such thing.
Now you can understand those 1/√2 values: as episode 016 said, a "fifty-fifty probability" is written as 1/√2 in the amplitude world—squaring it gives exactly 1/2. And the minus sign on the |1⟩ path is the star of episode 019: a relative phase of 180 degrees. What the H gate does, in one sentence:
It translates the two definite states "up/down" into the two definite states "left/right"—the North Pole becomes |+⟩ on the equator, the South Pole becomes |−⟩.
Episode 017 called it a translator; today we add the geometric detail: moving the North Pole to the equator is a quarter-circle rotation (in episode 020's rotation language: H is a half-turn around an axis "tilted at 45 degrees"—starting from the pole, a half-turn lands exactly on the equator). You don't need to memorize a formula, just the picture: H tips vertical arrows down to horizontal, and stands horizontal arrows back up.
Turn It Twice, Return to the Start
The translator's other identity: it can translate itself back.
|+⟩ through H again → back to |0⟩; |−⟩ through H again → back to |1⟩. A gate applied twice equals doing nothing (in episode 018's unitary family this class is called "involutory"—no need to memorize the term). This has a beautiful physical verification: exactly the two half-silvered mirrors from the opening.
Think through the full optical path: the first beam splitter (the first H) splits the photon into two paths; the second beam splitter (the second H) recombines them. At the recombination:
So "turning twice returns to the original state" is no longer an abstract algebraic property but an optical path you can see: starting from |0⟩, after H·H you are back at |0⟩—the bright port corresponds to |0⟩, the dark port to |1⟩, not one photon more or less. Episode 004 said "quantum computing's power comes from making wrong answers cancel each other"—this is its cleanest physical demonstration: cancellation needs no elaborate machinery; the entire principle hides inside two mirrors.
Why It Is "the First Step of Every Algorithm"
Now back to the title question. Recall the sign from episode 005: a quantum computer is not a "machine that computes all answers simultaneously"; superposition alone is not computing power—only superposition that can interfere counts. And interference presupposes superposition in the first place.
Consider the step where classical input enters the quantum machine: information from the classical world can only be definite states—|0⟩, |1⟩, |01⟩, |1011⟩, all arrows pointing straight at the poles (or at "grid points" of multi-qubit space). Definite states cannot interfere—each amplitude occupies its own cell alone; there is no "multiple paths arriving at the same cell," and cross terms (episode 016) never arise. To turn definite states into raw material capable of interference, the first step is always to tip the arrows off the poles and spread them into superposition—and the executor of this step is the H gate (episode 020 noted it can be built from the three-gate set plus angles, but H is used so often that hardware reserves it a dedicated seat).
So the first layer of almost every quantum algorithm's circuit diagram is a row of H's: search algorithms (episode 033) first spread all drawers into uniform superposition; the two "quick proof" algorithms of episodes 031/032 are essentially minimal demonstrations of "H spreads → ask the black box once → interference harvests"; even the Fourier transform of episode 036 has rows of H's little siblings standing at both entrance and exit. H performs no "computation" itself; it adjusts the stage lighting from classical to quantum—the play only begins from there.
One commonly mangled point, reinforced here (episode 017 established this): measure after the H gate and you get pure 50/50 randomness—but the H gate is not a "random number generator." Its output is a completely definite state (|+⟩ or |−⟩, unambiguous); randomness only appears at the moment "you interrogate a left/right state with the up/down basis" (the geometric inevitability of episode 017). Using H as a die is the biggest misunderstanding of it—its proper job is changing the axis; randomness is merely the by-product of asking along the wrong axis.
Dismantling the Analogy
Where the beam-splitter analogy is borrowed:
Luggage to Take Home
1. H = translator and tipper: translates |0⟩/|1⟩ into |+⟩/|−⟩ (tips arrows from the poles to the equator), and returns to itself after two applications—the minus sign and 1/√2 are respectively the relative phase and the "fifty-fifty amplitude." 2. The physical version of H·H = I is two half-silvered mirrors: one exit constructively bright, one destructively dark—"making wrong answers cancel" becomes visible and tangible for the first time. 3. The first step of every algorithm: definite states cannot interfere; only after spreading arrows into superposition is there anything to interfere with. The row of H's opening almost every circuit diagram sets the stage to quantum lighting. H is not a die—it is an axis-changer.
Hook for the next stop: the single-qubit dance moves are complete, but episode 003's protagonist—entanglement—has yet to appear at the "operation" level. We need a two-qubit gate that turns "if the first qubit is 1, flip the second" into a legitimate quantum operation. Episode 022: "CNOT: The Shortest Path to Entanglement."
*(Original hashtags: quantum computing, from-coins-to-error-correction, H-gate, interferometer.)*