Quantum circuit

On this page 7

A quantum circuit is an ordered sequence of quantum gates, measurements and resets applied to a register of qubits, and it is the standard way to write, analyze and execute programs in quantum computing. Each wire in the circuit represents one qubit evolving in time from left to right, and each gate is a unitary operation that transforms the joint quantum state of the qubits it touches.

The circuit is the working language of the field: algorithms are published as circuits, compilers rewrite circuits, and hardware executes circuits. Its cost is described by a few numbers, above all the qubit count, the gate count and the circuit depth, which together decide whether a program can finish before noise destroys the result.

How a quantum circuit is structured

A quantum circuit consists of wires, gates and measurement operations arranged on a time axis. The qubits usually start in the all-zero state, gates act on one, two or occasionally three qubits at a time, and measurements at the end convert the quantum state into classical bits.

Mathematically, the gates between preparation and measurement multiply into one large unitary matrix of dimension 2^n for n qubits. Gates in the same time step that touch different qubits combine by the tensor product, while consecutive gates combine by matrix multiplication, read in the reverse order of the diagram. This is why a circuit of 50 qubits cannot be simulated naively: the state vector holds about 10^15 complex amplitudes.

The table below lists the building blocks that appear in almost every circuit diagram.

ElementDiagram symbolRole in the computation
Qubit wireHorizontal lineCarries one qubit through time
Classical wireDouble lineCarries a measured bit
Single-qubit gateLabeled box (H, X, T)Rotates one qubit state
Controlled gateDot linked to a targetActs only when the control is 1
MeasurementMeter symbolProjects a qubit onto 0 or 1
ResetBox marked with a zeroReturns a qubit to the zero state
BarrierDashed vertical lineStops the compiler from reordering
Elements of a quantum circuit diagram

Metrics that describe circuit cost

The resources a quantum circuit consumes are summarized by a small set of cost metrics, and each one constrains a different part of the hardware. Width is the number of qubits, depth is the number of sequential layers of gates, and gate count is the total number of operations, often reported separately for expensive gates.

On current noisy hardware, the two-qubit gate count usually dominates, because two-qubit gates have error rates of roughly 0.1 to 1 percent, about ten times higher than single-qubit gates. On future fault-tolerant machines the critical figure becomes the T count, because each T gate requires costly magic state distillation.

MetricWhat it countsWhy it matters
WidthQubits used, including ancillasLimited by the device size
DepthSequential gate layersMust fit within coherence time
Two-qubit gate countCNOT, CZ or iSWAP operationsMain error source on noisy devices
T countNon-Clifford T gatesDominant cost under error correction
Shot countRepeated executionsSets statistical precision of results
Main cost metrics of a quantum circuit

A circuit is only useful if its depth multiplied by gate time stays well below the qubit coherence time. For superconducting qubits with coherence of about 100 microseconds and two-qubit gates of a few hundred nanoseconds, the practical depth budget is in the hundreds of layers, not thousands.

From an abstract circuit to hardware execution

An algorithm written as a circuit cannot run directly on a device; it must first be compiled, or transpiled, into the native gate set and the connectivity of the target processor. The compiler performs several passes, each of which can change the depth and gate count substantially.

  1. Decomposition rewrites multi-qubit gates such as the Toffoli gate into one- and two-qubit gates.
  2. Qubit mapping assigns logical qubits to physical qubits on the chip.
  3. Routing inserts SWAP gates when interacting qubits are not physically adjacent.
  4. Optimization cancels redundant gates and merges consecutive rotations.
  5. Scheduling fixes the timing of each operation and its control pulses.

Routing is often the largest source of overhead. On a processor with nearest-neighbor connectivity, each SWAP costs three CNOT gates, so a poorly mapped circuit can triple its two-qubit gate count. Trapped-ion devices offer all-to-all connectivity and avoid most routing, but their gates are slower.

Common classes of quantum circuits

Quantum circuits fall into several recognizable families that differ in structure, purpose and tolerance to noise. The comparison below shows how they relate to neighboring concepts such as the parameterized quantum circuit and measurement-based quantum computing.

Circuit familyDefining featureTypical use
Clifford circuitOnly H, S and CNOT gatesError correction, efficiently simulable
Parameterized circuitRotation angles set by an optimizerVariational algorithms on noisy devices
Dynamic circuitMid-circuit measurement with feedbackError correction, teleportation
Oracle circuitEncodes a function reversiblySearch and period finding
Random circuitGates sampled from a setBenchmarking and supremacy tests
Families of quantum circuits and their typical use

The distinction between Clifford and non-Clifford circuits is fundamental. By the Gottesman–Knill theorem, a circuit built only from Clifford gates can be simulated efficiently on a classical computer, so quantum advantage requires non-Clifford gates such as the T gate.

Limitations and frequent misconceptions

Quantum circuits are noisy, probabilistic and costly to verify, and several popular beliefs about them are wrong. Understanding these limits is essential when reading claims about circuit size or performance.

  • A circuit does not return one answer; it returns samples from a probability distribution, so it must be run thousands of times.
  • More qubits do not guarantee more power if depth is limited by noise; quality matters as much as count.
  • Measurement is irreversible and destroys superposition, so intermediate values cannot be inspected freely.
  • Classical simulation fails quickly: exact state-vector simulation becomes impractical beyond about 45 to 50 qubits.

The table below links typical symptoms observed when running circuits to their usual cause and remedy.

SymptomLikely causeUsual remedy
Output close to uniform noiseDepth exceeds coherence budgetReduce depth or two-qubit gates
Results differ between runsToo few shotsIncrease the shot count
Large depth after compilationPoor qubit mappingUse noise-aware layout and routing
Biased bit valuesReadout errorApply measurement error mitigation
Typical problems when running circuits

Stripped to the essentials

A quantum circuit is a recipe for a quantum computer. It lists which operations to apply to which qubits, and in what order, much like sheet music tells each instrument when to play.

Each line in the drawing is one qubit, and each box is a step that changes it. At the end, the qubits are measured and turn into ordinary zeros and ones. Because the machine is fragile, shorter recipes work better: every extra step adds a little noise, and too many steps blur the answer completely.

Where it is applied

A chemistry research team wants to estimate the ground-state energy of a small molecule such as lithium hydride on a cloud-accessible superconducting processor. The team writes a parameterized circuit of 8 qubits with alternating rotation layers and CNOT entangling layers, which an optimizer running on a classical computer adjusts between runs.

After transpilation to the device’s native gates and its heavy-hexagonal connectivity, the circuit grows from 40 to about 120 two-qubit gates because of routing. The team chooses a better initial qubit layout, cancels redundant rotations and brings the count down to about 70. Each parameter setting is run with 4,000 shots, and readout error mitigation is applied to the measured bits.

The final energy estimate lands within a few percent of the exact value. The outcome shows the central lesson of circuit design: careful compilation and low depth decide whether a quantum circuit produces a usable answer on real hardware.