Skip to content

9.2

Single-qubit and two-qubit gates

Quantum operations = rotations of the Bloch sphere: Pauli, H, S and T each own one rotation, CNOT wires two qubits together, and a small handful of gates assembles every unitary there is.

Recommended first

After this section you should be able to

  • Write the matrices of X, Y, Z, H, S, T, and name each one's Bloch-sphere axis and rotation angle
  • Explain why quantum gates must be unitary, and hence reversible
  • Work through the CNOT truth table and the full H + CNOT preparation of a Bell state by hand
  • State what a "universal gate set" means: why H, T and CNOT suffice

The last section painted every state of a qubit onto a sphere. With the map in hand, the question becomes: how do you get from one point on the sphere to another?

Start with the humblest request: build a NOT gate for a qubit

Everything a classical computer can do comes from a few logic gates: NOT, AND, OR. Try the simplest one first — NOT, which sends 0 to 1 and 1 to 0. For a qubit we require

01,10(9.2.1)\ket{0}\mapsto\ket{1},\qquad \ket{1}\mapsto\ket{0}\tag{9.2.1}

By linearity (chapter 3’s postulate: evolution is a linear operator), its action on superpositions is completely fixed:

α0+β1  α1+β0(9.2.2)\alpha\ket{0}+\beta\ket{1}\ \mapsto\ \alpha\ket{1}+\beta\ket{0}\tag{9.2.2}

As a matrix, this is the Pauli matrix σx\sigma_x — renamed the XX gate in this chapter. So far so good. But try to build AND next and you hit a wall: AND squeezes two inputs into one output (4 possible inputs, 2 possible outputs) — it is irreversible. From an output of 0 you cannot tell whether the input was 00, 01 or 10.

Why the classical-gate mindset falls short

Chapter 3’s time-evolution postulate says: a closed system evolves by U=eiHt/U=\ee^{-\ii Ht/\hbar}, which is unitary. Unitary means UU=IU^\dagger U=I, means reversible, means no information lost. So quantum gates obey two iron rules that classical gates do not:

  1. They must be reversible: information-compressing gates like AND and OR have no direct quantum counterpart;
  2. They must preserve inner products: it is not enough to say what happens to the basis vectors — the probability structure of every superposition has to stay consistent.

For a single qubit, unitary operations have a beautifully clean geometric meaning:

The standard single-qubit gate catalogue

GateMatrixBloch-sphere actionMnemonic
XX(0110)\begin{pmatrix}0&1\\1&0\end{pmatrix}180° about the xx axisQuantum NOT; swaps the poles
YY(0ii0)\begin{pmatrix}0&-\ii\\\ii&0\end{pmatrix}180° about the yy axisY=iXZY=\ii XZ
ZZ(1001)\begin{pmatrix}1&0\\0&-1\end{pmatrix}180° about the zz axisPuts a minus sign on 1\ket{1}; phase flip
HH12(1111)\frac{1}{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}180° about x^+z^2\tfrac{\hat x+\hat z}{\sqrt2}Swaps the zz axis with the xx axis
SS(100i)\begin{pmatrix}1&0\\0&\ii\end{pmatrix}90° about the zz axisS2=ZS^2=Z
TT(100eiπ/4)\begin{pmatrix}1&0\\0&\ee^{\ii\pi/4}\end{pmatrix}45° about the zz axisT2=ST^2=S; the one “non-trivial angle”

Of these, the Hadamard gate HH deserves a moment of its own:

H0=0+12=+,H1=012=(9.2.5)H\ket{0}=\frac{\ket{0}+\ket{1}}{\sqrt2}=\ket{+},\qquad H\ket{1}=\frac{\ket{0}-\ket{1}}{\sqrt2}=\ket{-}\tag{9.2.5}

It turns “definite” into “superposed”, and since H2=IH^2=I, applying it again turns it back. Nearly every algorithm to come opens with “hit every qubit with a row of HH‘s” — the standard move for manufacturing superposition and switching on quantum parallelism.

Two-qubit gates: CNOT

However many single-qubit gates you stack up, each just spins its own sphere — no correlation between two qubits ever appears. For a quantum computer to be more than “a row of side-by-side coins”, we need conditional operations: what happens to one qubit depends on the state of another. The most basic is the controlled-NOT gate (CNOT): when the control is 1\ket{1} it flips the target; when the control is 0\ket{0} it does nothing.

control ──●──          |00⟩ → |00⟩
          │            |01⟩ → |01⟩
target  ──⊕──          |10⟩ → |11⟩
                       |11⟩ → |10⟩

In matrix form (basis order 00,01,10,11\ket{00},\ket{01},\ket{10},\ket{11}):

CNOT=(1000010000010010)(9.2.6)\mathrm{CNOT}=\begin{pmatrix}1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0\end{pmatrix}\tag{9.2.6}

Its power lies in how it responds to a superposed control. Work through the single most important circuit by hand:

How many gates are enough? — Universal gate sets

In the classical world, NAND gates alone can build any logic circuit. The quantum counterpart:

Universality theorem (statement): all single-qubit gates plus CNOT can exactly synthesise any nn-qubit unitary; stronger still, the discrete set {H,T,CNOT}\{H, T, \mathrm{CNOT}\} alone can approximate any unitary to arbitrary precision.

The intuition comes in three layers: (1) any large unitary matrix decomposes into a chain of elementary rotations that each touch only two basis vectors; (2) each elementary rotation can be assembled from CNOTs plus single-qubit gates; (3) arbitrary single-qubit rotations are generated by HH and TTTT rotates 45° about zz, HTHHTH rotates 45° about xx, and alternating irrational-angle rotations about two different axes can reach every corner of the rotation group (the Solovay–Kitaev theorem further guarantees the approximation error falls exponentially with gate count, at the cost of only a polynomial-length gate sequence).

What comes next

CNOT hands us an unexpected gift: the Bell states — two qubits “welded” together, neither of which owns a state of its own any longer. Last chapter we spoke of entanglement as something you “have or don’t have”, but a natural question immediately arises: 00+112\frac{\ket{00}+\ket{11}}{\sqrt2} and 0.9900+0.14110.99\ket{00}+0.14\ket{11} are both entangled — are they “equally deeply” entangled? The next section fits entanglement with a measuring stick.

Section 66 of 106 · use to turn the page