Gates & circuits

quantum circuit

A quantum circuit is the most common way to write down a quantum program. Picture a piece of sheet music turned sideways: each qubit is a horizontal line, or wire, that you read from left to right as time moves forward. Along each wire you place gates, drawn as little boxes, which transform the qubits. At the far right you usually draw a measurement symbol, where you finally read out a 0 or 1 from each qubit. So a circuit is just a recipe: start the qubits in a known state (often |0>), apply a chosen sequence of gates, then measure.

The gates are not arbitrary scrambles. Each one is a reversible, unitary operation, which means in principle you could run it backward. Some gates act on a single wire (like H, which puts a qubit into a balanced superposition of |0> and |1>); others, like CNOT, span two wires and can entangle them so the qubits stop having independent stories. A small set of gates such as {H, T, CNOT} is universal: with enough of them you can build, to any desired accuracy, any computation a quantum computer can do, the same way a few logic gates suffice to build any classical chip.

The honest part is what happens at the end. The whole point of arranging gates carefully is to make the amplitudes of the wrong answers cancel out and the amplitudes of the right answer add up, through interference, so that when you measure you are likely to read out something useful. A circuit does not quietly try every answer and hand you the best one; you get a single random outcome each run, weighted by Born-rule probabilities, and you typically repeat the circuit many times to see the pattern. Designing the gate sequence so that interference favors the answer you want is exactly the hard and interesting work of quantum algorithm design.

q0: |0> --[H]--*-------- (measure) q1: |0> -------(+)------- (measure)

A two-wire circuit read left to right: H puts q0 into superposition, then a CNOT (control dot on q0, target on q1) entangles them, and both are measured at the end.

On today's NISQ hardware, every extra gate adds a little noise, so real circuits must be kept shallow and short; long, deep circuits will need error correction that does not yet exist at scale.

Also called
quantum gate modelcircuit model