Curriculum / Quantum Gates Deep Dive / Gate Decompositions

Lesson 8 of 12ReadingPro+75 XP

Gate Decompositions

Decompose arbitrary single-qubit gates into standard gate sequences.

Gate Decompositions

Real quantum computers only implement a small native gate set. All other gates must be decomposed into sequences of native gates. Understanding decompositions is key to quantum compilation.

ZYZ Decomposition

Any single-qubit unitary U can be written as:

for some angles α, β, γ and a global phase δ. This is called the ZYZ decomposition.

Example: Hadamard

Watch the ordering: in a matrix product the rightmost factor acts first, so RZ(π) is applied first. As a circuit (gates written in time order) this is: rz(π), then ry(π/2).

CNOT Decompositions

The CNOT gate can be decomposed from other entangling gates and vice versa.

CZ from CNOT:

H(target) → CNOT → H(target)  ≡  CZ

SWAP from CNOT:

CNOT(0,1) → CNOT(1,0) → CNOT(0,1)  ≡  SWAP

T Gate Sequences

The T gate approximates S gate:

  • S = T·T (two T gates = one S gate)
  • Z = S·S = T·T·T·T (four T gates = one Z gate)

Why S and T Alone Cannot Build H

S and T are both diagonal matrices: they only adjust the phase of |1⟩, and they commute with each other. Any product of S and T gates is therefore still diagonal, so no sequence of phase gates can ever equal H, which mixes |0⟩ and |1⟩. Building H requires rotating about a different axis:

import math
pi = math.pi
qc.rz(pi, 0)
qc.ry(pi/2, 0)
# = Hadamard, up to a global phase e^{i pi/2}

There is also an exact identity with no phase factor, H = X · RY(π/2):

qc.ry(pi/2, 0)
qc.x(0)
# = Hadamard, exactly

Implications for Fault Tolerance

In fault-tolerant architectures, Clifford gates are often transversal (easy, cheap), while T gates require distillation (expensive). Minimizing T-gate count is a key circuit optimization target.

How this lesson works

A guided reading lesson with interactive knowledge checks. Concepts are explained step by step with circuit diagrams and runnable examples, and you confirm understanding before moving on.

Part of: Quantum Gates Deep Dive

Master single-qubit and multi-qubit gates. Understand rotations, phases, and the math behind every gate in Qiskit.

This lesson is part of Pro

Unlock Quantum Gates Deep Dive and all 10 tracks with Pro: $12.99/month, $79/year, or $97 lifetime. Start with the free track first if you are new.