Lecture 4 · Dr Jonte Hance · about 60 min

Single-qubit operations

Doing things to qubits. The Pauli gates, Hadamard and the phase gates; why every gate must be unitary; Hermitian operators, eigenstates, and circuit notation.

How much help?
How well do you know this?
By the end you can
  • Apply I,X,Y,Z,H,S,TI, X, Y, Z, H, S, T to any single-qubit state, by matrix or by rule
  • Multiply Paulis and write products like XY=iZXY = iZ as scalar × operator
  • Test whether a matrix is unitary (U†U=IU^\dagger U = I) or Hermitian (A=A†A = A^\dagger)
  • Name the eigenstates of each Pauli and the basis it stabilises
  • Read and draw simple circuits

Builds on: Lecture 2, Lecture 3

Operations are matrices

Every quantum operation except measurement is linear: doing it to a sum is the sum of doing it to each part. Any linear map on an nn-dimensional space is an n×nn\times n matrix, and a qubit lives in 2 dimensions, so single-qubit gates are 2×2 matrices.

Linearity means you only need to know what a gate does to ∣0⟩\ket0 and ∣1⟩\ket1; everything else follows:

U(α∣0⟩+β∣1⟩)=α U∣0⟩+β U∣1⟩.U(\A\alpha\ket0 + \B\beta\ket1) = \A\alpha\,U\ket0 + \B\beta\,U\ket1.

The gates

Identity I=(1001)I = \begin{pmatrix}1&0\\0&1\end{pmatrix}: does nothing.

Pauli-X (the quantum NOT): X=(0110)X = \begin{pmatrix}0&1\\1&0\end{pmatrix}, so X∣0⟩=∣1⟩X\ket0 = \ket1, X∣1⟩=∣0⟩X\ket1 = \ket0, and X(α∣0⟩+β∣1⟩)=β∣0⟩+α∣1⟩X(\A\alpha\ket0 + \B\beta\ket1) = \B\beta\ket0 + \A\alpha\ket1: it swaps the amplitudes. Twice is nothing: X2=IX^2 = I.

Pauli-Z (phase flip): Z=(100−1)Z = \begin{pmatrix}1&0\\0&-1\end{pmatrix}, so Z∣0⟩=∣0⟩Z\ket0 = \ket0, Z∣1⟩=−∣1⟩Z\ket1 = -\ket1. It flips the sign of β: Z∣+⟩=∣−⟩Z\ket+ = \ket-.

Pauli-Y: Y=(0−ii0)Y = \begin{pmatrix}0&-i\\i&0\end{pmatrix}, so Y∣0⟩=i∣1⟩Y\ket0 = i\ket1, Y∣1⟩=−i∣0⟩Y\ket1 = -i\ket0. (Note Y=iXZY = iXZ: a bit flip and a phase flip together.)

Hadamard: H=12(111−1)H = \tfrac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}, so

H∣0⟩=∣+⟩,H∣1⟩=∣−⟩,H(α∣0⟩+β∣1⟩)=α+β2∣0⟩+α−β2∣1⟩.H\ket0 = \ket+,\qquad H\ket1 = \ket-,\qquad H(\A\alpha\ket0+\B\beta\ket1) = \tfrac{\A\alpha+\B\beta}{\sqrt2}\ket0 + \tfrac{\A\alpha-\B\beta}{\sqrt2}\ket1.

H turns a definite basis state into an equal superposition. Measure H∣0⟩H\ket0 in 0/1 and you get a true random bit. H is its own inverse: H2=IH^2 = I, so H∣+⟩=∣0⟩H\ket+ = \ket0.

Phase gates: S=(100i)S = \begin{pmatrix}1&0\\0&i\end{pmatrix} and T=(100eiπ/4)T = \begin{pmatrix}1&0\\0&e^{i\pi/4}\end{pmatrix}. They are “roots” of Z: S2=ZS^2 = Z, T2=ST^2 = S. They only change the relative phase, rotating the Bloch vector around the vertical (Z) axis by 90° and 45°.

Explore · gates as rotations of the Bloch sphere

Start at |0⟩ and press H, then Z, then H. Where do you end up? Then try S four times from |+⟩. Every gate is a rotation of the sphere: X, Y, Z are half-turns about their axes, H is a half-turn about the diagonal between X and Z, S is a quarter-turn about Z.

