Skip to content

Gates, Circuits, and Computation Models

A quantum circuit represents a controlled information-processing procedure as an ordered composition of preparations, reversible gates, measurements, and classically conditioned operations. A gate is an ideal mathematical map; a laboratory instruction is a noisy physical implementation and is generally described by a quantum channel.

This chapter is the canonical map of the circuit-model language. The pages on single-qubit gates, multi-qubit gates, and universal gate sets own the detailed gate families.

This page uses column state vectors acted on from the left. In an expression

U3U2U1∣ψ⟩,U_3U_2U_1|\psi\rangle,

U1U_1 acts first. For two qubits, the ordered computational basis is

∣00⟩,∣01⟩,∣10⟩,∣11⟩,|00\rangle, |01\rangle, |10\rangle, |11\rangle,

with the left ket label belonging to the first tensor factor. A one-qubit gate on the first factor is U⊗IU\otimes I; on the second it is I⊗UI\otimes U.

These conventions are not universal across software packages. Before moving a matrix, bit string, or circuit between sources, check:

  • tensor-factor and bit-string order;
  • whether matrices act on column or row vectors;
  • whether circuit diagrams are read left-to-right;
  • the signs in rotation gates;
  • whether equality is exact or only up to global phase.

In the basis ∣0⟩,∣1⟩|0\rangle,|1\rangle, the Pauli gates are

X=(0110),Y=(0−ii0),Z=(100−1).X= \begin{pmatrix} 0&1\\ 1&0 \end{pmatrix}, \qquad Y= \begin{pmatrix} 0&-i\\ i&0 \end{pmatrix}, \qquad Z= \begin{pmatrix} 1&0\\ 0&-1 \end{pmatrix}.

They satisfy

X2=Y2=Z2=I,X^2=Y^2=Z^2=I,

and, for example, XY=iZXY=iZ. The Hadamard gate is

H=12(111−1),H=\frac{1}{\sqrt2} \begin{pmatrix} 1&1\\ 1&-1 \end{pmatrix},

with

H∣0⟩=∣+⟩,H∣1⟩=∣−⟩.H|0\rangle=|+\rangle, \qquad H|1\rangle=|-\rangle.

The phase gates are

S=(100i),T=(100eiπ/4),S= \begin{pmatrix} 1&0\\ 0&i \end{pmatrix}, \qquad T= \begin{pmatrix} 1&0\\ 0&e^{i\pi/4} \end{pmatrix},

so S=T2S=T^2 and Z=S2=T4Z=S^2=T^4.

Rotation Gates and General One-Qubit Unitaries

Section titled “Rotation Gates and General One-Qubit Unitaries”

For k=x,y,zk=x,y,z,

Rk(θ)=e−iθσk/2=cos⁡θ2 I−isin⁡θ2 σk.R_k(\theta) =e^{-i\theta\sigma_k/2} =\cos\frac\theta2\,I -i\sin\frac\theta2\,\sigma_k.

Thus

Rx(θ)=(cos⁡(θ/2)−isin⁡(θ/2)−isin⁡(θ/2)cos⁡(θ/2)),R_x(\theta)= \begin{pmatrix} \cos(\theta/2)&-i\sin(\theta/2)\\ -i\sin(\theta/2)&\cos(\theta/2) \end{pmatrix},

and

Rz(θ)=(e−iθ/200eiθ/2).R_z(\theta)= \begin{pmatrix} e^{-i\theta/2}&0\\ 0&e^{i\theta/2} \end{pmatrix}.

Every one-qubit unitary can be decomposed as

U=eiαRz(β)Ry(γ)Rz(δ).U=e^{i\alpha}R_z(\beta)R_y(\gamma)R_z(\delta).

The leading phase is irrelevant for an isolated unconditional gate on a state ray, but it can become a relative phase when the operation is placed under coherent control.

For control qubit AA and target system BB, the controlled-UU gate is

