Exercises: Chapter 6 — Quantum Gates: Pauli (X, Y, Z), Hadamard, CNOT, Phase, Toffoli — The Building Blocks of Quantum Circuits

Exercise 6.1: Gate Identities

Prove the following identities both algebraically and with Qiskit: (a) $HXH = Z$ (b) $HYH = -Y$ (c) $HZH = X$ (d) $STS^\dagger = e^{i\pi/4}T$ (up to global phase)

Exercise 6.2: Bell State Generator

Write a Qiskit circuit that produces each of the four Bell states: $$|\Phi^+\rangle = \frac{|00\rangle + |11\rangle}{\sqrt{2}}, \quad |\Phi^-\rangle = \frac{|00\rangle - |11\rangle}{\sqrt{2}}$$ $$|\Psi^+\rangle = \frac{|01\rangle + |10\rangle}{\sqrt{2}}, \quad |\Psi^-\rangle = \frac{|01\rangle - |10\rangle}{\sqrt{2}}$$ Verify each by measurement in the appropriate basis.

Exercise 6.3: Gate Decomposition

Decompose the SWAP gate into three CNOT gates. Draw the circuit diagram and verify equivalence by comparing the unitary matrices. Show that SWAP can also be decomposed using 3 CZ gates and Hadamards.

Exercise 6.4: Universal Gate Set

Show that $\{H, T, CNOT\}$ is universal by: (a) Proving that $H$ and $T$ generate any single-qubit rotation (approximately) (b) Implementing an arbitrary $U_3(\theta, \phi, \lambda)$ gate using only H and T gates (with Qiskit's transpiler) (c) Counting the number of T gates required for $\epsilon = 10^{-3}$ precision

Exercise 6.5: Toffoli from CNOTs

The Toffoli gate requires at least 6 CNOT gates to implement (without ancillas). Write a circuit that implements the Toffoli using exactly 6 CNOTs and single-qubit gates. Verify the unitary matrix matches the Toffoli.

Exercise 6.6: Rotation Gate Calculations

(a) Compute $R_x(\pi)|0\rangle$ and $R_x(\pi)|1\rangle$. What single-qubit gate is $R_x(\pi)$ equivalent to (up to global phase)? (b) Compute $R_y(\pi/2)|0\rangle$ and $R_y(\pi/2)|1\rangle$. (c) Show that $R_z(\theta) = e^{-i\theta/2} \begin{pmatrix} 1 & 0 \\ 0 & e^{i\theta} \end{pmatrix}$. Why can we ignore the global phase $e^{-i\theta/2}$? (d) Express the Hadamard gate in terms of $R_y$ and $R_z$ rotations.

Exercise 6.7: CNOT Conjugation Rules

Prove the following CNOT conjugation identities: (a) $CNOT_{12} \cdot (X \otimes I) \cdot CNOT_{12} = X \otimes X$ (spreading X) (b) $CNOT_{12} \cdot (I \otimes X) \cdot CNOT_{12} = I \otimes X$ (target X commutes) (c) $CNOT_{12} \cdot (Z \otimes I) \cdot CNOT_{12} = Z \otimes I$ (control Z commutes) (d) $CNOT_{12} \cdot (I \otimes Z) \cdot CNOT_{12} = Z \otimes Z$ (spreading Z)

Exercise 6.8: Quantum Circuit Verification

Construct the following circuit in Qiskit and predict the measurement outcome before running it:

q0: ──[H]──■──[H]──[M]
           │
q1: ──────[X]──────[M]

What is the state before measurement? Verify your prediction by simulation.

Exercise 6.9: Controlled-U Decomposition

Decompose the controlled-Hadamard gate (CH) into CNOTs and single-qubit gates using the ABC decomposition. Verify your decomposition produces the correct unitary matrix.

Exercise 6.10: Clifford vs. Non-Clifford

(a) Is $R_x(\pi/3)$ a Clifford gate? Justify your answer by checking whether it maps Pauli operators to Pauli operators. (b) Compute $R_x(\pi/3) X R_x(\pi/3)^\dagger$. Is the result a Pauli operator? (c) How many $T$ gates are needed to approximate $R_x(\pi/3)$ to precision $\epsilon = 10^{-4}$?