Jump to:
Apply a gate:

In the 3D Bloch sphere you can watch each gate rotate the state about its own axis.

Lock it in · answer in your head, then reveal
Pauli-X matrix and action
X=(0110)X = \begin{pmatrix}0&1\\1&0\end{pmatrix}, flips: X∣0⟩=∣1⟩X\ket0=\ket1, X∣1⟩=∣0⟩X\ket1=\ket0.
Pauli-Z matrix and action
Z=(100−1)Z = \begin{pmatrix}1&0\\0&-1\end{pmatrix}: Z∣0⟩=∣0⟩Z\ket0=\ket0, Z∣1⟩=−∣1⟩Z\ket1=-\ket1 (phase flip).
Pauli-Y matrix
Y=(0−ii0)Y = \begin{pmatrix}0&-i\\i&0\end{pmatrix}: Y∣0⟩=i∣1⟩Y\ket0 = i\ket1, Y∣1⟩=−i∣0⟩Y\ket1 = -i\ket0.
Hadamard matrix and action on basis states
H=12(111−1)H=\tfrac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}; H∣0⟩=∣+⟩H\ket0=\ket+, H∣1⟩=∣−⟩H\ket1=\ket-.
S and T gates
S=diag(1,i)=ZS=\mathrm{diag}(1, i) = \sqrt Z, T=diag(1,eiπ/4)=ST = \mathrm{diag}(1, e^{i\pi/4}) = \sqrt S. Unitary but not Hermitian.

Pauli algebra

Multiply different Paulis and you always get the third one times ±i\pm i:

XY=iZ,YZ=iX,ZX=iY,YX=−iZ,ZY=−iX,XZ=−iY.XY = iZ,\quad YZ = iX,\quad ZX = iY,\qquad YX = -iZ,\quad ZY = -iX,\quad XZ = -iY.

The rule: going round the cycle X→Y→Z→XX\to Y\to Z\to X in order gives +i+i; against the cycle gives −i-i. Compactly, σaσb=δabI+iεabcσc\sigma_a\sigma_b = \delta_{ab}I + i\varepsilon_{abc}\sigma_c, where εabc\varepsilon_{abc} is +1+1 for cyclic order, −1-1 for anticyclic, 0 if any index repeats.

Eigenstates: which basis does each Pauli stabilise?

A gate stabilises a state if it leaves it unchanged apart from a factor: U∣v⟩=λ∣v⟩U\ket v = \lambda\ket v. That is exactly ”∣v⟩\ket v is an eigenvector”.

PauliEigenstates (eigenvalue)Basis stabilised
ZZ∣0⟩\ket0 (+1), ∣1⟩\ket1 (−1)0 or 1
XX∣+⟩\ket+ (+1), ∣−⟩\ket- (−1)+ or −
YY∣i⟩\ket{i} (+1), ∣−i⟩\ket{-i} (−1)ii or −i-i

Every Pauli has eigenvalues exactly ±1\pm1. When an operator is used as a measurement, the eigenvalues are the possible results and the eigenstates are the only states with a definite result. So “measure Z” means “measure 0 or 1” with results reported as +1+1 / −1-1.

Lock it in · answer in your head, then reveal
XYXY = ? and YXYX = ?
XY=iZXY = iZ, YX=−iZYX = -iZ. In general σaσb=iεabcσc\sigma_a\sigma_b = i\varepsilon_{abc}\sigma_c for a≠ba\neq b.
Which basis does each Pauli stabilise?
Z: {∣0⟩,∣1⟩}\{\ket0,\ket1\}. X: {∣+⟩,∣−⟩}\{\ket+,\ket-\}. Y: {∣i⟩,∣−i⟩}\{\ket{i},\ket{-i}\}. Each has eigenvalues ±1\pm1.
What is X2X^2, Y2Y^2, Z2Z^2, H2H^2?
All equal II: these gates are both unitary and Hermitian, so they are their own inverses.
HZHHZH = ?
XX. (And HXH=ZHXH = Z.) Sandwiching with H swaps the Z and X axes of the Bloch sphere.

Which matrices are allowed? Unitaries