C(U)=∣0⟩⟨0∣A⊗IB+∣1⟩⟨1∣A⊗UB.C(U) =|0\rangle\langle0|_A\otimes I_B +|1\rangle\langle1|_A\otimes U_B.

CNOT is the controlled-XX gate:

CNOT⁡∣a,b⟩=∣a,a⊕b⟩.\operatorname{CNOT}|a,b\rangle =|a,a\oplus b\rangle.

In the declared basis,

CNOT⁡=(1000010000010010).\operatorname{CNOT} =\begin{pmatrix} 1&0&0&0\\ 0&1&0&0\\ 0&0&0&1\\ 0&0&1&0 \end{pmatrix}.

The controlled-ZZ gate is

CZ=diag⁡(1,1,1,−1),CZ=\operatorname{diag}(1,1,1,-1),

and the two are related by

CNOT=(I⊗H)CZ(I⊗H).CNOT=(I\otimes H)CZ(I\otimes H).

The dedicated semantic audit extends this definition to open and multiple controls, multiplexed branches, branch-relative phase, kickback, and controlled-access assumptions.

SWAP exchanges two tensor factors:

SWAP⁡∣a,b⟩=∣b,a⟩,\operatorname{SWAP}|a,b\rangle=|b,a\rangle,

with matrix

SWAP⁡=(1000001001000001).\operatorname{SWAP} =\begin{pmatrix} 1&0&0&0\\ 0&0&1&0\\ 0&1&0&0\\ 0&0&0&1 \end{pmatrix}.

It can be decomposed as

SWAP⁡=CNOT⁡12CNOT⁡21CNOT⁡12,\operatorname{SWAP} =\operatorname{CNOT}_{12} \operatorname{CNOT}_{21} \operatorname{CNOT}_{12},

where the rightmost CNOT acts first. A physical platform may offer an iSWAP or partial exchange natively, making this textbook decomposition a poor cost model for that hardware.

Starting from ∣00⟩|00\rangle, apply Hadamard to the first qubit and then CNOT:

∣00⟩→H⊗I∣00⟩+∣10⟩2→CNOT⁡∣00⟩+∣11⟩2=∣Φ+⟩.\begin{aligned} |00\rangle &\xrightarrow{H\otimes I} \frac{|00\rangle+|10\rangle}{\sqrt2}\\ &\xrightarrow{\operatorname{CNOT}} \frac{|00\rangle+|11\rangle}{\sqrt2} =|\Phi^+\rangle. \end{aligned}

The output is not a product of one-qubit states. Circuit diagrams therefore encode both reversible transformations and the creation of correlations.

Three notions must be kept separate:

  1. Exact matrix equality: U=VU=V.
  2. Equality up to global phase: U=eiϕVU=e^{i\phi}V.
  3. Equality as an isolated unitary channel: UρU†=VρV†U\rho U^\dagger=V\rho V^\dagger for every ρ\rho.

The second implies the third. It does not imply that controlled-UU and controlled-VV are equivalent, because the phase appears only in the controlled branch and becomes relative. Likewise, equality on a few basis states is not enough to establish operator equality unless linearity and phases have been checked.

The standard circuit model specifies:

  • input registers and their initialization;
  • an allowed set of local and entangling operations;
  • gate ordering and possible parallel layers;
  • intermediate or final measurements;
  • classical records and feedforward;
  • an output rule and resource accounting.

Width counts simultaneously represented subsystems. Depth counts sequential layers under a declared parallelism model. Gate count, connectivity, communication, magic-state consumption, and measurement latency can be independent resources.

Alternative models—measurement-based, adiabatic, continuous-variable, bosonic encoded, and topological computation—organize the physical primitive differently. Equivalence in computational power does not imply equal physical overhead or noise sensitivity.

A continuously parameterized set containing arbitrary one-qubit rotations and an entangling two-qubit gate is universal in the usual finite-dimensional circuit sense. Discrete sets such as Clifford+TT are approximately universal: arbitrary target unitaries are approximated to a requested error.

