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.
| Element | Diagram symbol | Role in the computation |
|---|---|---|
| Qubit wire | Horizontal line | Carries one qubit through time |
| Classical wire | Double line | Carries a measured bit |
| Single-qubit gate | Labeled box (H, X, T) | Rotates one qubit state |
| Controlled gate | Dot linked to a target | Acts only when the control is 1 |
| Measurement | Meter symbol | Projects a qubit onto 0 or 1 |
| Reset | Box marked with a zero | Returns a qubit to the zero state |
| Barrier | Dashed vertical line | Stops the compiler from reordering |
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.
| Metric | What it counts | Why it matters |
|---|---|---|
| Width | Qubits used, including ancillas | Limited by the device size |
| Depth | Sequential gate layers | Must fit within coherence time |
| Two-qubit gate count | CNOT, CZ or iSWAP operations | Main error source on noisy devices |
| T count | Non-Clifford T gates | Dominant cost under error correction |
| Shot count | Repeated executions | Sets statistical precision of results |
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.
- Decomposition rewrites multi-qubit gates such as the Toffoli gate into one- and two-qubit gates.
- Qubit mapping assigns logical qubits to physical qubits on the chip.
- Routing inserts SWAP gates when interacting qubits are not physically adjacent.
- Optimization cancels redundant gates and merges consecutive rotations.
- 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 family | Defining feature | Typical use |
|---|---|---|
| Clifford circuit | Only H, S and CNOT gates | Error correction, efficiently simulable |
| Parameterized circuit | Rotation angles set by an optimizer | Variational algorithms on noisy devices |
| Dynamic circuit | Mid-circuit measurement with feedback | Error correction, teleportation |
| Oracle circuit | Encodes a function reversibly | Search and period finding |
| Random circuit | Gates sampled from a set | Benchmarking and supremacy tests |
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.
| Symptom | Likely cause | Usual remedy |
|---|---|---|
| Output close to uniform noise | Depth exceeds coherence budget | Reduce depth or two-qubit gates |
| Results differ between runs | Too few shots | Increase the shot count |
| Large depth after compilation | Poor qubit mapping | Use noise-aware layout and routing |
| Biased bit values | Readout error | Apply measurement error mitigation |
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.