Exercises: Chapter 33 — Capstone: Your Quantum Algorithm Portfolio — Implemented, Executed on Real Hardware, and Analyzed

Exercise 33.1 — Bell State Tomography. Implement quantum state tomography for the Bell state $|\Phi^+\rangle$ on real hardware. Reconstruct the density matrix from measurement data and compute the fidelity with the ideal state. How does fidelity vary with the number of measurement shots?

Exercise 33.2 — Grover's with Multiple Marked Items. Modify the Grover's search implementation to search for 2 marked items out of 8. Compute the optimal number of iterations. Run on a simulator and verify that the probability of measuring a marked item is close to 1.

Exercise 33.3 — VQE Bond Dissociation Curve. Compute the VQE ground state energy of H₂ for bond distances from 0.4 Å to 3.0 Å. Plot the dissociation curve and compare with the exact result. At what distance does the VQE error become largest, and why?

Exercise 33.4 — QAOA Parameter Landscape. For a 3-regular graph with 6 vertices, plot the QAOA cost function landscape for $p = 1$ as a function of $\gamma$ and $\beta$. Identify the global minimum. How does the landscape change for $p = 2$?

Exercise 33.5 — Hardware Noise Characterization. Run the Bell state circuit on at least 3 different IBM Quantum backends. For each, compute the Hellinger fidelity, total variation distance, and estimate the CNOT gate error rate from the results. Which backend performs best, and how does this correlate with the reported calibration data?

Exercise 33.6 — Noise Budget Calculator. Write a Python function that takes a quantum circuit and hardware calibration data (gate errors, T1, T2, readout errors) as input and estimates the expected circuit fidelity. Apply this function to all eight algorithms in the portfolio and rank them by expected hardware performance.

Exercise 33.7 — Error Mitigation Comparison. Implement VQE for H₂ with three levels of error mitigation: (a) no mitigation, (b) readout error mitigation only, (c) zero-noise extrapolation + readout mitigation. Use a realistic noise model. Report the energy error for each case. What is the maximum noise level at which error mitigation can still achieve chemical accuracy (1.6 mHartree)?

Exercise 33.8 — Deutsch-Jozsa Scaling. Run Deutsch-Jozsa for $n = 2, 3, 4, 5, 6$ on both a simulator and (if available) real hardware. Plot the success probability as a function of $n$ for both. At what $n$ does the hardware success probability drop below 90%? How does this compare with your noise budget calculation?

Exercise 33.9 — QAOA Approximation Ratio. Implement QAOA for MaxCut on random 3-regular graphs with 6, 8, 10, and 12 vertices. For each, compute the QAOA approximation ratio (QAOA cut value / optimal cut value) for $p = 1, 2, 3$. Plot the approximation ratio as a function of graph size and QAOA depth. How does it compare with the Goemans-Williamson guarantee of 0.878?

Exercise 33.10 — Full Portfolio Execution. Run all eight algorithms on real IBM Quantum hardware (using the free tier). Create a report that includes: (a) the circuit for each algorithm, (b) ideal simulation results, (c) hardware results, (d) noise analysis, (e) a comparison table of expected vs. actual fidelity. This portfolio demonstrates end-to-end quantum computing skill — from mathematical derivation to hardware execution to noise analysis.