← Back to section · Quantum Computing

Controlled Gates: Writing Conditionals into Circuits and Building Entanglement by Hand

Starting from the block-matrix structure of controlled-U, this article explains the equivalence of CNOT and CZ, the ABC-decomposition construction of an arbitrary controlled single-qubit unitary, and the preparation circuits for Bell and GHZ states and how their entanglement differs.

Published 22 November 2026 · 6 min read · PQ Frontier

Controlled Gates: Writing Conditionals into Circuits and Building Entanglement by Hand
AI-generated site artwork
Video explainer · Quantum Gates & Circuits

Classical programs organize logic with “if … then …”. The corresponding structure in a quantum circuit is the controlled gate: designate a control qubit, and apply a unitary UU to a target qubit only when the control is in the state ∣1⟩|1\rangle. In matrix form, controlled-UU is block-diagonal, diag(I,U)\mathrm{diag}(I, U), in the basis {∣00⟩,∣01⟩,∣10⟩,∣11⟩}\{|00\rangle, |01\rangle, |10\rangle, |11\rangle\} — the subspace with control 0 is left untouched, the subspace with control 1 is acted on by UU. This seemingly simple structure is the hub of multi-qubit quantum computing: it is the standard tool for preparing entanglement and the universal means of making single-qubit operations conditional.

CNOT and CZ: two faces of the same entangling gate

The most common controlled gate is controlled-XX, the CNOT. Its twin is controlled-ZZ (CZ), with matrix diag(1,1,1,−1)\mathrm{diag}(1, 1, 1, -1): only when both qubits are 1 does the state acquire a minus sign. CZ has a property CNOT lacks — control and target are perfectly symmetric, because the condition “both qubits are 1” does not distinguish who controls whom. The two differ only by a pair of Hadamards on the target: CZ=(I⊗H) CNOT (I⊗H)\mathrm{CZ} = (I \otimes H)\, \mathrm{CNOT}\, (I \otimes H), since HZH=XHZH = X. This equivalence carries practical weight: the native two-qubit interaction of many superconducting chips naturally yields a CZ-type phase (the coupling between qubits accumulates a state-dependent phase), while circuit designers prefer to think in terms of CNOT — the compiler’s daily work is translating between these two faces. Incidentally, the very distinction between control and target is basis-dependent: viewed in the XX basis, a CNOT becomes a CNOT with control and target exchanged, which is another way of stating the phase-kickback phenomenon. Controlled-phase gates diag(1,1,1,eiθ)\mathrm{diag}(1, 1, 1, e^{i\theta}) generalize CZ and are the main components of the quantum Fourier transform circuit, which has its own article on this site.

Constructing an arbitrary controlled-U: the ABC decomposition

If the target operation is not XX or ZZ but an arbitrary single-qubit unitary UU, can controlled-UU still be assembled from elementary gates? Yes, and at a fixed cost. The key is an algebraic fact: for any UU one can find single-qubit gates A,B,CA, B, C such that

ABC=I,AXBXC=e−iαUABC = I, \qquad A X B X C = e^{-i\alpha} U

The circuit follows immediately: on the target qubit apply, in sequence, CC, then (CNOT), BB, then (CNOT), AA, and finally a phase gate on the control qubit correcting eiαe^{i\alpha}. When the control is 0, neither CNOT fires and the target experiences ABC=IABC = I — nothing happens; when the control is 1, the two CNOTs each insert an XX, and the target experiences exactly UU (up to the corrected phase). Hence any controlled single-qubit unitary = 2 CNOTs + some single-qubit gates, the classic construction of Barenco and co-workers from 1995. It shows that controlled structure requires no new physical interaction: as long as the hardware can do CNOT (or CZ) and arbitrary single-qubit gates, every controlled single-qubit operation is within reach. Multi-controlled gates such as the Toffoli exact a separate price, covered in their own article on this site.

Where controlled gates come from in hardware

