Information Technology is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Universal quantum gates

How a small set of quantum logic gates (single-qubit rotations plus an entangling two-qubit gate such as CNOT, or the discrete set {H, T, CNOT}) can generate (or approximate) any quantum computation; includes definitions, proofs sketches, formulae, worked exam-style answers and common mistakes.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Quantum circuits are built from a small set of basic operations called quantum gates. Knowing which gate sets are universal (able to build any quantum operation) is essential for designing hardware, compiling algorithms into low-level instructions, and estimating resources (gate counts and depth) for real quantum devices.

Key ideas

  • Single-qubit gate — a unitary in U(2) acting on a single qubit. We usually treat single-qubit gates as 2×2 complex unitary matrices.

  • Multi-qubit gate — a unitary in U(2^n) acting on n qubits. Multi-qubit gates can create entanglement between qubits.

  • Entangling gate — a multi-qubit gate that can create entanglement from some product (non-entangled) input. Example: CNOT (controlled-NOT).

  • Universal gate set — a set S of quantum gates is called universal if, for every number of qubits n and every unitary U on n qubits, arbitrary accuracy ε > 0, there exists a finite sequence of gates from S whose composition approximates U to error ≤ ε (in operator norm). If S can produce exactly every U (not just approximate), we call it exactly universal.

Exact statements and assumptions universities expect:

  1. Any U ∈ U(2^n) can be decomposed (exactly) into a finite circuit of single-qubit gates and CNOT gates. Assumptions: we allow arbitrary single-qubit unitaries (continuous parameters) and perfect CNOTs. Standard decomposition proofs use the QR or Cosine–Sine Decomposition (CSD) and show recursive reduction to two-level unitaries; then each two-level unitary is realized by single-qubit rotations and CNOTs.

  2. A finite discrete gate set such as {H, T, CNOT} is approximately universal: finite words over these gates are dense in SU(2^n) (up to a global phase); any target unitary can be approximated arbitrarily well. Assumptions: gates are exact, and we allow arbitrarily long sequences. The Solovay–Kitaev theorem gives an explicit bound: any target can be approximated to ε with length O(log^c(1/ε)) for some constant c≈3–4, assuming the set generates a dense subgroup of SU(2).

Common derivations/exam steps asked for:

  • Decomposition of an arbitrary single-qubit unitary into three rotations (Euler decomposition). Statement: for any U ∈ U(2) there exist real α, β, γ, δ such that U = e^{iα} Rz(β) Ry(γ) Rz(δ), where Rz(θ) = exp(-i θ Z/2) and Ry(θ) = exp(-i θ Y/2). Proof sketch: factor out det(U) to make SU(2) and use parameterization of SU(2) as rotations on the Bloch sphere.

  • Show CNOT is entangling: apply CNOT to (|+⟩ ⊗ |0⟩) to get the Bell-like entangled state (1/√2)(|00⟩ + |11⟩).

Diagrams to draw (describe exactly):

  1. Circuit for Euler decomposition: draw one horizontal line for the qubit, left to right: label input state |ψ⟩, then three boxes in sequence labeled Rz(δ), Ry(γ), Rz(β), and a global phase e^{iα} written above the wire (global phase can be ignored for state vectors but include in full-marks derivation). Label axes for rotation angles.
  2. Two-qubit CNOT circuit: two horizontal wires; on control wire a solid dot labeled control, a vertical line down to a ⊕ symbol on target wire. Label control qubit index and target qubit index.

Be precise about global phase: global phase e^{iα} has no effect on measurement probabilities but is part of exact matrix equality.

Formulas

X = [[0, 1],[1, 0]] — Pauli-X gate (bit-flip). Symbols: matrix entries are unitless complex numbers. Applies to one qubit.

Y = [[0, -i],[i, 0]] — Pauli-Y gate (bit+phase flip). i is imaginary unit. Unitless.

Z = [[1, 0],[0, -1]] — Pauli-Z gate (phase-flip). Unitless.

H = (1/√2) * [[1, 1],[1, -1]] — Hadamard gate. Unitless. Creates superposition: H|0⟩ = |+⟩, H|1⟩ = |−⟩.

S = [[1, 0],[0, i]] — Phase (S) gate. Unitless.

T = [[1, 0],[0, e^{iπ/4}]] — T (π/8) gate. Unitless.

Rz(θ) = [[e^{-iθ/2}, 0],[0, e^{iθ/2}]] — rotation about Z by angle θ (radians). Unitless. Applies to single qubit.

Ry(θ) = [[cos(θ/2), -sin(θ/2)],[sin(θ/2), cos(θ/2)]] — rotation about Y by angle θ (radians). Unitless.

CNOT = [[1,0,0,0],[0,1,0,0],[0,0,0,1],[0,0,1,0]] — controlled-NOT on two qubits (control=first qubit, target=second). Unitless.

U ∈ U(2^n): U† U = I — definition of unitary. U† is conjugate transpose; I is identity matrix. Unitless; applies to n-qubit gates.

U = e^{iα} Rz(β) Ry(γ) Rz(δ) — Euler (Z–Y–Z) decomposition of a single-qubit unitary. α, β, γ, δ are real angles in radians. Unitless.

‖U - V‖ ≤ ε — operator norm distance between unitaries U and V bounded by ε. Unitless. Used in definition of approximate universality.

Worked examples