The Clifford gates alone are not universal for arbitrary quantum computation, despite their importance in stabilizer codes and fault tolerance. Distinguish:

  • an abstract universal gate set;
  • a device’s native gates;
  • a code’s fault-tolerant logical gates;
  • a compiler’s chosen approximation and error metric.

Universal Gate Sets develops exact versus approximate universality and compilation costs.

An ideal gate acts as

ρ⟼UρU†.\rho\longmapsto U\rho U^\dagger.

A physical implementation is more generally a channel E\mathcal E. Its quality cannot be inferred from one matrix alone. Calibration, leakage, crosstalk, drift, state-preparation and measurement errors, and temporal correlations all affect a circuit-level claim.

Postselected and measurement-conditioned branches are trace-nonincreasing maps before normalization. Reset is not a unitary on the reset subsystem. Classical feedforward makes the computation adaptive rather than one fixed unitary product.

For a proposed gate or identity:

  1. Verify U†U=IU^\dagger U=I for an ideal unitary.
  2. Apply the operation to every computational-basis vector.
  3. Check one nontrivial superposition to expose relative phases.
  4. State tensor-factor and matrix-multiplication order.
  5. Decide whether equality is exact, projective, or channel-level.
  6. For controlled gates, retain phases that would be global without control.
  7. For hardware claims, specify the implemented channel and error metric.
  • Reading matrix products left-to-right in time.
  • Using a two-qubit matrix with an undeclared basis order.
  • Calling every relative phase a global phase.
  • Treating YY as a classical bit flip and dropping its phases.
  • Forgetting the half-angle in Rk(θ)R_k(\theta).
  • Assuming Clifford gates alone are universal.
  • Equating an ideal unitary with a noisy laboratory pulse.
  • Treating measurement, reset, or discarded ancillas as a unitary on the visible register.
  • Comparing circuit depths without the same connectivity and parallelism assumptions.
  • Reversible Computation owns bijective classical logic, reversible embeddings, garbage and ancilla accounting, uncomputation, and the boundary with unitary quantum gates.
  • Circuit Model defines registers, wires, resources, measurements, and classical control.
  • Single-Qubit Gates owns common matrices and Bloch-sphere action.
  • Multi-Qubit Gates owns entangling and exchange gates.
  • Controlled Operations audits projector-controlled blocks, open and multiple controls, multiplexed branches, branch-relative phase, coherent versus classical conditioning, and controlled-access assumptions.
  • Measurement in Circuits audits projective measurement nodes, basis rotations, classical record encoding, selected and unread outputs, shot statistics, and postprocessing.
  • Mid-Circuit Measurement and Feedforward owns causal measurement-conditioned branching, reset and qubit reuse, deferred-measurement limits, and branch-aware resource accounting.
  • Quantum Fourier Transform owns the finite-register Fourier unitary, binary phase factorization, exact and approximate circuits, swap conventions, and the boundary with classical FFT output.
  • Phase Kickback owns coherent phase transduction from common eigenstates and character states, clean Boolean and modular conversions, factorization and cleanup checks, and phase-sensitive readout.
  • Quantum Oracles owns coherent information-access contracts: domains and promises, full-space actions, supplied inverse, controlled, powered, and family capabilities, licensed equivalences, query accounting, and oracle-specific fair comparison.
  • Measurement-Based Quantum Computation owns finite-qubit open-graph patterns, adaptive equatorial measurements, byproduct and Pauli-frame propagation, flow and gflow determinism, logical wire, rotation, and entangling kernels, and MBQC resource accounting.
  • Adiabatic Quantum Computation owns finite-dimensional closed-system computational Hamiltonian encodings, accepted ground-subspace decoders, gapped paths and schedules, licensed error certificates, circuit/history-state equivalence, and normalized AQC resource accounting.
  • Quantum Annealing owns device-agnostic finite-time driver–problem processes across declared closed, open, thermal, nonadiabatic, paused, reversed, or quenched regimes, including decoded sample distributions, freeze-out hypotheses, embeddings, gauges, and annealing-specific resource accounting.
  • Continuous-Variable Quantum Computation owns the abstract mode-computation record: quadrature and energy conventions, Gaussian affine-symplectic circuits and continuous measurement with feedforward, declared non-Gaussian completion, finite-squeezed cluster patterns, approximation metrics, and model-level resource accounting.
  • Topological Quantum Computation owns the finite-anyon computation record: declared anyon data and total-charge sector, fusion-space encoding, oriented braid and fusion-measurement program, adaptive frame, induced projective logical operation, leakage, universal completion, verification, and resource accounting.
  • Bosonic and Encoded Computation Models owns finite logical programs induced by oscillator controls and instruments: declared encodings, complete physical composition, induced logical channels, leakage and rejection, recovery and frames, truncation, verification, and resource ledgers.
  • Quantum Algorithms and Complexity is the next chapter guide: it turns a chosen computation model into a declared problem, access/output/success contract, resource ledger, classical comparator, and evidence claim.
  • Universal Gate Sets treats compilation and approximation.
  • Quantum Gates is the compact matrix lookup card.
  • M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, 10th anniversary ed., Cambridge University Press, 2010.
  • J. Watrous, The Theory of Quantum Information, Cambridge University Press, 2018.
  • J. Preskill, Lecture Notes for Physics 219/Computer Science 219: Quantum Computation, California Institute of Technology.
  • P. Kaye, R. Laflamme, and M. Mosca, An Introduction to Quantum Computing, Oxford University Press, 2007.
  • J. M. Gambetta, J. M. Chow, and M. Steffen, ‘Building Logical Qubits in a Superconducting Quantum Computing System,’ npj Quantum Information 3, 2 (2017).
  1. A state is acted on first by HH and then by ZZ. Which product represents the circuit, and what is the output on ∣0⟩|0\rangle?