An abstract circuit draws CNOT as a symbol, but hardware has no native “conditional flip” action — controlled gates must be assembled from interactions between qubits. Superconducting platforms take two main routes: cross-resonance drives the target qubit at the control qubit’s frequency to produce an effective ZXZX interaction, which single-qubit rotations then shape into a CNOT; tunable couplers instead bring two qubits briefly into resonance so that a phase accumulates only for joint states, naturally yielding CZ. In trapped ions, the laser-driven Mølmer–Sørensen interaction produces an XXXX-type coupling, which likewise combines with local rotations to give CNOT. The common theme: two-qubit gate error rates are typically an order of magnitude worse than single-qubit ones, and calibration is more delicate — coupling crosstalks onto spectator qubits, and conditional phases wander with frequency drift. This explains two rules of thumb at the compilation level: cost estimates are denominated in two-qubit gate counts, and “only 2 CNOTs” in the ABC decomposition deserves its emphasis — saving one CNOT in a controlled gate saves the most expensive class of operation in the circuit.

Preparing entanglement from circuits: Bell and GHZ states

The best-known use of controlled gates is making entanglement. The recipe is minimal: apply HH to the first qubit to obtain ∣+⟩|+\rangle, then a CNOT with it as control and the second qubit as target, and the product state ∣+⟩∣0⟩|+\rangle|0\rangle becomes the Bell state ∣00⟩+∣11⟩2\frac{|00\rangle + |11\rangle}{\sqrt{2}} — the two qubits’ measurement outcomes are perfectly correlated, yet neither has a definite value of its own; the other three Bell states follow by adding local XX or ZZ flips. Generalize the recipe — one HH followed by a cascade of CNOTs, each new qubit controlled by the previous one — and you obtain the nn-qubit GHZ state ∣0⋯0⟩+∣1⋯1⟩2\frac{|0\cdots0\rangle + |1\cdots1\rangle}{\sqrt{2}}. But entanglement is not one single thing. The W state ∣100⟩+∣010⟩+∣001⟩3\frac{|100\rangle + |010\rangle + |001\rangle}{\sqrt{3}} spreads a single excitation evenly over three qubits; preparing it requires controlled rotations with specific angles (of order arccos⁡13\arccos\frac{1}{\sqrt{3}}), not a simple CNOT cascade; and GHZ and W cannot be interconverted under stochastic local operations — they are mathematically distinct entanglement classes, such that losing one qubit destroys GHZ entanglement entirely while W retains entanglement between the remaining two qubits. Having prepared entanglement, one must also verify it is there. A common experimental approach measures the preparation fidelity: the overlap with the target Bell state decomposes into the combination of three correlation measurements, X⊗XX\otimes X, Y⊗YY\otimes Y, and Z⊗ZZ\otimes Z, so a few measurement settings estimate how close the state is to the target; in more stringent settings, a violation of a Bell inequality serves as a witness that the entanglement cannot be explained by classical correlations. Verifying GHZ states grows more expensive with qubit number, and their coherence is exquisitely sensitive to phase noise on any single qubit — a phase drift on any one of the nn qubits pollutes the overall relative phase, which is why fidelity records for large GHZ states are treated as benchmarks of a hardware platform’s overall quality. Finally, a splash of cold water: entanglement is a necessary ingredient, not advantage itself — stabilizer circuits built only from HH, SS, and CNOT can prepare highly entangled states yet are efficiently simulable on a classical computer (the Gottesman–Knill theorem); the stage that controlled gates provide still needs non-Clifford resources to perform a genuine quantum speedup.

Summary

Controlled gates write conditional logic into unitary evolution: the block-diagonal structure defines the semantics, the CNOT–CZ equivalence provides the translation layer between hardware and algorithms, and the ABC decomposition guarantees that any controlled single-qubit operation can be synthesized at the fixed cost of two CNOTs. The Bell and GHZ preparation circuits are the most direct products of this toolbox — entanglement becomes a resource that can be manufactured to recipe inside a circuit, and its different classes and limitations are written into the structure of those preparation circuits as well.

References

  1. Barenco, A. et al., Elementary Gates for Quantum Computation, Phys. Rev. A 52, 3457 (1995). https://arxiv.org/abs/quant-ph/9503016
  2. Nielsen, M. A. & Chuang, I. L., Quantum Computation and Quantum Information, Cambridge University Press, 2010. https://www.cambridge.org/9780521635035
  3. Dür, W., Vidal, G. & Cirac, J. I., Three qubits can be entangled in two inequivalent ways, Phys. Rev. A 62, 062314 (2000). https://arxiv.org/abs/quant-ph/0005115

Tags: Controlled GatesCNOTEntanglement PreparationGHZ State