Not every 2×2 matrix is a valid gate. A gate must keep the state normalised, ∣α∣2+∣β∣2=1|\alpha|^2 + |\beta|^2 = 1, for every input. Matrices that preserve the length of every vector are called unitary.

Intuition: unitaries redistribute probability between basis states and change phases, but never create or destroy it.

Hermitian operators

Some operators equal their own adjoint: A=A†A = A^\dagger. These are Hermitian (self-adjoint). Their eigenvalues are always real, which is why measurable quantities (observables) are Hermitian. X,Y,Z,HX, Y, Z, H are Hermitian and unitary, so U2=U†U=IU^2 = U^\dagger U = I: they undo themselves.

SS and TT are unitary but not Hermitian: S†=diag(1,−i)≠SS^\dagger = \mathrm{diag}(1, -i) \ne S. So applying S twice does not undo it (S2=ZS^2 = Z); you need S†S^\dagger.

Lock it in · answer in your head, then reveal
Necessary and sufficient condition for UU to be unitary
U†U=IU^\dagger U = I (equivalently U−1=U†U^{-1} = U^\dagger). Unitaries preserve the norm, so probabilities still add to 1.
Necessary and sufficient condition for AA to be Hermitian
A=A†A = A^\dagger (it equals its own conjugate transpose).
How do you compute A†A^\dagger?
Transpose (reflect in the diagonal), then complex-conjugate every entry.

Universality and circuits

Combining these gates you can rotate the Bloch vector any way you like. For example HSHH S H is a rotation about the X axis. With these single-qubit gates plus one two-qubit gate (CNOT, Lecture 6) you can build any quantum computation: the gate set is universal (up to arbitrarily good approximation, using HH and TT).

Circuit notation: each horizontal line is a qubit, time flows left to right, boxes are gates, and a meter symbol is a measurement (normally in 0/1, since any other basis can be rotated to 0/1 by a gate first: to measure +/−, apply H then measure 0/1).

4.1 · Verify the Paulis on basis vectors

Lecture 4 exercise (a)

Verify X∣0⟩=∣1⟩X\ket0 = \ket1, Y∣0⟩=i∣1⟩Y\ket0 = i\ket1, Y∣1⟩=−i∣0⟩Y\ket1 = -i\ket0 and Z∣1⟩=−∣1⟩Z\ket1 = -\ket1 by matrix multiplication.

Worked solution
  1. X∣0⟩=(0110)(10)=(01)=∣1⟩X\ket0 = \begin{pmatrix}0&1\\1&0\end{pmatrix}\begin{pmatrix}1\\0\end{pmatrix} = \begin{pmatrix}0\\1\end{pmatrix} = \ket1.
  2. Y∣0⟩=(0−ii0)(10)=(0i)=i∣1⟩Y\ket0 = \begin{pmatrix}0&-i\\i&0\end{pmatrix}\begin{pmatrix}1\\0\end{pmatrix} = \begin{pmatrix}0\\i\end{pmatrix} = i\ket1. (Just the first column of Y.)
  3. Y∣1⟩=Y\ket1 = second column =(−i0)=−i∣0⟩= \begin{pmatrix}-i\\0\end{pmatrix} = -i\ket0.
  4. Z∣1⟩=Z\ket1 = second column of Z =(0−1)=−∣1⟩= \begin{pmatrix}0\\-1\end{pmatrix} = -\ket1.
Answer: All four hold. Shortcut: U∣0⟩U\ket0 is the first column and U∣1⟩U\ket1 the second.

4.2 · Squares of the Paulis

Lecture 4 exercise (b)

Compute Y2Y^2 and Z2Z^2.

Worked solution
  1. Y2=(0−ii0)(0−ii0)Y^2 = \begin{pmatrix}0&-i\\i&0\end{pmatrix}\begin{pmatrix}0&-i\\i&0\end{pmatrix}.
  2. Entry (1,1): 0⋅0+(−i)(i)=−i2=10\cdot0 + (-i)(i) = -i^2 = 1. Entry (1,2): 0⋅(−i)+(−i)⋅0=00\cdot(-i) + (-i)\cdot0 = 0.
  3. Entry (2,1): i⋅0+0⋅i=0i\cdot 0 + 0\cdot i = 0. Entry (2,2): i(−i)+0=1i(-i) + 0 = 1. So Y2=IY^2 = I.
  4. Z2=diag(1⋅1,(−1)(−1))=IZ^2 = \mathrm{diag}(1\cdot1, (-1)(-1)) = I.
