Reading a circuit diagram
A quantum circuit is read like sheet music: time flows left to right, and each horizontal line is a single qubit traveling through the circuit. The boxes sitting on a wire are gates — operations you apply in order. Where a classical diagram pushes bits down wires, a quantum diagram pushes a quantum state through a sequence of reversible transformations.
Each qubit usually starts in the state |0>, drawn at the far left. A single-qubit gate like H (Hadamard) or X (a Pauli gate) is a box on one wire. Reading the picture below: the wire is the qubit, [H] is a gate applied to it, and the meter symbol at the right is a measurement.
┌───┐ ┌───┐
|0> ────┤ H ├─┤ X ├──── 📏
└───┘ └───┘
^wire ^gates ^measure
(the qubit) (applied (read out
in order) a result)The CNOT and entangling gates
Single-qubit gates can only do so much. To build interesting circuits you need a two-qubit gate, and the workhorse is the CNOT (controlled-NOT). It has a control qubit and a target qubit: if the control is |1>, it flips the target; if the control is |0>, it leaves the target alone. In a diagram the control is a solid dot and the target is a ⊕ (a circled plus), joined by a vertical line.
control ───●───
│
target ──⊕──
● = control qubit ⊕ = target (flips if control is |1>)The CNOT's real power shows up when the control is in superposition — a blend of |0> and |1>. Then there is no single classical answer to "is the control 0 or 1?", so the gate links the two qubits together into one shared state you cannot describe separately. That linkage is entanglement: measuring one qubit instantly tells you something about the other, because their outcomes are correlated, not because any signal travels between them.
Universal gate sets
There are infinitely many possible quantum operations, so it would seem hopeless to build them all. The good news mirrors classical computing: you don't need every gate, just a small universal kit. A universal gate set is a handful of gates that, combined in enough layers, can approximate any quantum operation to whatever precision you want.
One common universal set is {H, T, CNOT}: the Hadamard, the T gate (a small phase rotation), and the CNOT. With just these three you can build arbitrarily complex circuits. The H and T give you all the single-qubit moves; the CNOT supplies the entangling glue between qubits.
There's also a special gate worth knowing: the Toffoli, or controlled-controlled-NOT. It flips its target only when both controls are |1>, which lets it reproduce reversible versions of ordinary classical logic (like AND) right inside a quantum circuit — a useful bridge when an algorithm needs old-fashioned arithmetic on the way to a quantum result.
Measurement at the end
All those reversible gates eventually have to give you an answer, and the only way to extract one is measurement. This is the honest heart of quantum computing, so it's worth stating plainly: when you measure a qubit in state alpha|0> + beta|1>, you get either 0 (with probability |alpha|^2) or 1 (with probability |beta|^2). You never read out alpha and beta themselves — just one classical bit.
That single fact reshapes how quantum algorithms are designed. Because you only get one outcome per run, a good circuit uses interference to make the right answers reinforce and the wrong ones cancel *before* you measure — so the bit you read is likely to be useful. This is why "a quantum computer tries all answers simultaneously" is misleading: the parallelism is real inside the math, but measurement hands you exactly one result, and the whole craft is steering the amplitudes so that one result is the one you want.
A first circuit: a Bell pair
Let's put it together. A Bell pair is the simplest entangled state, and it takes just two gates on two qubits: a Hadamard on the first qubit, then a CNOT with the first as control and the second as target. Both qubits start in |0>.
- Start with two qubits, both in |0> (the state |00>).
- Apply H to qubit 0. It enters superposition, giving an equal blend of |00> and |10>.
- Apply CNOT with qubit 0 as control, qubit 1 as target. Now the |10> part flips its target to |11>, leaving an equal blend of |00> and |11>.
- Measure both qubits. You get 00 or 11 — each about half the time — but never 01 or 10.
┌───┐
q0 |0> ────┤ H ├──●──── 📏
└───┘ │
q1 |0> ───────────⊕──── 📏
Result over many runs: 00 ~50% 11 ~50% (01, 10 never)The resulting state is (|00> + |11>)/√2. Read the outcomes honestly: each qubit on its own looks like a random coin (50/50), yet the two coins always agree. That perfect correlation — guaranteed agreement with no pre-set answer hidden inside either qubit — is entanglement you built yourself, from one Hadamard and one CNOT.