Solution

The later operation appears on the left, so the product is ZHZH. Therefore

ZH∣0⟩=Z∣+⟩=∣−⟩.ZH|0\rangle =Z|+\rangle =|-\rangle.
  1. Let V=eiϕUV=e^{i\phi}U. Show that UU and VV define the same isolated unitary channel but that their controlled versions need not agree up to one global phase.
Solution

For every density operator,

VρV†=eiϕUρU†e−iϕ=UρU†.V\rho V^\dagger =e^{i\phi}U\rho U^\dagger e^{-i\phi} =U\rho U^\dagger.

But

C(V)=∣0⟩⟨0∣⊗I+eiϕ∣1⟩⟨1∣⊗U.C(V)=|0\rangle\langle0|\otimes I +e^{i\phi}|1\rangle\langle1|\otimes U.

The phase multiplies only the control-11 branch and is relative to the control-00 branch. It cannot generally be removed as one global phase.

  1. Derive CNOT=(I⊗H)CZ(I⊗H)CNOT=(I\otimes H)CZ(I\otimes H).
Solution

Write

CZ=∣0⟩⟨0∣⊗I+∣1⟩⟨1∣⊗Z.CZ=|0\rangle\langle0|\otimes I +|1\rangle\langle1|\otimes Z.

Conjugating the target by HH and using HZH=XHZH=X gives

(I⊗H)CZ(I⊗H)=∣0⟩⟨0∣⊗I+∣1⟩⟨1∣⊗X=CNOT.(I\otimes H)CZ(I\otimes H) =|0\rangle\langle0|\otimes I +|1\rangle\langle1|\otimes X =CNOT.
  1. Prepare ∣Φ+⟩|\Phi^+\rangle with HH and CNOT, then compute either reduced density operator.
Solution

The circuit gives

∣Φ+⟩=∣00⟩+∣11⟩2.|\Phi^+\rangle =\frac{|00\rangle+|11\rangle}{\sqrt2}.

Taking either partial trace removes the cross terms and gives

ρA=ρB=I22.\rho_A=\rho_B=\frac{I_2}{2}.

The global state is pure and entangled while each qubit separately is maximally mixed.