Exercises: Chapter 17 — Quantum Simulation — Modeling Molecules, Materials, and Physics That Classical Computers Can't Handle
Exercise 17.1 — Trotter Error. For the Hamiltonian $H = X_1 + Z_1 Z_2$, compute the first-order Trotter approximation error analytically. Show that $\|e^{-iHt} - (e^{-iX_1 t/r} e^{-iZ_1 Z_2 t/r})^r\| = O(t^2/r)$ by expanding the exponentials to second order in $t/r$.
Exercise 17.2 — Jordan-Wigner String. Write out the full Jordan-Wigner transformed Hamiltonian for a 2-orbital, 2-electron system (H$_2$ in minimal basis). Express each fermionic term $a_p^\dagger a_q$ and $a_p^\dagger a_q^\dagger a_r a_s$ as a Pauli string. Verify that the resulting qubit Hamiltonian is Hermitian.
Exercise 17.3 — Bravyi-Kitaev vs. Jordan-Wigner. For a system with $M = 8$ spin-orbitals, compare the maximum Pauli weight of the Hamiltonian terms under Jordan-Wigner and Bravyi-Kitaev transformations. Which mapping produces shallower circuits, and why?
Exercise 17.4 — Trotterization Convergence. Implement the transverse-field Ising model simulation from Section 17.8. Plot the fidelity $|\langle \psi_{\text{exact}} | \psi_{\text{Trotter}} \rangle|^2$ as a function of the number of Trotter steps $r$ for $r = 1, 2, 5, 10, 20, 50$. Verify the $O(1/r^2)$ scaling for the second-order formula.
Exercise 17.5 — H$_2$ Dissociation Curve. Using the Qiskit Nature code from Section 17.7, compute the H$_2$ dissociation curve for bond lengths from 0.3 Å to 3.0 Å. Plot the exact and VQE energies. At what bond length does the VQE error exceed chemical accuracy (1.6 mHartree)? Explain why the error increases at large bond lengths (hint: think about static correlation).
Exercise 17.6 — Second-Order Trotter Derivation. Derive the second-order Trotter error bound. Show that the symmetric product $S_2(\Delta t) = e^{-iA\Delta t/2} e^{-iB\Delta t} e^{-iA\Delta t/2}$ approximates $e^{-i(A+B)\Delta t}$ with error $O(\Delta t^3)$ by expanding both sides using the BCH formula and showing that the $O(\Delta t^2)$ terms cancel.
Exercise 17.7 — Fermionic Anticommutation. Verify that the Jordan-Wigner transformation preserves the fermionic anticommutation relations. Show that $\{a_p, a_q^\dagger\} = \delta_{pq} I$ and $\{a_p, a_q\} = 0$ when $a_p^\dagger$ and $a_p$ are defined as in Section 17.5.1.
Exercise 17.8 — Active Space Reduction. For the water molecule (H$_2$O) in the STO-3G basis, the full Hamiltonian requires 14 spin-orbitals (7 spatial orbitals × 2 spin states). If we freeze the 1s core orbital of oxygen and use an active space of 4 electrons in 4 orbitals (CAS(4,4)), how many qubits are needed? How many two-electron integrals remain? What is the Hilbert space dimension?
Exercise 17.9 — QPE for Chemistry. Consider using QPE (Chapter 16) to find the ground state energy of H$_2$. If the Hamiltonian has terms with norm up to $\|H_j\| \leq 1$ Hartree, and we want chemical accuracy (1.6 mHartree), how many estimation qubits are needed? How many Trotter steps per controlled-$U$ application if we use second-order Trotterization with evolution time $\tau = 1$?
Exercise 17.10 — Resource Estimation. Estimate the total number of two-qubit gates needed to simulate H$_2$ in STO-3G using second-order Trotterization with chemical accuracy. The qubit Hamiltonian has 15 terms. Assume each term requires 2 CNOT gates to implement $e^{-i\theta P}$ for a weight-2 Pauli string $P$. How does this scale for a molecule with 100 spin-orbitals and ~10,000 Hamiltonian terms?
Exercise 17.11 — Trotter Error Calculation. For the two-qubit Hamiltonian $H = X \otimes Z + Z \otimes X$, compute the first-order Trotter error bound $\|[H_1, H_2]\|$ analytically. How many Trotter steps are needed to achieve fidelity $> 0.99$ for evolution time $t = 1$?
Exercise 17.12 — JW vs BK Comparison. For a system with $M = 16$ spin-orbitals, compute the Pauli weight of the creation operator $a_8^\dagger$ under (a) the Jordan-Wigner transformation and (b) the Bravyi-Kitaev transformation. How many CNOT gates are needed to implement $e^{-i a_8^\dagger a_8 \theta}$ under each mapping?
Exercise 17.13 — VQE for H$_2$ with Custom Ansatz. Using the two-qubit H$_2$ Hamiltonian from Section 17.7.1, implement VQE with the following ansatzes and compare their performance: (a) A single-qubit rotation $R_Y(\theta)$ on each qubit. (b) A hardware-efficient ansatz with $R_Y(\theta_1)$, CNOT, $R_Y(\theta_2)$. (c) The UCCSD ansatz. For each, find the optimal parameters and compare the ground state energy to the exact value.
Exercise 17.14 — Second-Order Trotter Derivation (Detailed). Starting from the Baker-Campbell-Hausdorff formula $e^A e^B = e^{A+B+\frac{1}{2}[A,B]+\frac{1}{12}([A,[A,B]]+[B,[B,A]])+\ldots}$, derive the second-order Trotter formula step by step. Show that $S_2(\Delta t) = e^{-iA\Delta t/2}e^{-iB\Delta t}e^{-iA\Delta t/2}$ has error $O(\Delta t^3)$ by expanding both sides to third order in $\Delta t$ and showing that the $O(\Delta t^2)$ terms cancel.
Exercise 17.15 — Measuring the Transverse-Field Ising Model. The transverse-field Ising Hamiltonian $H = -J\sum Z_i Z_{i+1} - h\sum X_i$ has both ZZ terms and X terms that cannot be measured in the same basis. (a) How many distinct measurement bases are needed? (b) Group the terms into commuting families. (c) For $n = 4$ qubits, compute the number of shots needed to estimate $\langle H \rangle$ to precision $\epsilon = 0.01$ Hartree using both naive (one basis per term) and grouped measurement strategies.