Answer: Y2=Z2=IY^2 = Z^2 = I (and X2=IX^2 = I).

4.3 · Products of two different Paulis

Lecture 4 exercise (c) and Quiz 4

Write XYXY, YXYX, ZYZY and XZXZ in the form (scalar) × (operator).

Worked solution
  1. XY=(0110)(0−ii0)=(i00−i)=i(100−1)=iZXY = \begin{pmatrix}0&1\\1&0\end{pmatrix}\begin{pmatrix}0&-i\\i&0\end{pmatrix} = \begin{pmatrix}i&0\\0&-i\end{pmatrix} = i\begin{pmatrix}1&0\\0&-1\end{pmatrix} = iZ.
  2. YX=(0−ii0)(0110)=(−i00i)=−iZYX = \begin{pmatrix}0&-i\\i&0\end{pmatrix}\begin{pmatrix}0&1\\1&0\end{pmatrix} = \begin{pmatrix}-i&0\\0&i\end{pmatrix} = -iZ.
  3. ZYZY: going Z→YZ\to Y is against the cycle X→Y→ZX\to Y\to Z, so expect −iX-iX. Check: (100−1)(0−ii0)=(0−i−i0)=−i(0110)=−iX\begin{pmatrix}1&0\\0&-1\end{pmatrix}\begin{pmatrix}0&-i\\i&0\end{pmatrix} = \begin{pmatrix}0&-i\\-i&0\end{pmatrix} = -i\begin{pmatrix}0&1\\1&0\end{pmatrix} = -iX ✓.
  4. XZ=(0−110)XZ = \begin{pmatrix}0&-1\\1&0\end{pmatrix}. Against the cycle (X→ZX\to Z), so expect −iY=−i(0−ii0)=(0−110)-iY = -i\begin{pmatrix}0&-i\\i&0\end{pmatrix} = \begin{pmatrix}0&-1\\1&0\end{pmatrix} ✓.
Answer: XY=iZXY = iZ, YX=−iZYX = -iZ, ZY=−iXZY = -iX, XZ=−iYXZ = -iY. Quiz answers are pairs: the scalar (±i\pm i, or ±1\pm1 when a phase cancels) and the operator.

4.4 · Hadamard on |1⟩, then measure

Lecture 4 Hadamard exercise

Find H∣1⟩H\ket1 and its 0/1 measurement probabilities. Then find HH∣0⟩HH\ket0.

Worked solution
  1. H∣1⟩H\ket1 is the second column of HH: 12(1−1)=∣−⟩\tfrac1{\sqrt2}\begin{pmatrix}1\\-1\end{pmatrix} = \ket-.
  2. P(0)=∣12∣2=12P(0) = |\tfrac1{\sqrt2}|^2 = \tfrac12, P(1)=∣−12∣2=12P(1) = |-\tfrac1{\sqrt2}|^2 = \tfrac12.
  3. HH∣0⟩=H∣+⟩=12(H∣0⟩+H∣1⟩)=12(∣+⟩+∣−⟩)HH\ket0 = H\ket+ = \tfrac1{\sqrt2}(H\ket0 + H\ket1) = \tfrac1{\sqrt2}(\ket+ + \ket-).
  4. ∣+⟩+∣−⟩=12(∣0⟩+∣1⟩+∣0⟩−∣1⟩)=22∣0⟩=2∣0⟩\ket+ + \ket- = \tfrac1{\sqrt2}(\ket0+\ket1+\ket0-\ket1) = \tfrac{2}{\sqrt2}\ket0 = \sqrt2\ket0, so HH∣0⟩=∣0⟩HH\ket0 = \ket0.
Answer: H∣1⟩=∣−⟩H\ket1 = \ket- (50/50 for 0/1), and HH∣0⟩=∣0⟩HH\ket0 = \ket0. The ∣1⟩\ket1 parts cancel: interference, the engine of every quantum algorithm.

4.5 · Is it unitary? Is it Hermitian?

Quiz 4 style

Test A=12(1−i−i1)A = \tfrac{1}{\sqrt2}\begin{pmatrix}1&-i\\-i&1\end{pmatrix}.

