Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2023/ii/paper-3/15d/d/solution

After the first Hadamard gate and the controlled unitary gate, the state is
The final Hadamard gate gives
Hence the Hadamard test returns one with probability
If , then and the outcome is zero with certainty. If , then modulo and the outcome is one with certainty. The single measurement therefore distinguishes the two promised cases exactly.

New to topics? Read the docs here!