Example 1 — Decompose an arbitrary single-qubit unitary into Z–Y–Z (model-answer style): Question: Show that any U ∈ U(2) can be written as U = e^{iα} Rz(β) Ry(γ) Rz(δ). Give the steps. Answer (model):

  1. Let U be a 2×2 unitary. Factor out global phase: define det(U) = e^{iϕ}. Then V = e^{-iϕ/2} U ∈ SU(2) (so det(V)=1).
  2. Any V ∈ SU(2) can be parameterized by two complex numbers u,v with |u|^2 + |v|^2 = 1 as V = [[u, -v*],[v, u*]]. (Derive this from the two-by-two constraint det=1 and unitarity.)
  3. Write u = cos(γ/2) e^{-i(β+δ)/2} and v = sin(γ/2) e^{-i(β-δ)/2} for some real β, γ, δ (choose γ ∈ [0, π], β, δ ∈ [0, 2π)). Substituting into V gives V = Rz(β) Ry(γ) Rz(δ) (using Rz(θ) = exp(-i θ Z/2)).
  4. Restore global phase: U = e^{iϕ/2} V, so set the overall α in the formula to account for this phase. Therefore U = e^{iα} Rz(β) Ry(γ) Rz(δ) (rename angles to match standard notation).
  5. Diagram to draw: one wire with sequential boxes Rz(δ), Ry(γ), Rz(β) and a note that global phase e^{iα} is present.

(Exam marking points: state factoring det(U), parameterization of SU(2), explicit substitution, identification of angles.)

Example 2 — Why {H, T, CNOT} is universal (model-answer sketch): Question: Explain briefly why the finite set {H, T, CNOT} is approximately universal. Answer (model):

  1. Show CNOT is an entangling two-qubit gate: apply CNOT to |+⟩|0⟩ to get (1/√2)(|00⟩ + |11⟩) which is entangled.
  2. Single-qubit universality: H and T generate a subgroup of SU(2) that is dense in SU(2). Intuition: H and T generate enough rotations; their repeated products can approximate any single-qubit rotation. (A rigorous proof is nontrivial: one appeals to group-theory results and number-theory facts; the Solovay–Kitaev theorem gives constructive approximation.)
  3. Combining dense single-qubit gates with an entangling two-qubit gate (CNOT) gives approximate universality for n qubits: arbitrary multi-qubit unitary can be approximated by decomposing into single-qubit rotations and CNOTs, and then approximating each single-qubit rotation by H/T sequences. More generally, any fixed entangling two-qubit gate together with arbitrary single-qubit gates yields universality (Brylinski’s theorem).
  4. Mention Solovay–Kitaev theorem (sketch): if a finite gate set densely generates SU(2), any target SU(2) element can be approximated in length polylog(1/ε).

(Exam marking points: demonstrate entangling power, state density argument for single-qubit gates, cite Solovay–Kitaev for efficiency.)

Example 3 — Use of CNOT and single-qubit rotations to implement a controlled-U (short model answer): Question: Given arbitrary single-qubit unitary U, how to make controlled-U using single-qubit rotations and CNOTs (explain steps)? Answer (model):

  1. Decompose U = A·Rz(θ)·B where A,B are single-qubit unitaries (this is possible by Euler decomposition and diagonalization of U, up to a global phase).
  2. There exist single-qubit gates A, B, C with ABC = I such that U = A X B X C (Barenco et al.). Then controlled-U can be built as (I ⊗ A) · CNOT · (I ⊗ B) · CNOT · (I ⊗ C); if det(U) ≠ 1, add a phase e^{iα} on the control to match the global phase (X is Pauli-X).
  3. Special case U = Rz(θ): choose A = Rz(θ/2), B = Rz(-θ/2), C = I; then controlled-Rz(θ) uses two CNOTs and two single-qubit rotations on the target: Rz(θ/2), CNOT, Rz(-θ/2), CNOT.
  4. Therefore controlled-U uses two CNOTs plus at most three single-qubit gates on the target (and, if det(U) ≠ 1, an added phase on the control).

(Exam marking points: show decomposition, show controlled-Z implementation using CNOT sandwich.)

Common mistakes

  • Writing the Euler decomposition with wrong order of rotations (order matters: Rz Ry Rz is standard for Z–Y–Z).
  • Thinking a single entangling gate alone is universal; you also need arbitrary single-qubit rotations (or a dense finite set approximating them).
  • Mis-writing matrix entries for CNOT or T gate signs/phases.
  • Forgetting to check det(U) when converting to SU(2) for parameterization.

For your exam

Kinds of questions:

  • Short definitions: define universal gate set, single-qubit gate, entangling gate.
  • Derivations: show Euler decomposition of single-qubit unitaries with algebraic steps.
  • Proof/Explanations: argue why (single-qubit gates + CNOT) are universal; sketch Solovay–Kitaev implication.
  • Circuits/diagrams: draw decomposition circuits (Euler, controlled-U via CNOT sandwich).
  • Numerical/constructive: decompose a given 2×2 unitary matrix into rotations (provide angles).

Full-marks answers must:

  • State definitions precisely (unitarity, universality with ε approximation),
  • Show algebraic steps (factoring det, SU(2) parameterization),
  • Draw and label circuit diagrams where asked,
  • Mention the role of entanglement and give at least one explicit example, and
  • For finite sets, mention density and Solovay–Kitaev for efficiency (cite result).

Quick check

  1. Define a universal gate set in one sentence.
  2. Give the 2×2 matrix for the Hadamard gate H.
  3. How many CNOTs are needed (minimum statement) to implement a controlled-Rz(θ) using Rz(θ)? Answers: 1) A universal gate set is a set of gates whose finite sequences can approximate any multi-qubit unitary to arbitrary accuracy. 2) H = (1/√2)[[1,1],[1,-1]]. 3) Two CNOTs (e.g., Rz(θ/2) on target, CNOT, Rz(-θ/2) on target, CNOT).

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?