Worked solution
  1. A†A^\dagger: transpose (the matrix is symmetric, so unchanged), then conjugate: A†=12(1ii1)A^\dagger = \tfrac1{\sqrt2}\begin{pmatrix}1&i\\i&1\end{pmatrix}.
  2. Hermitian? A†≠AA^\dagger \ne A (the off-diagonals changed sign), so no.
  3. Unitary? A†A=12(1ii1)(1−i−i1)A^\dagger A = \tfrac12\begin{pmatrix}1&i\\i&1\end{pmatrix}\begin{pmatrix}1&-i\\-i&1\end{pmatrix}.
  4. (1,1): 1+i(−i)=1+1=21 + i(-i) = 1 + 1 = 2. (1,2): −i+i=0-i + i = 0. (2,1): i−i=0i - i = 0. (2,2): i(−i)+1=2i(-i) + 1 = 2. So A†A=12⋅2I=IA^\dagger A = \tfrac12\cdot 2I = I: yes.
Answer: Unitary but not Hermitian. (It is Rx(π/2)R_x(\pi/2), a quarter-turn about the X axis.)

4.6 · Conjugating by H

Lecture 4: rotations

Show HZH=XHZH = X.

Worked solution
  1. ZH=(100−1)12(111−1)=12(11−11)ZH = \begin{pmatrix}1&0\\0&-1\end{pmatrix}\tfrac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix} = \tfrac1{\sqrt2}\begin{pmatrix}1&1\\-1&1\end{pmatrix}.
  2. H(ZH)=12(111−1)(11−11)=12(0220)=XH(ZH) = \tfrac12\begin{pmatrix}1&1\\1&-1\end{pmatrix}\begin{pmatrix}1&1\\-1&1\end{pmatrix} = \tfrac12\begin{pmatrix}0&2\\2&0\end{pmatrix} = X.
Answer: HZH=XHZH = X. H swaps the roles of the Z and X axes; this is why “H, phase gate, H” rotates about X.
Check yourself

Which condition is both necessary and sufficient for an operator to be diagonal?

↧ Go deeper: Rotations: every gate is exp(−iθ n·σ/2) MSc

Any single-qubit unitary is, up to global phase, a rotation Rn^(θ)=e−iθ n^⋅σ⃗/2=cos⁡θ2I−isin⁡θ2(nxX+nyY+nzZ)R_{\hat n}(\theta) = e^{-i\theta\,\hat n\cdot\vec\sigma/2} = \cos\tfrac\theta2 I - i\sin\tfrac\theta2(n_xX + n_yY + n_zZ), which turns the Bloch vector by θ\theta about the axis n^\hat n. The identity uses (n^⋅σ⃗)2=I(\hat n\cdot\vec\sigma)^2 = I, which follows from the Pauli algebra above. Consequence: X=iRx(π)X = iR_x(\pi), H=iR(x^+z^)/2(π)H = iR_{(\hat x+\hat z)/\sqrt2}(\pi). Any unitary also factors as eiγRz(β)Ry(γ′)Rz(δ)e^{i\gamma}R_z(\beta)R_y(\gamma')R_z(\delta) (Euler decomposition). Nielsen & Chuang §4.2.

↧ Go deeper: Hamiltonians generate gates MSc

Physically, a gate is what Schrödinger evolution does for a time tt: U=e−iHt/ℏU = e^{-iHt/\hbar} for a Hermitian Hamiltonian HH. Hermitian ⇒ UU unitary. A spin in a magnetic field along zz has H∝ZH \propto Z, so it precesses around the Z axis: that is how hardware implements phase gates. Pulses of microwaves (superconducting qubits) or lasers (trapped ions) implement X and Y rotations.

↧ Go deeper: Solovay–Kitaev and the Clifford+T gate set PhD

{H,S,CNOT}\{H, S, \mathrm{CNOT}\} generates the Clifford group, which by the Gottesman–Knill theorem can be simulated efficiently on a classical computer. Adding TT makes the set universal. The Solovay–Kitaev theorem guarantees any single-qubit gate can be approximated to accuracy ϵ\epsilon with O(log⁡c(1/ϵ))O(\log^c(1/\epsilon)) gates; in fault-tolerant machines T gates are the expensive resource (“magic states”). Dawson & Nielsen, quant-ph/0505030.