Quantum Circuits & Gates
You'll be able to:
You can read a quantum circuit diagram, name the common single- and two-qubit gates (H, X, Y, Z, S, T, CNOT), and explain why arbitrary computations can be built from a small universal set.
A developer writing their first quantum program looks for the equivalent of an if-statement and does not find one. In the basic circuit model there are no branches, no loops over data, and no way to inspect an intermediate value without destroying the computation. The programming model is genuinely different, and the circuit is the whole of it.
Reading a circuit
A quantum circuit is drawn as horizontal wires, one per qubit, with time flowing left to right. Boxes on a wire are gates applied to that qubit; symbols spanning wires are multi-qubit gates. The diagram is the program, executed once per shot, and typically repeated many times because each run yields one probabilistic sample.
Every gate before measurement is reversible — it is a unitary operation, and running it backwards recovers the input. This is why there is no in-place deletion and no classical branching mid-circuit in the basic model: discarding information is not a reversible operation.
The gates worth knowing
H (Hadamard) creates superposition, mapping a definite 0 into an equal combination of 0 and 1. It appears at the start of most algorithms and again before measurement, where it converts phase differences into measurable amplitude differences — which is how interference becomes an observable result.
X, Y, Z are the Pauli gates. X is the quantum analogue of a classical NOT. Z leaves 0 alone and flips the sign of the 1 component, changing phase without changing measurement probabilities on its own. Y combines both.
S and T are finer phase rotations, applying quarter and eighth turns respectively. T is important out of proportion to its simplicity: it is the gate that makes a gate set universal, and it is also the most expensive to implement fault-tolerantly, which makes T-count a primary cost metric for real algorithms.
CNOT flips a target qubit conditional on a control qubit. It is the standard entangling gate, and entanglement is what any interesting multi-qubit computation requires.
Build a circuit from these gates and see what a measurement would give:
Lab
A circuit of up to five qubits
Gates, in order
- H on qubit 0
- CNOT: control 0, target 1
What a measurement gives
- 0050%
- 1150%
Qubit 0 is the left-most digit.
Runs in your browser. Nothing is sent or saved.
Why a small universal set suffices
A handful of gates — Clifford operations plus T, for instance — can approximate any unitary operation to arbitrary precision. The Solovay-Kitaev result guarantees this approximation is efficient, requiring only polylogarithmic overhead in the target precision.
The practical consequence is that hardware need only implement a small native gate set well, and compilers translate arbitrary algorithms into it. The insight that matters for cost estimation: this translation is not free, and the resource that dominates fault-tolerant cost is usually T-count, not total gate count. Two circuits of similar length can differ by orders of magnitude in real cost depending on how many T gates they require.
Failure modes
Classical control assumed — designs relying on mid-circuit branching. Signal: pseudocode with conditionals inside the quantum section.
Intermediate inspection — attempts to read state without collapsing it. Signal: an algorithm that checks a value and continues unchanged.
Gate count as cost — total gates used to estimate feasibility. Signal: a resource estimate that never mentions T-count.
Single-shot reasoning — expecting one execution to yield the answer. Signal: no repetition or sampling in the experimental design.
Explaining this to stakeholders
On the programming model: the program is a fixed sequence of reversible operations. You cannot look at a value partway through and take a different path, because looking destroys the computation.
On repetition: each run gives one sample from a distribution. We run it many times and read the pattern, closer to a physics experiment than to running a function.
On cost: not all gates cost the same. One particular gate type dominates the expense on error-corrected hardware, so we count those rather than counting operations.
Curated Materials
1.4hThe deep work happens here — the lesson is your briefing.
Live on aiqbench
This lesson's subject on the rest of the site, today.
In the news, last 30 days
- Improved quantum algorithm for factoring integers with Jacobi symbolarXiv ·
- Harness or Fine-Tuning? Execution-Verified Agents for Qiskit-to-CUDA-Q PortingarXiv ·
- Classiq Partners with Carahsoft to Distribute Quantum Software Across U.S. Public Sector ContractsQuantum Computing Report ·
Test your knowledge
5 questions in 100 seconds, on a page of its own. Read everything above first.
Test your knowledge →Module Mission
30–45 minWrite a 3-qubit circuit that transforms |000⟩ into an equal superposition over |000⟩ and |111⟩ (a GHZ state). Simulate it with Qiskit's Aer simulator and confirm the measurement distribution.
Loading your work…