Quantum Circuits
How to read circuit diagrams and compose gates into circuits that act on one or two qubits.
A quantum circuit is a recipe: horizontal wires carry qubits through time (left to right), and gates are the boxes you drop onto those wires. Reading one is like reading sheet music — each column is a moment, and the symbols tell you which operation happens to which qubit.
Build a circuit below by adding gates, then step through it. The diagram lights
up gate by gate while the state vector and probabilities update underneath. The
default H then CNOT is the standard way to create an entangled Bell pair.
Reading the diagram
- Each wire is one qubit, labeled
q0,q1, …, starting in . - A boxed letter (
H,X,Z) is a single-qubit gate applied at that moment. - CNOT is drawn as a filled dot (the control) connected to a (the target). When the control is , the target flips.
- The
Mat the right edge is measurement, which collapses the state to a classical bitstring.
Time flows left to right, so the circuit means “apply , then ” — order matters, because gates generally do not commute.
Composing single-qubit gates
Stacking gates on one wire just multiplies their effects. Try H then Z then
H on q0: the surrounding Hadamards turn the otherwise invisible phase flip
into a visible bit flip, ending in . This identity is a first
taste of how interference is engineered by sequencing gates.
Two-qubit states
With two qubits the state vector has four amplitudes, ordered :
Apply H on q0 and the amplitude spreads across and .
Add CNOT and those become and — a state you cannot
factor into “q0 does this, q1 does that.” That non-factorable result is
entanglement, produced by a circuit just two gates long.
Building intuition
A few patterns worth trying in the builder:
X q1alone → the state moves to (rememberq0is the left digit).H q0,H q1→ all four outcomes equally likely (uniform superposition).H q0,CNOT→ the Bell state: only and survive.
Notice the probabilities always sum to 1 at every step — each gate is unitary, so it shuffles amplitude around without ever creating or destroying it.
Takeaways
- Circuit diagrams read left to right; wires are qubits and boxes are gates.
- CNOT (control dot + target ) is the workhorse two-qubit gate that builds entanglement.
- Composing gates multiplies their effects; order matters and every step preserves total probability.